diff --git a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst index 234040df4..94a53b574 100644 --- a/docs/source/guides/admin-guides/references/man5/linuximage.5.rst +++ b/docs/source/guides/admin-guides/references/man5/linuximage.5.rst @@ -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), diff --git a/docs/source/guides/admin-guides/references/man7/osimage.7.rst b/docs/source/guides/admin-guides/references/man7/osimage.7.rst index c802e6e72..48f8a0de6 100644 --- a/docs/source/guides/admin-guides/references/man7/osimage.7.rst +++ b/docs/source/guides/admin-guides/references/man7/osimage.7.rst @@ -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), diff --git a/perl-xCAT/xCAT/Schema.pm b/perl-xCAT/xCAT/Schema.pm index f967f869e..3cbb613c5 100755 --- a/perl-xCAT/xCAT/Schema.pm +++ b/perl-xCAT/xCAT/Schema.pm @@ -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), diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 6dbe592f1..c9261588c 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -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"); diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 54f305c5c..8eb14347f 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -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"); diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index e34e9d5f7..5dbd8d482 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -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)}; }