add two options to mount: -L and -U
mount -L BUSYBOX /mnt/iso
mount -U 110E8400-E29B-11D4-A716-446655440000 /mnt/iso
Thanks
Malek
--- busybox/util-linux/mount.c.orig 2008-09-29 07:48:40.000000000 +0000
+++ busybox/util-linux/mount.c 2008-09-29 14:49:37.000000000 +0000
@@ -75,6 +75,10 @@ enum {
OPT_v = (1 << 7),
OPT_s = (1 << 8),
OPT_i = (1 << 9),
+#if ENABLE_FEATURE_MOUNT_LABEL
+ OPT_L = (1 << 10),
+ OPT_U = (1 << 11),
+#endif
};
#if ENABLE_FEATURE_MTAB_SUPPORT
@@ -1755,6 +1759,9 @@ int mount_main(int argc UNUSED_PARAM, ch
char *fstype = NULL;
char *storage_path;
char *opt_o;
+#if ENABLE_FEATURE_MOUNT_LABEL
+ char *opt_label;
+#endif
const char *fstabname;
FILE *fstab;
int i, j, rc = 0;
@@ -1776,8 +1783,10 @@ int mount_main(int argc UNUSED_PARAM, ch
// Parse remaining options
// Max 2 params; -v is a counter
- opt_complementary = "?2" USE_FEATURE_MOUNT_VERBOSE(":vv");
- opt = getopt32(argv, OPTION_STR, &opt_o, &fstype
+ opt_complementary = "?2" USE_FEATURE_MOUNT_VERBOSE(":vv")
+ USE_FEATURE_MOUNT_LABEL("L-U:U-L");
+ opt = getopt32(argv, OPTION_STR USE_FEATURE_MOUNT_LABEL("L:U:"), &opt_o, &fstype
+ USE_FEATURE_MOUNT_LABEL(, &opt_label, &opt_label)
USE_FEATURE_MOUNT_VERBOSE(, &verbose));
if (opt & OPT_o) append_mount_options(&cmdopts, opt_o); // -o
if (opt & OPT_r) append_mount_options(&cmdopts, "ro"); // -r
@@ -1813,7 +1822,31 @@ int mount_main(int argc UNUSED_PARAM, ch
// When we have two arguments, the second is the directory and we can
// skip looking at fstab entirely. We can always abspath() the directory
// argument when we get it.
- if (argv[1]) {
+ if (!argv[1]) {
+#if ENABLE_FEATURE_MOUNT_LABEL
+ if (opt & OPT_L || opt & OPT_U) {
+ char *tmp = NULL;
+
+ if (nonroot)
+ bb_error_msg_and_die(must_be_root);
+
+ if (opt & OPT_L)
+ tmp = xasprintf("%s%s", "LABEL=", opt_label);
+ else
+ tmp = xasprintf("%s%s", "UUID=", opt_label);
+
+ mtpair->mnt_fsname = tmp;
+ mtpair->mnt_dir = argv[0];
+ mtpair->mnt_type = fstype;
+ mtpair->mnt_opts = cmdopts;
+ if (ENABLE_FEATURE_MOUNT_LABEL) {
+ resolve_mount_spec(&mtpair->mnt_fsname);
+ }
+ rc = singlemount(mtpair, 0);
+ return rc;
+ }
+#endif
+ } else {
if (nonroot)
bb_error_msg_and_die(must_be_root);
mtpair->mnt_fsname = argv[0];
--- busybox/include/usage.h.orig 2008-09-29 15:00:26.000000000 +0000
+++ busybox/include/usage.h 2008-09-29 15:00:26.000000000 +0000
@@ -2665,6 +2665,10 @@
"\n -r Read-only mount" \
"\n -t fs-type Filesystem type" \
"\n -w Read-write mount (default)" \
+ USE_FEATURE_MOUNT_LABEL( \
+ "\n -L label Filesystem label" \
+ "\n -U UUID Filesystem UUID" \
+ ) \
"\n" \
"-o option:\n" \
USE_FEATURE_MOUNT_LOOP( \
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox