diff --git a/xCAT-server/lib/perl/xCAT/Template.pm b/xCAT-server/lib/perl/xCAT/Template.pm index 312bb123e..c3d86d410 100644 --- a/xCAT-server/lib/perl/xCAT/Template.pm +++ b/xCAT-server/lib/perl/xCAT/Template.pm @@ -110,6 +110,13 @@ sub subvars { } $ENV{PERSKCMDLINE}=getPersistentKcmdline($node); + my $installroot; + $installroot = xCAT::TableUtils->get_site_attribute("installdir"); + if (!defined($installroot)) { + $installroot = "/install"; + } + $ENV{INSTALLDIR} = $installroot; + #replace the env with the right value so that correct include files can be found $inc =~ s/#ENV:([^#]+)#/envvar($1)/eg; @@ -457,6 +464,14 @@ sub subvars { $inc =~ s/#XCA_PARTMAN_DISK_SCRIPT#/$diskcontent/; } } + elsif ("ubuntu" eq $platform) { + my $default_script = " wget http://`cat /tmp/xcatserver`".$ENV{INSTALLDIR}."/autoinst/getinstdisk; chmod u+x getinstdisk; ./getinstdisk;"; + $inc =~ s/#INCLUDE_GET_FIRST_DISK_SCRIPT#/$default_script/; + } + else { + $inc =~ s/#INCLUDE_GET_FIRST_DISK_SCRIPT#/ /; + } + if ($configfile && $doneincludes) { #the content of the specified file is the additional pressed config with 'd-i' or diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 883b85ebe..490d96077 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -470,6 +470,11 @@ sub mkinstall { } xCAT::MsgUtils->trace($verbose_on_off,"d","debian->mkinstall: installroot=$installroot"); + + # Check whether the default getinstdisk script exist, if so, copy it into /install/autoinst/ + if ( -r "$::XCATROOT/share/xcat/install/scripts/getinstdisk") { + copy("$::XCATROOT/share/xcat/install/scripts/getinstdisk", "$installroot/autoinst"); + } my $node; my $ostab = xCAT::Table->new('nodetype'); diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu b/xCAT-server/share/xcat/install/scripts/pre.ubuntu index bd3172c6a..0ee54f33e 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu @@ -178,13 +178,6 @@ base64decode() done } -#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# - -if [ ! -e /tmp/install_disk ]; then - echo "/dev/sda" > /tmp/install_disk -fi - if [ -d /sys/firmware/efi ]; then echo "ubuntu-efi ::" > /tmp/partitionfile echo " 512 512 1024 fat16" >> /tmp/partitionfile diff --git a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 index eea5f261f..9a92ba14a 100644 --- a/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 +++ b/xCAT-server/share/xcat/install/scripts/pre.ubuntu.ppc64 @@ -192,13 +192,6 @@ base64decode() done } -#The script getinstdisk is common for rh/sles/pkvm/ubuntu, it will write the install_disk into /tmp/install_disk file -#INCLUDE:#ENV:XCATROOT#/share/xcat/install/scripts/getinstdisk# - -if [ ! -e /tmp/install_disk ]; then - echo "/dev/sda" > /tmp/install_disk -fi - if [ -d /sys/firmware/efi ]; then echo "ubuntu-efi ::" > /tmp/partitionfile echo " 512 512 1024 fat16" >> /tmp/partitionfile diff --git a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl index 99ae18cf9..4e9b1ada5 100644 --- a/xCAT-server/share/xcat/install/ubuntu/compute.tmpl +++ b/xCAT-server/share/xcat/install/ubuntu/compute.tmpl @@ -51,6 +51,7 @@ d-i partman-md/device_remove_md boolean true #create the /tmp/partitionfile based on the uefi or legacy bios d-i partman/early_command string \ +#INCLUDE_GET_FIRST_DISK_SCRIPT# \ debconf-set partman-auto/disk "$(cat /tmp/install_disk)" d-i partman-auto/expert_recipe_file string /tmp/partitionfile