2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 18:16:39 +00:00

Merge pull request #1885 from xcat2/onissue

add IMG_NAME into the environment variables to postinstall scripts
This commit is contained in:
neo954 2016-09-23 01:39:50 -05:00 committed by GitHub
commit 5b0164a295
6 changed files with 9 additions and 3 deletions

View File

@ -95,6 +95,7 @@ linuximage Attributes:
Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be speperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts ::
IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"),
IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"),
IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"),
IMG_PROFILE(the profile of the osimage, such as "service","compute"),
IMG_PKGLIST(the "pkglist" attribute of the osimage),

View File

@ -316,6 +316,7 @@ osimage Attributes:
Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be speperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts ::
IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"),
IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"),
IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"),
IMG_PROFILE(the profile of the osimage, such as "service","compute"),
IMG_PKGLIST(the "pkglist" attribute of the osimage),

View File

@ -775,6 +775,7 @@ passed as argument rather than by table value',
exlist => 'The fully qualified name of the file that stores the file names and directory names that will be excluded from the image during packimage command. It is used for diskless image only.',
postinstall => 'Only supported in diskless image only. The fully qualified name of the scripts running in non-chroot mode after the package installation but before initrd generation during genimage. If multiple scripts are specified, they should be speperated with comma ",". A set of osimage attributes are exported as the environment variables to be used in the postinstall scripts:
IMG_ARCH(The architecture of the osimage, such as "ppc64le","x86_64"),
IMG_NAME(The name of the osimage, such as "rhels7.3-ppc64le-netboot-compute"),
IMG_OSVER(The os release of the osimage, such as "rhels7.3","sles11.4"),
IMG_PROFILE(the profile of the osimage, such as "service","compute"),
IMG_PKGLIST(the "pkglist" attribute of the osimage),

View File

@ -739,6 +739,7 @@ EOS_UNAME
#export some osimage attributes as the environment variables
#to postinstall script
$ENV{IMG_NAME}=$imagename if("" ne $imagename);
$ENV{IMG_ARCH}=$arch if("" ne $arch);
$ENV{IMG_OSVER}=$osver if("" ne $osver);
$ENV{IMG_PROFILE}=$profile if("" ne $profile);
@ -762,7 +763,7 @@ EOS_UNAME
}
#delete the osimage attributes from environment variable
delete @ENV{qw(IMG_ARCH IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)};
delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)};
# restore the orig uname
system("mv $rootimg_dir/bin/orig_uname $rootimg_dir/bin/uname");

View File

@ -726,6 +726,7 @@ EOS_UNAME
#export some osimage attributes as the environment variables
#to postinstall script
$ENV{IMG_NAME}=$imagename if("" ne $imagename);
$ENV{IMG_ARCH}=$arch if("" ne $arch);
$ENV{IMG_OSVER}=$osver if("" ne $osver);
$ENV{IMG_PROFILE}=$profile if("" ne $profile);
@ -748,7 +749,7 @@ EOS_UNAME
}
#delete the osimage attributes from environment variable
delete @ENV{qw(IMG_ARCH IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)};
delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)};
# restore the orig uname
system("mv $rootimg_dir/bin/orig_uname $rootimg_dir/bin/uname");

View File

@ -620,6 +620,7 @@ if ($postinstall_filename) {
#export some osimage attributes as the environment variables
#to postinstall script
$ENV{IMG_ARCH}=$arch if("" ne $arch);
$ENV{IMG_NAME}=$imagename if("" ne $imagename);
$ENV{IMG_OSVER}=$osver if("" ne $osver);
$ENV{IMG_PROFILE}=$profile if("" ne $profile);
$ENV{IMG_PKGLIST}=$pkglist if("" ne $pkglist);
@ -641,7 +642,7 @@ if ($postinstall_filename) {
}
#delete the osimage attributes from environment variable
delete @ENV{qw(IMG_ARCH IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)};
delete @ENV{qw(IMG_ARCH IMG_NAME IMG_OSVER IMG_PROFILE IMG_PKGLIST IMG_PKGDIR IMG_OTHERPKGLIST IMG_OTHERPKGDIR IMG_ROOTIMGDIR)};
}