2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-30 01:26:38 +00:00

refine the coding style;add comments

This commit is contained in:
immarvin 2016-04-18 03:00:25 -04:00
parent 7876697e30
commit 0488542cb2

View File

@ -77,11 +77,11 @@ sub xdie {
#helper subroutine to get the major release number
#of a osver
sub majversion {
my $version=shift;
my $version = shift;
my $majorrel;
if($osver =~ /$\D*(\d*)[.\d]*$/){
$majorrel=$1;
if($osver =~ /^\D*(\d*)[.\d]*$/){
$majorrel = $1;
}
return $majorrel;
@ -90,11 +90,10 @@ sub majversion {
sub mount_chroot {
my $rootimage_dir = shift;
#postinstall script of some packages might access the /proc, /sys and /dev filesystem
#For Redhat7 or above, mount these directories readonly from host to avoid error messages
#For Redhat6 or below, mount these directories might introduce error messages
if(majversion($osver) > 6){
#postinstall script of package installation
#might access the /proc, /sys and /dev filesystem
#mount them from host read-only
#only available for rh7 or above
system("mkdir -p $rootimage_dir/proc");
system("mount proc $rootimage_dir/proc -t proc -o ro");
system("mkdir -p $rootimage_dir/sys");