[Adduser-devel] r194 - in trunk: . debian doc

Marc Haber zugschlus@costa.debian.org
Sat, 05 Feb 2005 14:57:22 +0100


Author: zugschlus
Date: 2005-02-05 14:57:21 +0100 (Sat, 05 Feb 2005)
New Revision: 194

Modified:
   trunk/debian/changelog
   trunk/deluser
   trunk/doc/deluser.conf.5
Log:
  * Add a new config option NO_DEL_PATHS to deluser.conf with a
    sensible default in the deluser source code. In the default
    configuration, deluser will not zap any important system directories
    any more. Thanks to Ernst Kloppenburg and Klaus Ethgen. (mh)
    Closes: #293559, #271829



Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2005-02-05 12:51:29 UTC (rev 193)
+++ trunk/debian/changelog	2005-02-05 13:57:21 UTC (rev 194)
@@ -19,8 +19,13 @@
     Closes: #273010.
   * Add Italian program translation. Thanks to Luca Monducci. (mh)
     Closes: #271142.
+  * Add a new config option NO_DEL_PATHS to deluser.conf with a
+    sensible default in the deluser source code. In the default
+    configuration, deluser will not zap any important system directories
+    any more. Thanks to Ernst Kloppenburg and Klaus Ethgen. (mh)
+    Closes: #293559, #271829
 
- -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat,  5 Feb 2005 13:51:00 +0100
+ -- Marc Haber <mh+debian-packages@zugschlus.de>  Sat,  5 Feb 2005 14:52:35 +0100
 
 adduser (3.59) unstable; urgency=low
 

Modified: trunk/deluser
===================================================================
--- trunk/deluser	2005-02-05 12:51:29 UTC (rev 193)
+++ trunk/deluser	2005-02-05 13:57:21 UTC (rev 194)
@@ -124,6 +124,7 @@
 $config{"quotauser"} = "";
 $config{"dir_mode"} = "0755";
 $config{"setgid_home"} = "no";
+$config{"no_del_paths"} = "^/$ ^/lost+found/.* ^/media/.* ^/mnt/.* ^/etc/.* ^/bin/.* ^/boot/.* ^/dev/.* ^/lib/.* ^/proc/.* ^/root/.* ^/sbin/.* ^/tmp/.* ^/sys/.* ^/srv/.* ^/opt/.* ^/initrd/.* ^/usr/.* ^/var/.*";
 
 $action = $0 =~ /delgroup$/ ? "delgroup" : "deluser";
 
@@ -270,6 +271,12 @@
 	my(@files,@dirs);
 	if($config{"remove_home"} && ! $config{"remove_all_files"}) {
 	  sub home_match {
+	    foreach $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"));
+		return;
+	      }
+	    }
 	    push(@files, $File::Find::name) 
 	      if(-f $File::Find::name);
 	    push(@dirs, $File::Find::name)

Modified: trunk/doc/deluser.conf.5
===================================================================
--- trunk/doc/deluser.conf.5	2005-02-05 12:51:29 UTC (rev 193)
+++ trunk/doc/deluser.conf.5	2005-02-05 13:57:21 UTC (rev 194)
@@ -54,6 +54,13 @@
 .B BACKUP_TO
 specifies the directory the backup is written to. Default is the
 current directory.
+.TP
+\fBNO_DEL_PATHS\fP
+A list of regular expressions, space separated. All files to be
+deleted in course of deleting home directories or deleting files owned
+by the user to be deleted are checked against each of these regular
+expressions. If a match is detected, the file is not deleted. Defaults
+to a list of system directories, leaving only /home.
 .SH FILES
 .I /etc/deluser.conf
 .SH SEE ALSO