Commit 575ac4bc authored by Mike Hibler's avatar Mike Hibler

Make sure the ownership of the image files is correct.

parent 4b74ef96
...@@ -132,6 +132,13 @@ if (-e $filename) { ...@@ -132,6 +132,13 @@ if (-e $filename) {
} }
} }
#
# Create the new file now so it is owned by the user and not root
#
if (!open(FILE, "> $filename") || !close(FILE)) {
goto failed;
}
# #
# XXX tmp hack: see if there is a newer version of the image zipper. # XXX tmp hack: see if there is a newer version of the image zipper.
# This way we do not have to update the admin MFS everytime we want to # This way we do not have to update the admin MFS everytime we want to
...@@ -149,21 +156,21 @@ if (-x "/proj/$pid/bin/$zipperbin") { ...@@ -149,21 +156,21 @@ if (-x "/proj/$pid/bin/$zipperbin") {
# #
print STDERR "$me: doing '$sudo $zipper $args $device $filename'\n" print STDERR "$me: doing '$sudo $zipper $args $device $filename'\n"
if ($debug); if ($debug);
if (system("$sudo $zipper $args $device $filename")) { if (system("$sudo $zipper $args $device $filename") == 0) {
print STDERR "*** Failed to create image!\n"; #
# Get rid of the backup image
#
if ($ofilename ne "") { if ($ofilename ne "") {
print STDERR " Restoring old image\n"; unlink($ofilename);
rename($ofilename, $filename) or
warn(" Could not restore old image file!\n");
} }
exit 1; exit 0;
} }
# failed:
# Get rid of the backup image print STDERR "*** Failed to create image $filename!\n";
#
if ($ofilename ne "") { if ($ofilename ne "") {
unlink($ofilename); print STDERR " Restoring old image\n";
rename($ofilename, $filename) or
warn(" Could not restore old image file!\n");
} }
exit 1;
exit 0;
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