[Adduser-devel] r195 - in trunk: . debian

Marc Haber zugschlus@costa.debian.org
Sat, 05 Feb 2005 15:21:09 +0100


Author: zugschlus
Date: 2005-02-05 15:21:08 +0100 (Sat, 05 Feb 2005)
New Revision: 195

Modified:
   trunk/debian/changelog
   trunk/deluser
Log:
deluser will now stop deleting at a mount point. Thanks to Andreas
Schmidt. (mh) Closes: #231809


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-02-05 13:57:21 UTC (rev 194)
+++ trunk/debian/changelog	2005-02-05 14:21:08 UTC (rev 195)
@@ -24,8 +24,10 @@
     configuration, deluser will not zap any important system directories
     any more. Thanks to Ernst Kloppenburg and Klaus Ethgen. (mh)
     Closes: #293559, #271829
+  * deluser will now stop deleting at a mount point. Thanks to Andreas
+    Schmidt. (mh) Closes: #231809
 
- -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat,  5 Feb 2005 14:52:35 +0100
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat,  5 Feb 2005 14:18:53 +0000
 
 adduser (3.59) unstable; urgency=low
 

Modified: trunk/deluser
===================================================================
--- trunk/deluser	2005-02-05 13:57:21 UTC (rev 194)
+++ trunk/deluser	2005-02-05 14:21:08 UTC (rev 195)
@@ -268,12 +268,29 @@
 	dief (_("passwd home dir `%s' does not match command line home dir, aborting.\n"),$pw_homedir,$config{"home"});
     } elsif($config{"remove_home"} || $config{"remove_all_files"}) {
 	s_print(_("Looking for files to backup/remove...\n"));
+	my @mountpoints;
+	open(MOUNT, "mount |")
+		|| die ("fork for parse mount points: $!\n");
+        while (<MOUNT>) {
+		chomp;
+	        my @temparray = split;
+	        push @mountpoints,$temparray[2];
+        }
+	close(MOUNT) or die ("can't close mount pipe: $!\n");
 	my(@files,@dirs);
 	if($config{"remove_home"} && ! $config{"remove_all_files"}) {
 	  sub home_match {
-	    foreach $re ( split ' ', $config{"no_del_paths"} ) {
+	    foreach my $mount (@mountpoints) {
+	      if( $File::Find::name eq $mount ) {
+		s_print(_("Not backing up/removing $File::Find::name, it is a mount point.\n"));
+		$File::Find::prune=1;
+		return;
+	      }
+	    }
+	    foreach my $re ( split ' ', $config{"no_del_paths"} ) {
 	      if( $File::Find::name =~ qr/$re/ ) {
 		s_print(_("Not backing up/removing $File::Find::name, it matches $re.\n"));
+		$File::Find::prune=1;
 		return;
 	      }
 	    }