diff --git a/docs/source/guides/admin-guides/references/man1/packimage.1.rst b/docs/source/guides/admin-guides/references/man1/packimage.1.rst index d0520af54..20651fbda 100644 --- a/docs/source/guides/admin-guides/references/man1/packimage.1.rst +++ b/docs/source/guides/admin-guides/references/man1/packimage.1.rst @@ -64,6 +64,8 @@ OPTIONS \ **-m**\ Archive Method (cpio,tar,squashfs, default is cpio) +\ **-c**\ Compress Method (pigz,gzip,xz, default is pigz) + ************ RETURN VALUE diff --git a/xCAT-client/pods/man1/packimage.1.pod b/xCAT-client/pods/man1/packimage.1.pod index 0fa78542c..60b34fe6f 100644 --- a/xCAT-client/pods/man1/packimage.1.pod +++ b/xCAT-client/pods/man1/packimage.1.pod @@ -38,6 +38,8 @@ B<-a> Architecture (ppc64,x86_64,etc) B<-m> Archive Method (cpio,tar,squashfs, default is cpio) +B<-c> Compress Method (pigz,gzip,xz, default is pigz) + =head1 RETURN VALUE diff --git a/xCAT-server/lib/xcat/plugins/anaconda.pm b/xCAT-server/lib/xcat/plugins/anaconda.pm index a0e9f768d..bb6d1738b 100644 --- a/xCAT-server/lib/xcat/plugins/anaconda.pm +++ b/xCAT-server/lib/xcat/plugins/anaconda.pm @@ -462,9 +462,11 @@ sub mknetboot } $platform = xCAT_plugin::anaconda::getplatform($osver); - my $suffix = 'gz'; + my $suffix = 'cpio.gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); + $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); + $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); + $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); # statelite images are not packed. if ($statelite) { @@ -513,7 +515,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile found at $rootimgdir/rootimg.gz or $rootimgdir/rootimg.sfs on $myname, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/debian.pm b/xCAT-server/lib/xcat/plugins/debian.pm index 5d57bea30..927886864 100644 --- a/xCAT-server/lib/xcat/plugins/debian.pm +++ b/xCAT-server/lib/xcat/plugins/debian.pm @@ -1170,9 +1170,10 @@ sub mknetboot } $platform = xCAT_plugin::debian::getplatform($osver); - my $suffix = 'gz'; - $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); + my $suffix = 'cpio.gz'; + $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); + $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); + $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); # statelite images are not packed. if ($statelite) { @@ -1222,7 +1223,7 @@ sub mknetboot copy("$rootimgdir/initrd.gz", "$rootimgdir/initrd-stateless.gz"); } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => ["No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage (e.g. packimage -o $osver -p $profile -a $arch"], errorcode => [1] }); diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index 6d6518df7..ca92c8f37 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -87,6 +87,7 @@ sub process_request { my $arch; my $profile; my $method = 'cpio'; + my $compress; my $exlistloc; my $syncfile; my $rootimg_dir; @@ -102,6 +103,7 @@ sub process_request { "arch|a=s" => \$arch, "osver|o=s" => \$osver, "method|m=s" => \$method, + "compress|c=s" => \$compress, "tracker=s" => \$dotorrent, "help|h" => \$help, "version|v" => \$version @@ -419,51 +421,77 @@ sub process_request { unlink("$destdir/rootimg.gz"); unlink("$destdir/rootimg.sfs"); - $callback->({ info => ["archive method:$method"] }); - if ($method =~ /cpio/) { - my $compress = "gzip"; - - #use "pigz" as the compress tool instead of gzip if "pigz" exist - my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); - if ($ispigz == 0) { - $compress = "pigz"; - } - $callback->({ info => ["compress method:$compress"] }); - if (!$exlistloc) { - $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.gz"; - } else { - chdir("$rootimg_dir"); - system("$excludestr >> $xcat_packimg_tmpfile"); - if ($includestr) { - system("$includestr >> $xcat_packimg_tmpfile"); + my $suffix; + if ($compress) { + if ($compress eq 'gzip') { + my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1"); + unless ($isgzip == 0) { + $callback->({ error => ["Command gzip does not exist, please make sure it is installed."] }); + return 1; } - $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.gz"; + $suffix = "gz"; + } elsif ($compress eq 'pigz') { + my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); + unless ($ispigz == 0) { + $callback->({ error => ["Command pigz does not exist, please make sure it is installed."] }); + return 1; + } + $suffix = "gz"; + } elsif ($compress eq 'xz') { + my $isxz = system("bash -c 'type -p xz' >/dev/null 2>&1"); + unless ($isxz == 0) { + $callback->({ error => ["Command xz does not exist, please make sure it is installed."] }); + return 1; + } + $suffix = "xz"; + } else { + $callback->({ error => ["Invalid compress method '$compress' requested"], errorcode => [1] }); + return 1; } - $oldmask = umask 0077; - } elsif ($method =~ /tar/) { - my $compress = "gzip"; - - #use "pigz" as the compress tool instead of gzip if "pigz" exist + } else { my $ispigz = system("bash -c 'type -p pigz' >/dev/null 2>&1"); if ($ispigz == 0) { $compress = "pigz"; } else { my $isgzip = system("bash -c 'type -p gzip' >/dev/null 2>&1"); - unless ($isgzip == 0) { - $callback->({ error => ["Command gzip does not exist, please make sure it works."] }); + if ($isgzip == 0) { + $compress = "gzip"; + } else { + $callback->({ error => ["The default compress tool 'gzip' and 'pigz' does not exist, please specify an available compress method with '-c'."] }); return 1; } } + $suffix = "gz"; + } + + $callback->({ info => ["archive method:$method"] }); + unless ($method =~ /squashfs/) { $callback->({ info => ["compress method:$compress"] }); + } + + $suffix = $method.".".$suffix; + if ($method =~ /cpio/) { if (!$exlistloc) { - $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.tgz"; + $excludestr = "find . -xdev -print0 | cpio -H newc -o -0 | $compress -c - > ../rootimg.$suffix"; } else { chdir("$rootimg_dir"); system("$excludestr >> $xcat_packimg_tmpfile"); if ($includestr) { system("$includestr >> $xcat_packimg_tmpfile"); } - $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.tgz"; + $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.$suffix"; + } + $oldmask = umask 0077; + } elsif ($method =~ /tar/) { + if (!$exlistloc) { + $excludestr = "find . -xdev -print0 | tar --selinux --xattrs-include='*' --null -T - -c | $compress -c - > ../rootimg.$suffix"; + } else { + chdir("$rootimg_dir"); + system("$excludestr >> $xcat_packimg_tmpfile"); + if ($includestr) { + system("$includestr >> $xcat_packimg_tmpfile"); + } + $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattrs-include='*' -T - -c | $compress -c - > ../rootimg.$suffix"; } $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { @@ -476,24 +504,25 @@ sub process_request { } $excludestr = "cat $xcat_packimg_tmpfile|cpio -dump $temppath"; } else { - $callback->({ error => ["Invalid method '$method' requested"], errorcode => [1] }); + $callback->({ error => ["Invalid archive method '$method' requested"], errorcode => [1] }); + return 1; } chdir("$rootimg_dir"); my $outputmsg = `$excludestr`; $callback->({ info => ["$outputmsg"] }); if ($method =~ /cpio/) { - chmod 0644, "$destdir/rootimg.gz"; + chmod 0644, "$destdir/rootimg.$suffix"; if ($dotorrent) { my $currdir = getcwd; chdir($destdir); - unlink("rootimg.gz.metainfo"); - system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.gz.metainfo rootimg.gz"); - chmod 0644, "rootimg.gz.metainfo"; + unlink("rootimg.$suffix.metainfo"); + system("ctorrent -t -u $dotorrent -l 1048576 -s rootimg.$suffix.metainfo rootimg.$suffix"); + chmod 0644, "rootimg.$suffix.metainfo"; chdir($currdir); } umask $oldmask; } elsif ($method =~ /tar/) { - chmod 0644, "$destdir/rootimg.tgz"; + chmod 0644, "$destdir/rootimg.$suffix"; umask $oldmask; } elsif ($method =~ /squashfs/) { my $flags; diff --git a/xCAT-server/lib/xcat/plugins/sles.pm b/xCAT-server/lib/xcat/plugins/sles.pm index a833353ea..7429da3cf 100644 --- a/xCAT-server/lib/xcat/plugins/sles.pm +++ b/xCAT-server/lib/xcat/plugins/sles.pm @@ -327,9 +327,11 @@ sub mknetboot $platform = "sles"; } - my $suffix = 'gz'; + my $suffix = 'cpio.gz'; $suffix = 'sfs' if (-r "$rootimgdir/rootimg.sfs"); - $suffix = 'tgz' if (-r "$rootimgdir/rootimg.tgz"); + $suffix = 'cpio.xz' if (-r "$rootimgdir/rootimg.cpio.xz"); + $suffix = 'tar.gz' if (-r "$rootimgdir/rootimg.tar.gz"); + $suffix = 'tar.xz' if (-r "$rootimgdir/rootimg.tar.xz"); if ($statelite) { unless (-r "$rootimgdir/kernel") { @@ -381,7 +383,7 @@ sub mknetboot } } - unless (-r "$rootimgdir/rootimg.gz" or -r "$rootimgdir/rootimg.tgz" or -r "$rootimgdir/rootimg.sfs") { + unless (-r "$rootimgdir/rootimg.cpio.gz" or -r "$rootimgdir/rootimg.cpio.xz" or -r "$rootimgdir/rootimg.tar.gz" or -r "$rootimgdir/rootimg.tar.xz" or -r "$rootimgdir/rootimg.sfs") { $callback->({ error => [qq{No packed image for platform $osver, architecture $arch, and profile $profile, please run packimage before nodeset}], errorcode => [1] diff --git a/xCAT-server/share/xcat/netboot/rh/compute.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.pkglist index 2824c79fc..42f78c8a2 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.pkglist @@ -14,3 +14,4 @@ rpm rsync tar gzip +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist index e2389d3de..c5eaece65 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.pkglist @@ -15,3 +15,4 @@ rsyslog e2fsprogs gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist index fbaf36a2a..1439425ef 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.ppc64.pkglist @@ -26,3 +26,4 @@ procps parted gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist index ae873e99f..24c092e95 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels6.x86_64.pkglist @@ -22,3 +22,4 @@ e2fsprogs parted gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist index bb9af2ce9..2a7c348d3 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.ppc64.pkglist @@ -26,3 +26,4 @@ parted net-tools gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist index 3c54123a8..e0dede612 100644 --- a/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/rh/compute.rhels7.x86_64.pkglist @@ -21,3 +21,4 @@ parted net-tools gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot index f14ffa1c0..0b19df672 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip dash modprobe touch echo cut wc +dracut_install wget tar cpio gzip dash modprobe touch echo cut wc xz dracut_install -o ctorrent dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index 688d7f772..4d20531fa 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -67,8 +67,8 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -79,15 +79,23 @@ elif [ -r /rootimg.gz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.tgz ]; then +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -97,7 +105,11 @@ elif [ -r /rootimg.tgz ]; then cd $NEWROOT echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi $NEWROOT/etc/init.d/localdisk echo Done elif [ -r /rootimg-statelite.gz ]; then diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot index e1227868b..cca462a0b 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip modprobe touch echo cut wc +dracut_install wget tar cpio gzip modprobe touch echo cut wc xz dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs dracut_install parted mke2fs bc mkswap swapon chmod diff --git a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index 328068a32..0bc2ebcd9 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -69,8 +69,8 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -81,16 +81,24 @@ elif [ -r /rootimg.gz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.tgz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.tgz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -101,7 +109,11 @@ elif [ -r /rootimg.tgz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done diff --git a/xCAT-server/share/xcat/netboot/rh/genimage b/xCAT-server/share/xcat/netboot/rh/genimage index 0879cabb9..aa13d2855 100755 --- a/xCAT-server/share/xcat/netboot/rh/genimage +++ b/xCAT-server/share/xcat/netboot/rh/genimage @@ -1606,7 +1606,7 @@ if [ -r /rootimg.sfs ]; then mount --move /ro \$NEWROOT/ro mount --move /rw \$NEWROOT/rw EOMS - print $inifile "elif [ -r /rootimg.gz ]; then\n"; + print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n"; print $inifile "echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { print $inifile " mount -o size=$rootlimit,mode=755 -t tmpfs rootfs \$NEWROOT\n"; @@ -1615,13 +1615,21 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " if [ -x /bin/cpio ]; then\n"; - print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n"; - print $inifile " else\n"; - print $inifile " zcat /rootimg.gz |cpio -idum\n"; + print $inifile " if [ -r /rootimg.cpio.gz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " zcat /rootimg.cpio.gz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " zcat /rootimg.cpio.gz |cpio -idum\n"; + print $inifile " fi\n"; + print $inifile " elif [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " xz -cd /rootimg.cpio.xz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.tgz ]; then\n"; + print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1631,7 +1639,11 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; + print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; print $inifile " echo -n Failed to download image, panicing in 5...\n"; @@ -1708,7 +1720,7 @@ EOMS } # add rsync for statelite - foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/gzip", "usr/bin/tar") { + foreach ("bin/cpio", "sbin/nash", "sbin/busybox.anaconda", "sbin/rmmod", "bin/bash", "usr/sbin/chroot", "sbin/mount.nfs", "usr/bin/rsync", "usr/bin/wc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } diff --git a/xCAT-server/share/xcat/netboot/sles/compute.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.pkglist index cc5a5fd87..a3165f834 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.pkglist @@ -13,3 +13,4 @@ timezone ntp tar gzip +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist index e284622f1..8787c0177 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.pkglist @@ -19,3 +19,4 @@ bc ntp gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist index 26e735587..3f9ffbed3 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles11.ppc64.pkglist @@ -21,3 +21,4 @@ procps ntp gzip tar +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist index 1eebf1414..d0b4c3a0e 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles12.ppc64le.pkglist @@ -41,3 +41,4 @@ udev kernel-default kernel-firmware adaptec-firmware +xz diff --git a/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist b/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist index 1eebf1414..d0b4c3a0e 100644 --- a/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/sles/compute.sles12.x86_64.pkglist @@ -41,3 +41,4 @@ udev kernel-default kernel-firmware adaptec-firmware +xz diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot b/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot index e1227868b..cca462a0b 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip modprobe touch echo cut wc +dracut_install wget tar cpio gzip modprobe touch echo cut wc xz dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs dracut_install parted mke2fs bc mkswap swapon chmod diff --git a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot index 91b6a3aa4..acd7b3ebf 100755 --- a/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/sles/dracut_033/xcatroot @@ -67,8 +67,8 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.gz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -79,16 +79,24 @@ elif [ -r /rootimg.gz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done -elif [ -r /rootimg.tgz ]; then - [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg.tgz downloaded,setting up RAM-root tmpfs...." +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then + [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "rootimg downloaded,setting up RAM-root tmpfs...." echo Setting up RAM-root tmpfs. if [ -z $rootlimit ];then mount -t tmpfs -o mode=755 rootfs $NEWROOT @@ -99,7 +107,11 @@ elif [ -r /rootimg.tgz ]; then cd $NEWROOT [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Extracting root filesystem:" echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" > "0" ] && logger -t xcat -p debug "Done...." echo Done diff --git a/xCAT-server/share/xcat/netboot/sles/genimage b/xCAT-server/share/xcat/netboot/sles/genimage index 5b894e37a..3fbe3c6c2 100755 --- a/xCAT-server/share/xcat/netboot/sles/genimage +++ b/xCAT-server/share/xcat/netboot/sles/genimage @@ -1624,7 +1624,7 @@ if [ -r /rootimg.sfs ]; then mount --move /ro /sysroot/ro mount --move /rw /sysroot/rw EOMS - print $inifile "elif [ -r /rootimg.gz ]; then\n"; + print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n"; print $inifile "echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { print $inifile " mount -o size=$rootlimit,mode=755 -t tmpfs rootfs \$NEWROOT\n"; @@ -1633,13 +1633,21 @@ EOMS } print $inifile " cd /sysroot\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " if [ -x /bin/cpio ]; then\n"; - print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n"; - print $inifile " else\n"; - print $inifile " zcat /rootimg.gz |cpio -idum\n"; + print $inifile " if [ -r /rootimg.cpio.gz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " zcat /rootimg.cpio.gz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " zcat /rootimg.cpio.gz |cpio -idum\n"; + print $inifile " fi\n"; + print $inifile " elif [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " xz -cd /rootimg.cpio.xz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.tgz ]; then\n"; + print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1649,7 +1657,11 @@ EOMS } print $inifile " cd \$NEWROOT\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; + print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " echo Done\n"; print $inifile "else\n"; print $inifile " echo -n Failed to download image, panicing in 5...\n"; @@ -1758,7 +1770,7 @@ EOMS } } if ($mode eq "statelite") { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/gzip", "usr/bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "bin/hostname", "usr/bin/egrep", "bin/ln", "bin/ls", "usr/bin/dirname", "usr/bin/expr", "usr/bin/chroot", "usr/bin/grep", "bin/cpio", "bin/sleep", "bin/mount", "bin/umount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "usr/bin/wc", "bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } @@ -1770,7 +1782,7 @@ EOMS } } else { - foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/gzip", "usr/bin/tar") { + foreach ("sbin/ifconfig", "usr/bin/clear", "usr/bin/touch", "usr/bin/grep", "usr/bin/egrep", "bin/cpio", "bin/sleep", "bin/mount", "sbin/dhcpcd", "bin/bash", "sbin/insmod", "bin/mkdir", "bin/mknod", "sbin/ip", "bin/cat", "usr/bin/awk", "usr/bin/wget", "bin/cp", "usr/bin/cpio", "usr/bin/zcat", "usr/bin/gzip", "lib/mkinitrd/bin/run-init", "usr/bin/uniq", "usr/bin/sed", "sbin/udevd", "usr/bin/readlink", "usr/bin/expr", "usr/sbin/parted", "sbin/mke2fs", "sbin/mkswap", "sbin/swapon", "bin/chmod", "usr/bin/bc", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; } diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist index c3839a534..cac5d706a 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.pkglist @@ -14,3 +14,4 @@ busybox-static gawk tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist index 730382c86..1dea61ecb 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.ppc64el.pkglist @@ -15,3 +15,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist index 730382c86..1dea61ecb 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.4.x86_64.pkglist @@ -15,3 +15,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist index b1357ac5f..6e3b04dc2 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu14.04.pkglist @@ -14,3 +14,4 @@ busybox-static gawk tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist index d3e1da021..77dffd96f 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.pkglist @@ -14,3 +14,4 @@ busybox-static gawk tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist index 8276befc2..df556b887 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.ppc64el.pkglist @@ -16,3 +16,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist index 8276befc2..df556b887 100644 --- a/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist +++ b/xCAT-server/share/xcat/netboot/ubuntu/compute.ubuntu16.04.x86_64.pkglist @@ -16,3 +16,4 @@ gawk dnsutils tar gzip +xz-utils diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot index 10f1c7320..372fa4df8 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/install.netboot @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget tar cpio gzip dash modprobe touch echo cut wc +dracut_install wget tar cpio gzip dash modprobe touch echo cut wc xz dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install mount.nfs inst "$moddir/xcatroot" "/sbin/xcatroot" diff --git a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot index 073ec1e4b..67f40c8ed 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/ubuntu/dracut/xcatroot @@ -39,23 +39,35 @@ if [ -r /rootimg.sfs ]; then mkdir -p $NEWROOT/rw mount --move /ro $NEWROOT/ro mount --move /rw $NEWROOT/rw -elif [ -r /rootimg.gz ]; then +elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then echo Setting up RAM-root tmpfs. mount -t tmpfs -o mode=755 rootfs $NEWROOT cd $NEWROOT echo -n "Extracting root filesystem:" - if [ -x /bin/cpio ]; then - gzip -cd /rootimg.gz |/bin/cpio -idum - else - gzip -cd /rootimg.gz |cpio -idum + if [ -r /rootimg.cpio.gz ]; then + if [ -x /bin/cpio ]; then + gzip -cd /rootimg.cpio.gz |/bin/cpio -idum + else + gzip -cd /rootimg.cpio.gz |cpio -idum + fi + elif [ -r /rootimg.cpio.xz ]; then + if [ -x /bin/cpio ]; then + xz -cd /rootimg.cpio.xz |/bin/cpio -idum + else + xz -cd /rootimg.cpio.xz |cpio -idum + fi fi echo Done -elif [ -r /rootimg.tgz ]; then +elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then echo Setting up RAM-root tmpfs. mount -t tmpfs -o mode=755 rootfs $NEWROOT cd $NEWROOT echo -n "Extracting root filesystem:" - tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz + if [ -r /rootimg.tar.gz ]; then + tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz + elif [ -r /rootimg.tar.xz ]; then + tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz + fi echo Done elif [ -r /rootimg-statelite.gz ]; then echo Setting up RAM-root tmpfs for statelite mode. diff --git a/xCAT-server/share/xcat/netboot/ubuntu/genimage b/xCAT-server/share/xcat/netboot/ubuntu/genimage index 870c13b73..8934e44b1 100755 --- a/xCAT-server/share/xcat/netboot/ubuntu/genimage +++ b/xCAT-server/share/xcat/netboot/ubuntu/genimage @@ -1441,8 +1441,8 @@ if [ -r /rootimg.sfs ]; then mount --move /ro \$NEWROOT/ro mount --move /rw \$NEWROOT/rw EOMS - print $inifile "elif [ -r /rootimg.gz ]; then\n"; - print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.gz downloaded,setting up RAM-root tmpfs...\"\n"; + print $inifile "elif [ -r /rootimg.cpio.gz ] || [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg downloaded,setting up RAM-root tmpfs...\"\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { print $inifile " mount -o \"size=$rootlimit,mode=755\" -t tmpfs rootfs \$NEWROOT\n"; @@ -1452,15 +1452,23 @@ EOMS print $inifile " cd \$NEWROOT\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " if [ -x /bin/cpio ]; then\n"; - print $inifile " zcat /rootimg.gz |/bin/cpio -idum\n"; - print $inifile " else\n"; - print $inifile " zcat /rootimg.gz |cpio -idum\n"; + print $inifile " if [ -r /rootimg.cpio.gz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " zcat /rootimg.cpio.gz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " zcat /rootimg.cpio.gz |cpio -idum\n"; + print $inifile " fi\n"; + print $inifile " elif [ -r /rootimg.cpio.xz ]; then\n"; + print $inifile " if [ -x /bin/cpio ]; then\n"; + print $inifile " xz -cd /rootimg.cpio.xz |/bin/cpio -idum\n"; + print $inifile " else\n"; + print $inifile " xz -cd /rootimg.cpio.xz |cpio -idum\n"; + print $inifile " fi\n"; print $inifile " fi\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; - print $inifile "elif [ -r /rootimg.tgz ]; then\n"; - print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg.tgz downloaded,setting up RAM-root tmpfs...\"\n"; + print $inifile "elif [ -r /rootimg.tar.gz ] || [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"rootimg downloaded,setting up RAM-root tmpfs...\"\n"; print $inifile " echo Setting up RAM-root tmpfs.\n"; if ($rootlimit) { @@ -1471,7 +1479,11 @@ EOMS print $inifile " cd \$NEWROOT\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Extracting root filesystem:\"\n"; print $inifile " echo -n \"Extracting root filesystem:\"\n"; - print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tgz\n"; + print $inifile " if [ -r /rootimg.tar.gz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -zxvf /rootimg.tar.gz\n"; + print $inifile " elif [ -r /rootimg.tar.xz ]; then\n"; + print $inifile " tar --selinux --xattrs-include='*' -Jxvf /rootimg.tar.xz\n"; + print $inifile " fi\n"; print $inifile " ([ \"\$xcatdebugmode\" = \"1\" ] || [ \"\$xcatdebugmode\" = \"2\" ]) && logger -t xcat -p debug \"Done...\"\n"; print $inifile " echo Done\n"; print $inifile "else\n"; @@ -1612,7 +1624,7 @@ EOMS } # add rsync for statelite - foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/gzip", "usr/bin/tar") { + foreach ("usr/bin/dig", "bin/busybox", "bin/bash", "sbin/mount.nfs", "usr/bin/rsync", "sbin/insmod", "sbin/udevd", "sbin/udevadm", "sbin/modprobe", "sbin/blkid", "sbin/depmod", "usr/bin/wget", "usr/bin/xz", "usr/bin/gzip", "usr/bin/tar") { getlibs($_); push @filestoadd, $_; }