--add no longer replaces existing "captive-ntfs" entries by default.
authorlace <>
Thu, 29 Dec 2005 04:08:57 +0000 (04:08 +0000)
committerlace <>
Thu, 29 Dec 2005 04:08:57 +0000 (04:08 +0000)
+Option --replace will replace them in the former manner.

src/install/fstab/captive-install-fstab.pod.pl.in
src/install/fstab/main.c

index a89cd08..1044bc8 100644 (file)
@@ -67,8 +67,8 @@ You will probably use this option together with [B<-v>|B<--verbose>].
 =item B<--add>
 
 Add all the found B<NTFS> disk drive partitions to B</etc/fstab>.
-Any previous B<captive-ntfs> entries will be deleted as described in
-B<--remove> option.
+Previous B<captive-ntfs> 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</dev> directory.
 
 
+=item B<--replace>
+
+Replace existing entries by new ones on B<--add>. By default the existing
+B<captive-ntfs> entries are kept untouched.
+
+
 =back
 
 
index 1739a44..29d1410 100644 (file)
@@ -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 */