From: lace <> Date: Thu, 29 Dec 2005 04:08:57 +0000 (+0000) Subject: --add no longer replaces existing "captive-ntfs" entries by default. X-Git-Tag: captive-1_1_6_1~3 X-Git-Url: http://git.jankratochvil.net/?p=captive.git;a=commitdiff_plain;h=81cd5502ba8663c915d96b8159df31907254a2d0 --add no longer replaces existing "captive-ntfs" entries by default. +Option --replace will replace them in the former manner. --- diff --git a/src/install/fstab/captive-install-fstab.pod.pl.in b/src/install/fstab/captive-install-fstab.pod.pl.in index a89cd08..1044bc8 100644 --- a/src/install/fstab/captive-install-fstab.pod.pl.in +++ b/src/install/fstab/captive-install-fstab.pod.pl.in @@ -67,8 +67,8 @@ You will probably use this option together with [B<-v>|B<--verbose>]. =item B<--add> Add all the found B disk drive partitions to B. -Any previous B entries will be deleted as described in -B<--remove> option. +Previous B entries for the same device will be kept +if B<--replace> is not used. =item B<--remove> @@ -77,6 +77,12 @@ Remove all lines of filesystem type B<@PACKAGE@-ntfs> and device name in B directory. +=item B<--replace> + +Replace existing entries by new ones on B<--add>. By default the existing +B entries are kept untouched. + + =back diff --git a/src/install/fstab/main.c b/src/install/fstab/main.c index 1739a44..29d1410 100644 --- a/src/install/fstab/main.c +++ b/src/install/fstab/main.c @@ -56,6 +56,7 @@ static int optarg_verbose; static int optarg_dry; +static int optarg_replace; enum optarg_mode { OPTARG_MODE_UNDEF =0, OPTARG_MODE_ADD =1, @@ -80,6 +81,7 @@ static const struct poptOption popt_table[]={ BUG_FSTAB_POPT('n',"dry" ,POPT_ARG_NONE,&optarg_dry ,0,N_("No real modifications - simulate only"),NULL), BUG_FSTAB_POPT(0 ,"add" ,POPT_ARG_NONE,&optarg_mode ,OPTARG_MODE_ADD ,N_("Add entries to /etc/fstab"),NULL), BUG_FSTAB_POPT(0 ,"remove" ,POPT_ARG_NONE,&optarg_mode ,OPTARG_MODE_REMOVE,N_("Remove entries from /etc/fstab"),NULL), + BUG_FSTAB_POPT(0 ,"replace",POPT_ARG_NONE,&optarg_replace,0,N_("Replace existing entries by new ones on --add"),NULL), #undef BUG_FSTAB_POPT POPT_AUTOHELP @@ -267,11 +269,20 @@ size_t comments_len; if (!g_hash_table_lookup(proc_partitions_ntfs_hash,mntent->mnt_fsname)) g_warning(_("Dropping no-longer valid captive filesystem mntent from \"%s\" of device: %s"), FILENAME_ETC_FSTAB,mntent->mnt_fsname); - else { + else if (optarg_replace) { /* Original mntent is dropped to be replaced by new one. */ if (optarg_verbose) g_message(_("Dropping captive mntent to be replaced by new one: %s"),mntent->mnt_fsname); } + else { +gboolean errbool; + + errbool=g_hash_table_remove(proc_partitions_ntfs_hash,mntent->mnt_fsname); + g_assert(errbool); + if (optarg_verbose) + g_message(_("Keeping existing captive mntent: %s"),mntent->mnt_fsname); + break; + } modified=TRUE; continue; /* NOTREACHED */