appliance: Use gzip-compressed cpio files if supermin-helper supports it.

supermin-helper >= 4.1.4 has new support for compressed cpio files
(not hostfiles).  Detect if this is supported, and use it.
This commit is contained in:
Richard W.M. Jones
2013-08-28 22:35:42 +01:00
parent 532117de29
commit ca4b408968
2 changed files with 32 additions and 6 deletions

View File

@@ -35,14 +35,18 @@ superminfs_DATA = \
supermin.d/init.img \
supermin.d/udev-rules.img
if SUPERMIN_HELPER_COMPRESSED_CPIO
GZ = .gz
endif
if ENABLE_DAEMON
superminfs_DATA += \
supermin.d/daemon.img
supermin.d/daemon.img$(GZ)
endif
if ENABLE_APPLIANCE
superminfs_DATA += \
supermin.d/base.img \
supermin.d/base.img$(GZ) \
supermin.d/hostfiles
endif
@@ -73,20 +77,27 @@ excludelist: excludelist.in Makefile
cmp -s $@ $@-t || mv $@-t $@
rm -f $@-t
supermin.d/base.img supermin.d/hostfiles: stamp-supermin
supermin.d/base.img$(GZ) supermin.d/hostfiles: stamp-supermin
stamp-supermin: make.sh packagelist excludelist
rm -f $@ supermin.d/base.img supermin.d/hostfiles
rm -f $@ supermin.d/base.img$(GZ) supermin.d/hostfiles
./make.sh
if SUPERMIN_HELPER_COMPRESSED_CPIO
gzip -9 supermin.d/base.img
endif
touch $@
supermin.d/daemon.img: ../daemon/guestfsd guestfsd.suppressions
rm -f $@ $@-t
supermin.d/daemon.img$(GZ): ../daemon/guestfsd guestfsd.suppressions
rm -f $@ $@-t $@-tt
rm -rf tmp-d
mkdir -p tmp-d$(DAEMON_SUPERMIN_DIR) tmp-d/etc
ln ../daemon/guestfsd tmp-d$(DAEMON_SUPERMIN_DIR)/guestfsd
ln $(srcdir)/guestfsd.suppressions tmp-d/etc/guestfsd.suppressions
( cd tmp-d && find | cpio --quiet -o -H newc ) > $@-t
rm -r tmp-d
if SUPERMIN_HELPER_COMPRESSED_CPIO
gzip -9 -c $@-t > $@-tt
mv $@-tt $@-t
endif
mv $@-t $@
supermin.d/init.img: init

View File

@@ -446,6 +446,21 @@ AC_CHECK_PROGS([SUPERMIN],
AC_CHECK_PROGS([SUPERMIN_HELPER],
[supermin-helper febootstrap-supermin-helper],[no])
dnl supermin >= 4.1.4 supports compressed cpio images.
AC_MSG_CHECKING([for supermin-helper version])
supermin_helper_version=`$SUPERMIN_HELPER --version | awk '{print $2}'`
AC_MSG_RESULT([$supermin_helper_version])
AC_MSG_CHECKING([if supermin-helper supports compressed cpio images])
supermin_helper_version_int=`echo "$supermin_helper_version" | awk -F. '{print $1 * 1000000 + $2 * 1000 + $3}'`
if test $supermin_helper_version_int -ge 4001004; then
supermin_helper_compressed_cpio=yes
else
supermin_helper_compressed_cpio=yes
fi
AC_MSG_RESULT([$supermin_helper_compressed_cpio])
AM_CONDITIONAL([SUPERMIN_HELPER_COMPRESSED_CPIO],
[test "x$supermin_helper_compressed_cpio" = "xyes"])
dnl Pass supermin --packager-config option.
dnl
dnl Note that in febootstrap >= 3.21 / supermin >= 4.1.0, this option