mirror of
https://github.com/xcat2/xcat-core.git
synced 2025-06-15 19:01:44 +00:00
Merge pull request #1393 from immarvin/onksbootloader
fix issue [Customer] bootloader is not grabbing the addkcmdline from osimage #1185
This commit is contained in:
@ -370,10 +370,9 @@ sub subvars {
|
||||
|
||||
#for redhat/sl/centos/kvm/fedora
|
||||
if ($inc =~ /#XCAT_PARTITION_START#/) {
|
||||
my $tempstr = "%include /tmp/partitionfile\n";
|
||||
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$tempstr/;
|
||||
# Put the base64 coded partitionfile into %pre part
|
||||
$partcontent = "cat > /tmp/partscript.enc << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent .= "rm -rf /tmp/partitionfile\n";
|
||||
# Put the code to decode the partitionfile
|
||||
$partcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/partscript.enc\",\"rb\").read())' >/tmp/partscript\n";
|
||||
$partcontent .= "chmod 755 /tmp/partscript\n";
|
||||
@ -416,7 +415,17 @@ sub subvars {
|
||||
else{
|
||||
$partcontent =~ s/\s$//;
|
||||
if ($inc =~ /#XCAT_PARTITION_START#/){
|
||||
$inc =~ s/#XCAT_PARTITION_START#[\s\S]*#XCAT_PARTITION_END#/$partcontent/;
|
||||
# %pre and decode it out during the running time.
|
||||
use MIME::Base64;
|
||||
$partcontent = encode_base64($partcontent);
|
||||
$partcontent =~ s/\n//g;
|
||||
# Put the base64 coded partitionfile into %pre part
|
||||
$partcontent = "cat > /tmp/partitionfile.enc << EOFEOF\n" . $partcontent . "\nEOFEOF\n";
|
||||
$partcontent .= "rm -rf /tmp/partitionfile\n";
|
||||
# Put the code to decode the partitionfile
|
||||
$partcontent .= "python -c 'import base64; print base64.b64decode(open(\"/tmp/partitionfile.enc\",\"rb\").read())' >/tmp/partitionfile\n";
|
||||
#replace the #XCA_PARTITION_SCRIPT#
|
||||
$inc =~ s/#XCA_PARTITION_SCRIPT#/$partcontent/;
|
||||
}
|
||||
elsif ($inc =~ /<!-- XCAT-PARTITION-START -->/){
|
||||
$inc =~ s/<!-- XCAT-PARTITION-START -->[\s\S]*<!-- XCAT-PARTITION-END -->/$partcontent/;
|
||||
|
@ -33,7 +33,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -35,7 +35,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
@ -79,7 +79,7 @@ clearpart --all --initlabel
|
||||
#The bootloader config here is commented out
|
||||
#For user customized partition file or partition script,
|
||||
#the bootloader configuration should be specified in the user customized partition file/script
|
||||
#For the xCAT default partition scheme, the bootloader configuration is in /tmp/partitioning
|
||||
#For the xCAT default partition scheme, the bootloader configuration is in /tmp/partitionfile
|
||||
#which is generated in %pre section
|
||||
##KICKSTARTBOOTLOADER#
|
||||
|
||||
|
@ -31,7 +31,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -35,7 +35,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -35,7 +35,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -35,7 +35,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -31,7 +31,7 @@ rootpw --iscrypted #CRYPT:passwd:key=system,username=root:password#
|
||||
|
||||
|
||||
#XCAT_PARTITION_START#
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
%pre
|
||||
|
@ -33,7 +33,7 @@ key --skip
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
|
@ -34,7 +34,7 @@ key --skip
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
|
@ -37,7 +37,7 @@ key --skip
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -34,7 +34,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
@ -78,7 +78,7 @@ clearpart --all --initlabel
|
||||
#The bootloader config here is commented out
|
||||
#For user customized partition file or partition script,
|
||||
#the bootloader configuration should be specified in the user customized partition file/script
|
||||
#For the xCAT default partition scheme, the bootloader configuration is in /tmp/partitioning
|
||||
#For the xCAT default partition scheme, the bootloader configuration is in /tmp/partitionfile
|
||||
#which is generated in %pre section
|
||||
##KICKSTARTBOOTLOADER#
|
||||
|
||||
|
@ -33,7 +33,7 @@ key --skip
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
|
@ -33,7 +33,7 @@ key --skip
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
|
@ -35,7 +35,7 @@ key --skip
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
|
@ -34,7 +34,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
|
@ -35,7 +35,7 @@ key --skip
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#XCAT_PARTITION_END#
|
||||
|
||||
#RAID 0 /scr for performance
|
||||
|
@ -34,7 +34,7 @@ clearpart --all --initlabel
|
||||
#No RAID
|
||||
#/boot really significant for this sort of setup nowadays?
|
||||
#part /boot --size 50 --fstype ext3
|
||||
%include /tmp/partitioning
|
||||
%include /tmp/partitionfile
|
||||
#part swap --size 1024
|
||||
#part / --size 1 --grow --fstype ext4
|
||||
#XCAT_PARTITION_END#
|
||||
@ -78,7 +78,7 @@ clearpart --all --initlabel
|
||||
#The bootloader config here is commented out
|
||||
#For user customized partition file or partition script,
|
||||
#the bootloader configuration should be specified in the user customized partition file/script
|
||||
#For the xCAT default partition scheme, the bootloader configuration is in /tmp/partitioning
|
||||
#For the xCAT default partition scheme, the bootloader configuration is in /tmp/partitionfile
|
||||
#which is generated in %pre section
|
||||
##KICKSTARTBOOTLOADER#
|
||||
|
||||
|
@ -21,8 +21,8 @@ if [ -e "/tmp/xcat.install_disk" ]; then
|
||||
instdisk=`cat /tmp/xcat.install_disk`
|
||||
fi
|
||||
|
||||
echo "part PV.01 --ondisk=$instdisk" >> /tmp/partitioning
|
||||
echo "volgroup ibmpkvm_rootvg PV.01" >> /tmp/partitioning
|
||||
echo "part PV.01 --ondisk=$instdisk" >> /tmp/partitionfile
|
||||
echo "volgroup ibmpkvm_rootvg PV.01" >> /tmp/partitionfile
|
||||
|
||||
if [ "$XCATDEBUGMODE" = "1" ] || [ "$XCATDEBUGMODE" = "2" ]; then
|
||||
set +x
|
||||
|
@ -207,19 +207,19 @@ BOOTFSTYPE=ext3
|
||||
EFIFSTYPE=vfat
|
||||
|
||||
if [ `uname -m` = "ppc64" ]; then
|
||||
echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitioning
|
||||
echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitionfile
|
||||
fi
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo 'bootloader --driveorder='$instdisk >> /tmp/partitioning
|
||||
echo 'part /boot/efi --size 50 --ondisk '$instdisk' --fstype '$EFIFSTYPE >> /tmp/partitioning
|
||||
echo 'bootloader --driveorder='$instdisk >> /tmp/partitionfile
|
||||
echo 'part /boot/efi --size 50 --ondisk '$instdisk' --fstype '$EFIFSTYPE >> /tmp/partitionfile
|
||||
else
|
||||
echo 'bootloader' >> /tmp/partitioning
|
||||
echo 'bootloader' >> /tmp/partitionfile
|
||||
fi
|
||||
|
||||
#TODO: ondisk detection, /dev/disk/by-id/edd-int13_dev80 for legacy maybe, and no idea about efi. at least maybe blacklist SAN if mptsas/mpt2sas/megaraid_sas seen...
|
||||
echo "part /boot --size 256 --fstype $BOOTFSTYPE --ondisk $instdisk" >> /tmp/partitioning
|
||||
echo "part swap --recommended --ondisk $instdisk" >> /tmp/partitioning
|
||||
echo "part / --size 1 --grow --ondisk $instdisk --fstype $FSTYPE" >> /tmp/partitioning
|
||||
echo "part /boot --size 256 --fstype $BOOTFSTYPE --ondisk $instdisk" >> /tmp/partitionfile
|
||||
echo "part swap --recommended --ondisk $instdisk" >> /tmp/partitionfile
|
||||
echo "part / --size 1 --grow --ondisk $instdisk --fstype $FSTYPE" >> /tmp/partitionfile
|
||||
|
||||
#XCA_PARTITION_SCRIPT#
|
||||
|
||||
|
@ -176,33 +176,41 @@ if uname -r|grep -q '^3.*el7'; then
|
||||
fi
|
||||
|
||||
if [ `uname -m` = "ppc64" -o `uname -m` = "ppc64le" ]; then
|
||||
echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitioning
|
||||
echo 'part None --fstype "PPC PReP Boot" --ondisk '$instdisk' --size 8' >> /tmp/partitionfile
|
||||
fi
|
||||
if [ -d /sys/firmware/efi ]; then
|
||||
echo 'part /boot/efi --size 50 --ondisk '$instdisk' --fstype '$EFIFSTYPE >> /tmp/partitioning
|
||||
echo 'part /boot/efi --size 50 --ondisk '$instdisk' --fstype '$EFIFSTYPE >> /tmp/partitionfile
|
||||
fi
|
||||
|
||||
#TODO: ondisk detection, /dev/disk/by-id/edd-int13_dev80 for legacy maybe, and no idea about efi. at least maybe blacklist SAN if mptsas/mpt2sas/megaraid_sas seen...
|
||||
echo "part /boot --size 256 --fstype $BOOTFSTYPE --ondisk $instdisk" >> /tmp/partitioning
|
||||
echo "part swap --recommended --ondisk $instdisk" >> /tmp/partitioning
|
||||
echo "part pv.01 --size 1 --grow --ondisk $instdisk" >> /tmp/partitioning
|
||||
echo "volgroup system pv.01" >> /tmp/partitioning
|
||||
echo "logvol / --vgname=system --name=root --size 1 --grow --fstype $FSTYPE" >> /tmp/partitioning
|
||||
echo "part /boot --size 256 --fstype $BOOTFSTYPE --ondisk $instdisk" >> /tmp/partitionfile
|
||||
echo "part swap --recommended --ondisk $instdisk" >> /tmp/partitionfile
|
||||
echo "part pv.01 --size 1 --grow --ondisk $instdisk" >> /tmp/partitionfile
|
||||
echo "volgroup system pv.01" >> /tmp/partitionfile
|
||||
echo "logvol / --vgname=system --name=root --size 1 --grow --fstype $FSTYPE" >> /tmp/partitionfile
|
||||
|
||||
#specify "bootloader" configuration in "/tmp/partitioning" if there is no user customized partition file
|
||||
#specify "bootloader" configuration in "/tmp/partitionfile" if there is no user customized partition file
|
||||
BOOTLOADER="bootloader "
|
||||
|
||||
#specify the kernel options which will be persistent after installation
|
||||
[ -n "#ENV:PERSKCMDLINE#" ] && BOOTLOADER=$BOOTLOADER" --append=#ENV:PERSKCMDLINE#"
|
||||
|
||||
#Specifies which drive the boot loader should be written to
|
||||
#and therefore which drive the computer will boot from.
|
||||
[ -n "$instdisk" ] && BOOTLOADER=$BOOTLOADER" --boot-drive=$(basename $instdisk)"
|
||||
|
||||
echo "$BOOTLOADER" >> /tmp/partitioning
|
||||
echo "$BOOTLOADER" >> /tmp/partitionfile
|
||||
|
||||
#XCA_PARTITION_SCRIPT#
|
||||
|
||||
#specify the kernel options which will be persistent after installation
|
||||
if [ -n "#ENV:PERSKCMDLINE#" ];then
|
||||
#append the persistent kernel options to the lines including "bootloader --append"
|
||||
sed -i -e /bootloader/s#\'#\"#g -e '/bootloader/s/--append=\([^"]\S*[^"]\)/--append="\1"/g' -e '/bootloader/s/--append="\(.*\)"/--append="\1 #ENV:PERSKCMDLINE#"/g' /tmp/partitionfile
|
||||
#append the persistent kernel options to the lines including "bootloader" without "--append"
|
||||
sed -i -e '/bootloader/{/append=/!s/$/& --append="#ENV:PERSKCMDLINE#" /}' /tmp/partitionfile
|
||||
#append the persistent kernel options to /tmp/partitionfile if it does not include "bootloader"
|
||||
grep bootloader /tmp/partitionfile >/dev/null 2>&1|| echo -e "bootloader --append=\"#ENV:PERSKCMDLINE#\"" >>/tmp/partitionfile
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# The following code is to generate the repository for the installation
|
||||
cat /proc/cmdline
|
||||
|
Reference in New Issue
Block a user