summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2003-11-07 11:57:56 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2003-11-07 11:57:56 +0000
commit7755da84efea5d3aa8131e145b3abba32a697991 (patch)
tree83685d6983952cace0610a6472e7269c6363dced
parent99a3826e5565e26daf44b1139b6732be93a1b560 (diff)
downloaddrakx-7755da84efea5d3aa8131e145b3abba32a697991.tar
drakx-7755da84efea5d3aa8131e145b3abba32a697991.tar.gz
drakx-7755da84efea5d3aa8131e145b3abba32a697991.tar.bz2
drakx-7755da84efea5d3aa8131e145b3abba32a697991.tar.xz
drakx-7755da84efea5d3aa8131e145b3abba32a697991.zip
*** empty log message ***
-rwxr-xr-xmove/tools/scan-etc.pl52
1 files changed, 52 insertions, 0 deletions
diff --git a/move/tools/scan-etc.pl b/move/tools/scan-etc.pl
new file mode 100755
index 000000000..7a2c046cb
--- /dev/null
+++ b/move/tools/scan-etc.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+
+# To be used replacing move::init handling of etc files with:
+#
+# system("cp -a /image/etc /");
+# symlinkf "/proc/mounts", "/etc/mtab";
+# system("find /etc -type f > /tmp/filelist");
+# touch '/dummy';
+# m|^/var| && !-d $_ and mkdir_p $_ foreach chomp_(cat_('/image/move/directories-to-create'));
+# sleep 2;
+# goto meuh;
+
+use MDK::Common;
+
+sub date_to_raw {
+ my ($y, $m, $d, $h, $mi, $s) = $_[0] =~ /\s(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)\./;
+ ($y-1970)*32140800 + $m*2678400 + $d*86400 + $h*3600 + $mi*60 + $s;
+}
+
+sub stat_ {
+ my ($f) = @_;
+
+ my (undef, undef, undef, undef, $a, $m, $c) = `stat $f`;
+
+ my $araw = date_to_raw($a);
+ my $mraw = max(date_to_raw($m), date_to_raw($c));
+
+ [ $araw, $mraw ];
+}
+
+our $reference = (stat_('/dummy'))->[0];
+
+our @old_filelist = chomp_(cat_("/tmp/filelist"));
+foreach (chomp_(`find /etc -type f`)) {
+ if (!member($_, @old_filelist)) {
+ push @new, $_;
+ } else {
+ $times = stat_($_);
+ $times->[0] > $reference and push @read, $_;
+ $times->[1] > $reference and push @wrote, $_;
+ }
+}
+
+print "read:\n";
+print "\t$_\n" foreach sort @read;
+
+print "wrote:\n";
+print "\t$_\n" foreach sort @wrote;
+
+print "new:\n";
+print "\t$_\n" foreach sort @new;
+