Subject: Adding option to set binary-net compression (or disable it).

From: Daniel Baumann <[email-masked]>
Date: Tue, 26 Feb 2008 19:57:41 +0100

---
 functions/defaults.sh |  3 +++
 helpers/lh_binary_net | 32 ++++++++++++++++++++++++++------
 helpers/lh_config     | 12 +++++++++++-
 3 files changed, 40 insertions(+), 7 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index dd14dac..88a9013 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -590,6 +590,9 @@ Set_defaults ()
 	# Setting net cow filesystem
 	LH_NET_COW_FILESYSTEM="${LH_NET_COW_FILESYSTEM:-nfs}"
 
+	# Setting net tarball
+	LH_NET_TARBALL="gzip"
+
 	# Setting syslinux configuration file
 	# LH_SYSLINUX_CFG
 
diff --git a/helpers/lh_binary_net b/helpers/lh_binary_net
index 3eb8b67..8cd4bf7 100755
--- a/helpers/lh_binary_net
+++ b/helpers/lh_binary_net
@@ -38,6 +38,11 @@ then
 	exit 0
 fi
 
+if [ "${LH_NET_TARBALL}" = "none" ]
+then
+	exit 0
+fi
+
 Echo_message "Begin building binary netboot image..."
 
 # Requiring stage file
@@ -53,10 +58,9 @@ Check_lockfile .lock
 Create_lockfile .lock
 
 # Remove old binary
-if [ -f binary-net.tar.gz ]
-then
-	rm -f binary-net.tar.gz
-fi
+rm -f binary-net.tar.bz2
+rm -f binary-net.tar.gz
+rm -f binary-net.tar
 
 # Creating image file
 ROOT_DIR=$(basename ${LH_NET_ROOT_PATH})
@@ -71,8 +75,24 @@ then
 fi
 
 cd ..
-tar cfz binary-net.tar.gz "$(basename ${OLDPWD})/${ROOT_DIR}" "$(basename ${OLDPWD})/tftpboot"
-mv binary-net.tar.gz "${OLDPWD}"
+
+case "${LH_NET_TARBALL}" in
+	bzip2)
+		tar cfj binary-net-tar.bz2 "$(basename ${OLDPWD})/${ROOT_DIR}" "$(basename ${OLDPWD})/tftpboot"
+		mv binary-net.tar.bz2 "${OLDPWD}"
+		;;
+
+	gzip)
+		tar cfz binary-net.tar.gz "$(basename ${OLDPWD})/${ROOT_DIR}" "$(basename ${OLDPWD})/tftpboot"
+		mv binary-net.tar.gz "${OLDPWD}"
+		;;
+
+	tar)
+		tar cf binary-net.tar "$(basename ${OLDPWD})/${ROOT_DIR}" "$(basename ${OLDPWD})/tftpboot"
+		mv binary-net.tar "${OLDPWD}"
+		;;
+esac
+
 cd "${OLDPWD}"
 
 if [ "${ROOT_DIR}" != "binary" ]
diff --git a/helpers/lh_config b/helpers/lh_config
index bb5a7ac..40690ea 100755
--- a/helpers/lh_config
+++ b/helpers/lh_config
@@ -89,6 +89,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
 \t    [--net-cow-mountoptions OPTIONS]\n\
 \t    [--net-cow-path PATH]\n\
 \t    [--net-cow-server IP|HOSTNAME]\n\
+\t    [--net-tarball bzip2|gzip|tar|none]\n\
 \t    [-p|--packages-lists FILE]\n\
 \t    [--packages PACKAGE|\"PACKAGES\"]\n\
 \t    [--quiet]\n\
@@ -113,7 +114,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
 
 Local_arguments ()
 {
-	ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-options:,aptitute-options:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-root-filesystem:,net-root-mountoptions:,net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,net-cow-server:,syslinux-splash:,syslinux-timeout:,syslinux-menu:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
+	ARGUMENTS="$(getopt --longoptions apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-options:,aptitute-options:,apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:,cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,genisoimage:,initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:,templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,distribution:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,chroot-filesystem:,union-filesystem:,exposed-root:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:,binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:,debian-installer:,debian-installer-daily:,encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,memtest:,net-root-filesystem:,net-root-mountoptions:,net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,net-cow-server:,net-tarball:,syslinux-splash:,syslinux-timeout:,syslinux-menu:,username:,source:,source-images:,breakpoints,conffile:,debug,force,help,quiet,usage,verbose,version --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")"
 
 	if [ "${?}" != "0" ]
 	then
@@ -549,6 +550,11 @@ Local_arguments ()
 				shift 2
 				;;
 
+			--net-tarball)
+				LH_NET_TARBALL="${2}"
+				shift 2
+				;;
+
 			--syslinux-splash)
 				LH_SYSLINUX_SPLASH="${2}"
 				shift 2
@@ -1040,6 +1046,10 @@ LH_NET_COW_PATH="${LH_NET_COW_PATH}"
 # (Default: ${LH_NET_COW_SERVER})
 LH_NET_COW_SERVER="${LH_NET_COW_SERVER}"
 
+# \$LH_NET_TARBALL: set net tarball
+# (Default: ${LH_NET_TARBALL})
+LH_NET_TARBALL="${LH_NET_TARBALL}"
+
 # \$LH_SYSLINUX_SPLASH: set custom syslinux splash
 # (Default: empty)
 LH_SYSLINUX_SPLASH="${LH_SYSLINUX_SPLASH}"
-- 
cgit v1.0