mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-08-21 18:50:28 +00:00
add xz to rh6 netboot pkglist;do not mount /proc,/sys and /dev during genimage for rh6;do not add syslog module for dracut to generate initrd on rh6
This commit is contained in:
@@ -24,3 +24,4 @@ lsvpd
|
||||
irqbalance
|
||||
procps
|
||||
parted
|
||||
xz
|
||||
|
@@ -20,3 +20,4 @@ rsync
|
||||
rsyslog
|
||||
e2fsprogs
|
||||
parted
|
||||
xz
|
||||
|
@@ -73,18 +73,35 @@ sub xdie {
|
||||
die @_;
|
||||
}
|
||||
|
||||
|
||||
#helper subroutine to get the major release number
|
||||
#of a osver
|
||||
sub majversion {
|
||||
my $version=shift;
|
||||
my $majorrel;
|
||||
|
||||
if($osver =~ /$\D*(\d*)[.\d]*$/){
|
||||
$majorrel=$1;
|
||||
}
|
||||
|
||||
return $majorrel;
|
||||
}
|
||||
|
||||
sub mount_chroot {
|
||||
my $rootimage_dir = shift;
|
||||
|
||||
#postinstall script of package installation
|
||||
#might access the /proc, /sys and /dev filesystem
|
||||
#mount them from host read-only
|
||||
system("mkdir -p $rootimage_dir/proc");
|
||||
system("mount proc $rootimage_dir/proc -t proc -o ro");
|
||||
system("mkdir -p $rootimage_dir/sys");
|
||||
system("mount sysfs $rootimage_dir/sys -t sysfs -o ro");
|
||||
system("mkdir -p $rootimage_dir/dev");
|
||||
system("mount devtmpfs $rootimage_dir/dev -t devtmpfs -o ro");
|
||||
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");
|
||||
system("mount sysfs $rootimage_dir/sys -t sysfs -o ro");
|
||||
system("mkdir -p $rootimage_dir/dev");
|
||||
system("mount devtmpfs $rootimage_dir/dev -t devtmpfs -o ro");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,9 +109,11 @@ sub mount_chroot {
|
||||
sub umount_chroot {
|
||||
my $rootimage_dir = shift;
|
||||
|
||||
system("umount $rootimage_dir/proc");
|
||||
system("umount $rootimage_dir/sys");
|
||||
system("umount $rootimage_dir/dev");
|
||||
if(majversion($osver) >6){
|
||||
system("umount $rootimage_dir/proc");
|
||||
system("umount $rootimage_dir/sys");
|
||||
system("umount $rootimage_dir/dev");
|
||||
}
|
||||
}
|
||||
|
||||
#check whether a dir is NFS mounted
|
||||
@@ -969,14 +988,19 @@ sub mkinitrd_dracut {
|
||||
$perm = (stat("$fullpath/$dracutdir/installkernel"))[2];
|
||||
chmod($perm&07777, "$dracutmpath/installkernel");
|
||||
|
||||
my $dracutmodulelist=" xcat nfs base network kernel-modules ";
|
||||
if (-d glob($dracutmoduledir."[0-9]*fadump")){
|
||||
$dracutmodulelist .=" fadump ";
|
||||
|
||||
}
|
||||
|
||||
if ($dracutver >= "033") {
|
||||
$dracutmodulelist .= " syslog ";
|
||||
}
|
||||
|
||||
# update etc/dracut.conf
|
||||
open($DRACUTCONF, '>', "$rootimg_dir/etc/dracut.conf");
|
||||
if (-d glob($dracutmoduledir."[0-9]*fadump")){
|
||||
print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules fadump syslog"\n};
|
||||
}
|
||||
else{
|
||||
print $DRACUTCONF qq{dracutmodules+="xcat nfs base network kernel-modules syslog"\n};
|
||||
}
|
||||
print $DRACUTCONF qq{dracutmodules+="$$dracutmodulelist"\n};
|
||||
print $DRACUTCONF qq{add_drivers+="$add_drivers"\n};
|
||||
close $DRACUTCONF;
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user