summaryrefslogtreecommitdiffstats
path: root/move
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-20 17:47:22 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-20 17:47:22 +0000
commit85fa0483ffeaf672f394c395b174baa4791bad0a (patch)
tree1e9eaec9897dcdc11958c6b7c86d4fe844570523 /move
parentedce203ab42571ebef304b2b04848a1ff654fda9 (diff)
downloaddrakx-85fa0483ffeaf672f394c395b174baa4791bad0a.tar
drakx-85fa0483ffeaf672f394c395b174baa4791bad0a.tar.gz
drakx-85fa0483ffeaf672f394c395b174baa4791bad0a.tar.bz2
drakx-85fa0483ffeaf672f394c395b174baa4791bad0a.tar.xz
drakx-85fa0483ffeaf672f394c395b174baa4791bad0a.zip
etc-monitorer now also handles removal of files
Diffstat (limited to 'move')
-rwxr-xr-xmove/etc-monitorer.pl10
-rw-r--r--move/move.pm2
2 files changed, 9 insertions, 3 deletions
diff --git a/move/etc-monitorer.pl b/move/etc-monitorer.pl
index fa8fa6aa5..4bb8e06ec 100755
--- a/move/etc-monitorer.pl
+++ b/move/etc-monitorer.pl
@@ -9,14 +9,20 @@ my $machine_ident = cat_('/var/lib/machine_ident');
my $sysconf = "/home/.sysconf/$machine_ident";
foreach my $dir (@ARGV) {
- foreach (glob_("$dir/*")) {
+ my $destdir = "/home/.sysconf/$machine_ident";
+ my @etcfiles = glob_("$dir/*");
+ foreach (@etcfiles) {
next if $_ eq '/etc/sudoers'; #- /etc/sudoers can't be a link
if (-f && !-l) {
- my $dest = "/home/.sysconf/$machine_ident$_";
+ my $dest = "$destdir$_";
mkdir_p(dirname($dest)); #- case of newly created directories
logit("restoring broken symlink $_ -> $dest");
system("mv $_ $dest 2>/dev/null");
symlink($dest, $_);
}
}
+ foreach (difference2([ grep { -f && s/^\Q$destdir\E// } glob_("$destdir$dir/*") ], [ @etcfiles ])) {
+ logit("removing $destdir$_ because of deleted $_");
+ unlink "$destdir$_";
+ }
}
diff --git a/move/move.pm b/move/move.pm
index 1f2760edb..a126a4b4a 100644
--- a/move/move.pm
+++ b/move/move.pm
@@ -452,7 +452,7 @@ sub install2::startMove {
if (cat_('/proc/mounts') =~ m|\s/home\s|) {
output '/var/lib/machine_ident', machine_ident();
run_program::run('/usr/bin/etc-monitorer.pl', uniq map { dirname($_) } chomp_(`find /etc -type f`));
- run_program::raw({ detach => 1 }, '/usr/bin/dnotify', '-MCR', '/etc', '-r', '-e', '/usr/bin/etc-monitorer.pl', '{}') or die "dnotify not found!";
+ run_program::raw({ detach => 1 }, '/usr/bin/dnotify', '-MCRD', '/etc', '-r', '-e', '/usr/bin/etc-monitorer.pl', '{}') or die "dnotify not found!";
}
#- allow user customisation of startup through /etc/rc.d/rc.local