Commit 929209f2 authored by David Johnson's avatar David Johnson

Don't worry about updating /etc/dumpdates if /etc/fstab doesn't exist

(i.e., if we're in a straight chroot that has no special files munged into
it).
parent 529edd9e
...@@ -144,28 +144,30 @@ if (-x "/etc/cron.pend/slocate.cron") { ...@@ -144,28 +144,30 @@ if (-x "/etc/cron.pend/slocate.cron") {
# need entries, and then put in entries for each filesystem using # need entries, and then put in entries for each filesystem using
# the current date. # the current date.
# #
print "Removing old $DUMPDATES file ...\n"; if (-e $FSTAB) {
if (-e $DUMPDATES) { print "Removing old $DUMPDATES file ...\n";
unlink($DUMPDATES) or if (-e $DUMPDATES) {
die("Could not unlink $DUMPDATES"); unlink($DUMPDATES) or
} die("Could not unlink $DUMPDATES");
}
print "Creating stub /etc/dumpdates file ...\n"; print "Creating stub /etc/dumpdates file ...\n";
open(TAB, "$FSTAB") or open(TAB, "$FSTAB") or
die("Could not open $FSTAB: $!"); die("Could not open $FSTAB: $!");
open(DMP, ">$DUMPDATES") or open(DMP, ">$DUMPDATES") or
die("Could not open $DUMPDATES: $!"); die("Could not open $DUMPDATES: $!");
while (<TAB>) { while (<TAB>) {
if ($_ =~ /^([\w\/]+).*(\d).*\d$/) { if ($_ =~ /^([\w\/]+).*(\d).*\d$/) {
if ($2 != 0) { if ($2 != 0) {
my $t = localtime(time); my $t = localtime(time);
print DMP "$1 0 $t\n"; print DMP "$1 0 $t\n";
}
} }
} }
close(DMP);
close(TAB);
} }
close(DMP);
close(TAB);
print "Cleaning logfiles ...\n"; print "Cleaning logfiles ...\n";
opendir(LOG,$LOGDIR) or opendir(LOG,$LOGDIR) or
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment