Commit 3433fa8c authored by Mike Hibler's avatar Mike Hibler

Watch out for "schg" flag on /kernel that the /usr/src makefile sets.

If unlink fails, do chflags and try again.
parent 54c28883
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004 University of Utah and the Flux Group.
# Copyright (c) 2004, 2005 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -40,17 +40,30 @@ if (-e $kernel) {
}
if (system("cmp -s /kernel $kernel") != 0) {
my $failed = 0;
if (system("cp -f /kernel /kernel.save")) {
$failed = 1;
print "Could not backup /kernel! Aborting kernel change\n";
}
elsif (! unlink("/kernel")) {
print "Could not unlink /kernel! Aborting kernel change\n";
}
elsif (system("cp -f $kernel /kernel")) {
print "Could not cp $kernel to /kernel!\n";
$failed = 1;
if (-x "/usr/bin/chflags") {
system("/usr/bin/chflags noschg /kernel");
if (! unlink("/kernel")) {
print "Could not unlink /kernel! Aborting kernel change\n";
} else {
$failed = 0;
}
}
}
else {
print "Copied $kernel to /kernel.\n";
if ($failed == 0) {
if (system("cp -f $kernel /kernel")) {
print "Could not cp $kernel to /kernel!\n";
}
else {
print "Copied $kernel to /kernel.\n";
}
}
}
}
......
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