-Have geninitrd/genimage clean up temp directory on 'dies' and ctrl-c

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1452 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-05-20 14:12:27 +00:00
parent cc97f6da9a
commit 443c57ddff

View File

@ -33,6 +33,12 @@ my $installroot = "/install";
my $kernelver = ""; #`uname -r`;
my $basekernelver; # = $kernelver;
sub xdie {
system("rm -rf /tmp/xcatinitrd.$$");
die @_;
}
$SIG{INT} = $SIG{TERM} = sub { xdie "Interrupted" };
GetOptions(
'a=s' => \$arch,
'p=s' => \$profile,
@ -170,7 +176,7 @@ sub mkinitrd {
copy("/boot/vmlinuz-$kernelver","$installroot/netboot/$osver/$arch/$profile/kernel");
}
else {
die("Cannot read /boot/vmlinuz-$kernelver");
xdie("Cannot read /boot/vmlinuz-$kernelver");
}
}
symlink("bin","/tmp/xcatinitrd.$$/sbin");
@ -361,7 +367,7 @@ EOMS
system("cd /lib/modules;cp -r $kernelver $installroot/netboot/$osver/$arch/$profile/rootimg/lib/modules/");
}
else {
die("Cannot read /lib/modules/$kernelver");
xdie("Cannot read /lib/modules/$kernelver");
}
}
}