9
0
Fork 0

automount: optionally make directory

Add an option to create the mount path to make using this command easier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2012-04-15 16:50:31 +02:00
parent b3aea10890
commit eeb3440419
1 changed files with 11 additions and 2 deletions

View File

@ -27,9 +27,9 @@
static int do_automount(int argc, char *argv[])
{
int opt, ret;
int opt, ret, make_dir = 0;
while ((opt = getopt(argc, argv, "lr:")) > 0) {
while ((opt = getopt(argc, argv, "lr:d")) > 0) {
switch (opt) {
case 'l':
automount_print();
@ -37,12 +37,21 @@ static int do_automount(int argc, char *argv[])
case 'r':
automount_remove(optarg);
return 0;
case 'd':
make_dir = 1;
break;
}
}
if (optind + 2 != argc)
return COMMAND_ERROR_USAGE;
if (make_dir) {
ret = make_directory(argv[optind]);
if (ret)
return ret;
}
ret = automount_add(argv[optind], argv[optind + 1]);
if (ret)
printf("adding automountpoint failed: %s\n",