summaryrefslogtreecommitdiffstats
path: root/move/etc-monitorer.pl
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/etc-monitorer.pl
parentedce203ab42571ebef304b2b04848a1ff654fda9 (diff)
downloaddrakx-backup-do-not-use-85fa0483ffeaf672f394c395b174baa4791bad0a.tar
drakx-backup-do-not-use-85fa0483ffeaf672f394c395b174baa4791bad0a.tar.gz
drakx-backup-do-not-use-85fa0483ffeaf672f394c395b174baa4791bad0a.tar.bz2
drakx-backup-do-not-use-85fa0483ffeaf672f394c395b174baa4791bad0a.tar.xz
drakx-backup-do-not-use-85fa0483ffeaf672f394c395b174baa4791bad0a.zip
etc-monitorer now also handles removal of files
Diffstat (limited to 'move/etc-monitorer.pl')
-rwxr-xr-xmove/etc-monitorer.pl10
1 files changed, 8 insertions, 2 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$_";
+ }
}