~sourcemage/sorcery

d1fc58124ff5edcb14295cd59b968833a5a1349f — Ismael Luceno 1 year, 6 months ago 5631eec
Add lzip support
M var/lib/sorcery/modules/libmisc => var/lib/sorcery/modules/libmisc +1 -0
@@ 1736,6 1736,7 @@ show_file() {
              fi ;;
      x-bzip2) bzcat "$file" | $PAGER ;;
      x-gzip) gzip -cd "$file" | $PAGER ;;
      x-lzip) lzip -cd "$file" | $PAGER ;;
      x-xz|x-lzma) xz -cd "$file" | $PAGER ;;
      x-7z-compressed) 7z -d "$file" | $PAGER ;;
      # This is needed as long as there is stable grimoire with

M var/lib/sorcery/modules/libsorcery => var/lib/sorcery/modules/libsorcery +13 -1
@@ 1144,6 1144,7 @@ set_compression_type() {
  local B_HELP="bzip2 compression (slow, small files)"
  local P_HELP="parallel bzip2 compression (slow unless on SMP, small files)"
  local X_HELP="xz compression (slow compress, fast decompress, smallest files)"
  local L_HELP="lzip compresison (slow compress, fast decompress, smallest files)"
  local G_HELP="gzip compression (fast, larger files)"
  local T_HELP="no compression/tar (fastest, largest files)"



@@ 1159,6 1160,7 @@ set_compression_type() {
                             "B"  "bzip2 compression"        "$B_HELP"  \
                             "P"  "pbzip2 compression (parallel bzip2)" "$P_HELP"  \
                             "X"  "xz compression"           "$X_HELP"  \
                             "L"  "lzip compression"         "$L_HELP"  \
                             "G"  "gzip compression"         "$G_HELP"  \
                             "T"  "no compression/tar"       "$T_HELP"')



@@ 1191,6 1193,16 @@ set_compression_type() {
          modify_local_config "COMPRESSBIN" "xz"   &&
          COMPRESSBIN="xz"                         &&
          modify_local_config "EXTENSION" ".xz"    ;;
      L)
          if ! spell_ok lzip; then
            clear_line
            message "lzip is not installed on this system! Running cast ...\n"
            sleep 2
            cast lzip
          fi &&
          modify_local_config "COMPRESSBIN" "lzip" &&
          COMPRESSBIN="lzip"                       &&
          modify_local_config "EXTENSION" ".lz"    ;;
      G)
          modify_local_config "COMPRESSBIN" "gzip" &&
          COMPRESSBIN="gzip"                         &&


@@ 1214,7 1226,7 @@ set_compression_type() {
##
#---------------------------------------------------------------------
filename_indicates_compression()  {
  grep -qE "^.*\.(gz|tgz|bz2|zip|Z|rpm|xz|7z|lzma)$" <<< "$1"
  grep -qE "^.*\.(gz|tgz|bz2|zip|Z|rpm|lz|xz|7z|lzma)$" <<< "$1"
}

#---------------------------------------------------------------------

M var/lib/sorcery/modules/libtrack => var/lib/sorcery/modules/libtrack +1 -1
@@ 429,7 429,7 @@ create_cache_archive()  {
  rm $TMP_DATA $TMP_MDATA

  case "$COMPRESSBIN" in
    gzip|bzip2|pbzip2|xz)
    gzip|bzip2|pbzip2|xz|lzip)
      if "$COMPRESSBIN" -c </dev/null &>/dev/null; then
        "$COMPRESSBIN" -c "$CACHE" > "$CACHE_COMP" &&
        rm "$CACHE"

M var/lib/sorcery/modules/libunpack => var/lib/sorcery/modules/libunpack +2 -1
@@ 196,6 196,7 @@ uncompress_core() {
            tar)  cat           "$1"  ;;
          xz|XZ)  xz -cdf "$1" ;;
           LZMA)  xz -cdf "$1" ;;
           lzip)  lzip -cdf "$1" ;;
          7-zip)  cat "$1" ;; # 7z supports stdout, but it unpacks at the same time
              *)  cat           "$1"  ;;
  esac


@@ 234,7 235,7 @@ unpack_core() {
  debug "libgrimoire" "unpack_core - $*"

  case  "$2"  in
            bzip2|gzip|compress*|tar|XZ|xz|LZMA)
            bzip2|gzip|compress*|lzip|tar|XZ|xz|LZMA)
                    untar 2>/dev/null || cat > /dev/null ;;
              Zip)  cat /dev/stdin >/dev/null   #get rid of unused output
                    unzip  -q  "$1"                                    ;;