From 90586433029b2ff9e3b6e05933dbeeb35764228e Mon Sep 17 00:00:00 2001 From: ernierasta Date: Wed, 23 Oct 2013 12:59:49 +0200 Subject: [PATCH] Add xz archive support. --- apt-cyg | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/apt-cyg b/apt-cyg index 59e9522..25e1a72 100644 --- a/apt-cyg +++ b/apt-cyg @@ -31,10 +31,11 @@ WGET=`which wget 2> /dev/null` BZIP2=`which bzip2 2> /dev/null` TAR=`which tar 2> /dev/null` GAWK=`which awk 2> /dev/null` +XZ=`which xz 2> /dev/null` if test "-$WGET-" = "--" || test "-$BZIP2-" = "--" || test "-$TAR-" = "--" \ - || test "-$GAWK-" = "--" + || test "-$GAWK-" = "--" || test "-$XZ-" = "--" then - echo You must install wget, tar, gawk and bzip2 to use apt-cyg. + echo You must install wget, tar, gawk, xz and bzip2 to use apt-cyg. exit 1 fi @@ -333,7 +334,7 @@ case "$command" in fi echo Found package $pkg - # download and unpack the bz2 file + # download and unpack the bz2 or xz file # pick the latest version, which comes first install=`cat "release/$pkg/desc" | awk '/^install: / { print $2; exit }'` @@ -358,7 +359,12 @@ case "$command" in fi echo "Unpacking..." - cat $file | bunzip2 | tar > "/etc/setup/$pkg.lst" xvf - -C / + #determine file type + if [ "${file##*.}" == "xz" ]; then + cat $file | tar > "/etc/setup/$pkg.lst" xvJf - -C / + else + cat $file | bunzip2 | tar > "/etc/setup/$pkg.lst" xvf - -C / + fi gzip -f "/etc/setup/$pkg.lst" cd ../..