#!/usr/bin/perl use MDK::Common; sub outpend { my $f = shift; local *F; open F, ">>$f" or die "outpend in file $f failed: $!\n"; print F foreach @_ } sub logit { outpend "/var/log/etc-monitorer.log", sprintf("[%s] @_\n", chomp_(`date`)) } foreach my $dir (@ARGV) { my $destdir = '/home/.sysconf/' . cat_('/var/lib/machine_ident'); my @etcfiles = glob_("$dir/*"); foreach (@etcfiles) { if ($_ eq '/etc/sudoers' #- /etc/sudoers can't be a link || $_ eq '/etc/mtab' #- same for /etc/mtab || !-f || -l && readlink =~ m|^/|) { #- we want to trap relative symlinks only next; } my $dest = "$destdir$_"; mkdir_p(dirname($dest)); #- case of newly created directories logit("restoring broken symlink $_ -> $dest"); if (-l) { system("cp $_ $dest 2>/dev/null"); } else { system("mv $_ $dest 2>/dev/null"); } symlinkf($dest, $_); } foreach (difference2([ grep { -f && s/^\Q$destdir\E// } glob_("$destdir$dir/*") ], [ @etcfiles ])) { logit("removing $destdir$_ because of deleted $_"); unlink "$destdir$_"; } } .0 Mageia Installer and base platform for many utilitiesThierry Vignaud [tv]
summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2005-03-10 17:37:30 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2005-03-10 17:37:30 +0000
commit3fb415deb585958c2e8f5cf86cfafc899fd9153a (patch)
tree0faa0c64026e49a447ec0493d0a18b61734e4645 /perl-install
parent6d78c312b8c7da49ef52d93fb1e6d8186cd8beef (diff)
downloaddrakx-3fb415deb585958c2e8f5cf86cfafc899fd9153a.tar
drakx-3fb415deb585958c2e8f5cf86cfafc899fd9153a.tar.gz
drakx-3fb415deb585958c2e8f5cf86cfafc899fd9153a.tar.bz2
drakx-3fb415deb585958c2e8f5cf86cfafc899fd9153a.tar.xz
drakx-3fb415deb585958c2e8f5cf86cfafc899fd9153a.zip
fix kde merge
Diffstat (limited to 'perl-install')