wok-next rev 4355

xarchive: add xz support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Oct 04 15:34:46 2009 +0200 (2009-10-04)
parents a8aaec062c69
children 1c4d8c3770a5
files xarchive/stuff/slitaz-wrap.sh
line diff
     1.1 --- a/xarchive/stuff/slitaz-wrap.sh	Sun Oct 04 09:50:24 2009 +0000
     1.2 +++ b/xarchive/stuff/slitaz-wrap.sh	Sun Oct 04 15:34:46 2009 +0200
     1.3 @@ -25,10 +25,12 @@
     1.4  GZIP_EXTS="tar.gz tgz"
     1.5  LZMA_EXTS="tar.lz tar.lzma tlz"
     1.6  BZIP2_EXTS="tar.bz tbz tar.bz2 tbz2"
     1.7 +XZ_EXTS="tar.xz txz"
     1.8  COMPRESS_EXTS="tar.z tar.Z"
     1.9  IPK_EXTS="ipk"
    1.10  CPIO_EXTS="cpio"
    1.11  CPIOGZ_EXTS="cpio.gz"
    1.12 +CPIOXZ_EXTS="cpio.xz"
    1.13  ZIP_EXTS="zip cbz jar"
    1.14  RPM_EXTS="rpm"
    1.15  DEB_EXTS="deb"
    1.16 @@ -36,7 +38,7 @@
    1.17  ISO_EXTS="iso"
    1.18  SQUASHFS_EXTS="sqfs squashfs"
    1.19  CROMFS_EXTS="cromfs"
    1.20 -FS_EXTS="ext2 ext3 dos fat vfat fd fs loop"
    1.21 +FS_EXTS="ext2 ext3 dos fat vfat xfs fd fs loop"
    1.22  CLOOP_EXTS="cloop"
    1.23  RAR_EXTS="rar cbr"
    1.24  LHA_EXTS="lha lzh lzs"
    1.25 @@ -114,6 +116,13 @@
    1.26          COMPRESS="lzma e -si -so"
    1.27      fi
    1.28  done
    1.29 +for ext in $XZ_EXTS $CPIOXZ_EXTS; do
    1.30 +    if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
    1.31 +        [ -x /usr/bin/rx ] || exit $E_UNSUPPORTED
    1.32 +        DECOMPRESS="xz -dc"
    1.33 +        COMPRESS="xz -c"
    1.34 +    fi
    1.35 +done
    1.36  for ext in $COMPRESS_EXTS; do
    1.37      if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
    1.38          DECOMPRESS="uncompress -dc" 
    1.39 @@ -198,7 +207,8 @@
    1.40           [ "$(which bzip2)" ] || return
    1.41      fi
    1.42      if not_busybox tar && [ "$action" != "new_archive" ]; then
    1.43 -	for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS; do
    1.44 +	for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $XZ_EXTS \
    1.45 +		   $COMPRESS_EXTS $LZMA_EXTS; do
    1.46              if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
    1.47  	        decompress_func
    1.48  		case "$action" in
    1.49 @@ -247,8 +257,8 @@
    1.50  	fi
    1.51        done
    1.52      done <<EOT
    1.53 -addtar	extracttar   $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS
    1.54 -addcpio	extractcpio  $CPIO_EXTS $CPIOGZ_EXTS
    1.55 +addtar	extracttar   $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $XZ_EXTS $COMPRESS_EXTS $LZMA_EXTS
    1.56 +addcpio	extractcpio  $CPIO_EXTS $CPIOGZ_EXTS $CPIOXZ_EXTS
    1.57  EOT
    1.58  }
    1.59  
    1.60 @@ -311,6 +321,9 @@
    1.61                  echo warning: zip not found, extract only >/dev/stderr
    1.62              fi
    1.63          done
    1.64 +        [ -x /usr/bin/xz ] && for ext in $XZ_EXTS $CPIOXZ_EXTS; do
    1.65 +            printf "%s;" $ext
    1.66 +        done
    1.67  	while read mod exts; do
    1.68  	    [ -f /lib/modules/$(uname -r)/kernel/$mod ] || continue
    1.69  	    for ext in $exts; do
    1.70 @@ -373,8 +386,8 @@
    1.71  	    fi
    1.72          done
    1.73          done <<EOT
    1.74 -do_decompress	cpio\ -tv	$CPIO_EXTS $CPIOGZ_EXTS
    1.75 -do_decompress	tar\ -tvf\ -	$TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS $IPK_EXTS
    1.76 +do_decompress	cpio\ -tv	$CPIO_EXTS $CPIOGZ_EXTS $CPIOXZ_EXTS
    1.77 +do_decompress	tar\ -tvf\ -	$TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $XZ_EXTS $COMPRESS_EXTS $LZMA_EXTS $IPK_EXTS
    1.78  rpm2cpio	cpio\ -tv	$RPM_EXTS
    1.79  tazpkg2cpio	cpio\ -tv	$TAZPKG_EXTS
    1.80  EOT
    1.81 @@ -749,7 +762,7 @@
    1.82  
    1.83      -e) # extract: from archive passed files 
    1.84          for ext in $TAR_EXTS $GZIP_EXTS $BZIP2_EXTS $COMPRESS_EXTS $LZMA_EXTS \
    1.85 -        	   $IPK_EXTS; do
    1.86 +        	   $IPK_EXTS $XZ_EXTS; do
    1.87              if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
    1.88                  # xarchive will put is the right extract dir
    1.89                  # so we just have to extract.
    1.90 @@ -775,7 +788,7 @@
    1.91              done
    1.92  	done <<EOT
    1.93  rpm2cpio	$RPM_EXTS
    1.94 -do_decompress	$CPIO_EXTS $CPIOGZ_EXTS
    1.95 +do_decompress	$CPIO_EXTS $CPIOGZ_EXTS $CPIOXZ_EXTS
    1.96  tazpkg2cpio	$TAZPKG_EXTS
    1.97  EOT
    1.98