From 179cc007081f4cb806701889fdb21d51d3cb3160 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 1 Feb 2016 11:08:11 -0500 Subject: [PATCH] Provide 'txc' mode for packimage tar.xz files will preserve an increasing number of things cpio will not. For now, implement for EL7 type oses to explore before making it more widespread. --- xCAT-server/lib/xcat/plugins/packimage.pm | 12 ++++++++++++ .../share/xcat/netboot/rh/dracut/install.netboot | 2 +- .../share/xcat/netboot/rh/dracut/install.statelite | 2 +- xCAT-server/share/xcat/netboot/rh/dracut/xcatroot | 13 +++++++++++++ .../share/xcat/netboot/rh/dracut_033/xcatroot | 13 +++++++++++++ 5 files changed, 40 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/packimage.pm b/xCAT-server/lib/xcat/plugins/packimage.pm index c84e12cdd..3d57db8c2 100755 --- a/xCAT-server/lib/xcat/plugins/packimage.pm +++ b/xCAT-server/lib/xcat/plugins/packimage.pm @@ -388,6 +388,18 @@ sub process_request { $excludestr = "cat $xcat_packimg_tmpfile|cpio -H newc -o | $compress -c - > ../rootimg.gz"; } $oldmask = umask 0077; + } elsif ($method =~ /txc/) { + if ( ! $exlistloc ) { + $excludestr = "find . -xdev | tar --selinux --xattr-include='*' -T - -Jcvf ../rootimg.txz"; + }else { + chdir("$rootimg_dir"); + system("$excludestr >> $xcat_packimg_tmpfile"); + if ($includestr) { + system("$includestr >> $xcat_packimg_tmpfile"); + } + $excludestr = "cat $xcat_packimg_tmpfile| tar --selinux --xattr-include='*' -T -Jcvf ../rootimg.txz"; + } + $oldmask = umask 0077; } elsif ($method =~ /squashfs/) { $temppath = mkdtemp("/tmp/packimage.$$.XXXXXXXX"); chmod 0755,$temppath; diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot b/xCAT-server/share/xcat/netboot/rh/dracut/install.netboot index d9fe9c714..a0899f3f4 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 cpio gzip dash modprobe touch echo cut wc +dracut_install wget tar xz cpio gzip dash modprobe touch echo cut wc 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/install.statelite b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite index 7c494d84c..61b3797f4 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite +++ b/xCAT-server/share/xcat/netboot/rh/dracut/install.statelite @@ -1,6 +1,6 @@ #!/bin/sh echo $drivers -dracut_install wget cpio gzip dash modprobe wc touch echo cut +dracut_install wget tar xz cpio gzip dash modprobe wc touch echo cut dracut_install -o ctorrent dracut_install grep ifconfig hostname awk egrep grep dirname expr dracut_install parted mke2fs bc mkswap swapon chmod diff --git a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot index e18f532a5..6820233ca 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut/xcatroot @@ -77,6 +77,19 @@ elif [ -r /rootimg.gz ]; then fi $NEWROOT/etc/init.d/localdisk echo Done +elif [ -r /rootimg.txz ]; then + echo Setting up RAM-root tmpfs. + if [ -z $rootlimit ];then + mount -t tmpfs -o mode=755 rootfs $NEWROOT + else + mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT + fi + + cd $NEWROOT + echo -n "Extracting root filesystem:" + tar -Jxvf /rootimg.txz + $NEWROOT/etc/init.d/localdisk + 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/rh/dracut_033/xcatroot b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot index eba3ac4b3..a5d8e8e63 100755 --- a/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot +++ b/xCAT-server/share/xcat/netboot/rh/dracut_033/xcatroot @@ -89,6 +89,19 @@ elif [ -r /rootimg.gz ]; then $NEWROOT/etc/init.d/localdisk [ "$xcatdebugmode" = "1" ] && logger -t xcat -p debug "Done...." echo Done +elif [ -r /rootimg.txz ]; then + echo Setting up RAM-root tmpfs. + if [ -z $rootlimit ];then + mount -t tmpfs -o mode=755 rootfs $NEWROOT + else + mount -t tmpfs -o mode=755,size=$rootlimit rootfs $NEWROOT + fi + + cd $NEWROOT + echo -n "Extracting root filesystem:" + tar -Jxvf /rootimg.txz + $NEWROOT/etc/init.d/localdisk + echo Done elif [ -r /rootimg-statelite.gz ]; then echo Setting up RAM-root tmpfs for statelite mode.