diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 6118ecc53..386ecf979 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -467,7 +467,7 @@ unless ($onlyinitrd) { # } # Hack uname when deal otherpkgs - use_hackuname(); + use_hackuname($arch, $kernelver); use_devnull(); @@ -713,31 +713,7 @@ unless ($imagename) { if ($postinstall_filename) { - #For Mellonax IB script. In diskless image, the uname -r not returning the rootimg level, - #because the "uname -r" only returns the version of the kernel in use - #create a temporary uname script. for every flag except for -r, it should just call the real - #uname with the same flags and return that info. - if (!(-e "$rootimg_dir/bin/orig_uname")) { - system("mv $rootimg_dir/bin/uname $rootimg_dir/bin/orig_uname"); - } - my $tmpuname; - open($tmpuname, ">", "$rootimg_dir/bin/uname"); - print $tmpuname </dev/null || rpm -q kernel-\$(\"\$0\" -r) --qf '%{arch}' 2>/dev/null)\" + if [ -z "$ARCH" ]; then + ARCH=\"\$(dpkg --print-architecture 2>/dev/null || rpm -q kernel-\$(\"\$0\" -r) --qf '%{arch}' 2>/dev/null)\" + fi case "\$ARCH" in "amd64") ARCH="x86_64" ;; "ppc64el") ARCH="ppc64le" ;; esac echo "\$ARCH" ;; "-r") - cd /lib/modules && for d in * ; do : ; done && echo \$d ;; + if [ -n "$KERNELVER" ]; then + echo $KERNELVER + else + for d in \$(ls /lib/modules | sort -V) ; do : ; done && echo \$d + fi + ;; "-s"|"") echo "Linux";; +*) + /bin/uname-binary \$1;; esac exit 0