This is a patch file for "git" releases of "deco" dated circa mid- 2018. This patch file adds the following features to "deco": New filename extensions supported: .br and .tar.br # Needs: brotli .brotli and .tar.brotli # Ditto .crx # Needs: dd, unzip .jpg (unpacks to .pnm) # Needs: convert or djpeg .mp3 (unpacks to .wav) # Needs: sox or ffmpeg .ogg (unpacks to .wav) # Needs: oggdec .pdf (unpacks to .png and .txt) # Needs: convert, pdfimages, pdftotext .png (unpacks to .pnm) # Needs: convert or netpbm .tta (unpacks to .wav) # Needs: ttaenc .zim # Needs: zimdump .zst and .tar.zst # Needs: zstd .zstd and .tar.zstd # Ditto * Uses parallel programs pbzip2 and/or pigz if they're available (but the programs are optional). The following more or less universal programs are needed in addition to the ones listed above: bash, grep, rm, sed, tar, wc Also the following distro-specific program: cptime --- deco-git-180320.old/deco-archive/config.mk +++ deco-git-180320/deco-archive/config.mk @@ -13,6 +13,7 @@ 'ape' \ 'arc' 'ark' 'sue' \ 'arj' \ + 'br' 'brotli' \ 'bz2' \ 'cab' \ 'cpio' \ @@ -25,17 +26,23 @@ 'flac' \ 'gem' \ 'gz' 'z' \ + 'jpg' \ 'lha' 'lzh' \ 'lrz' \ 'lz' \ 'lzma' \ 'lzo' \ + 'mp3' \ + 'ogg' \ + 'pdf' \ + 'png' \ 'rar|[rst][0-9]{2}' 'cbr' 'part[0-9]+\.rar' \ 'rpm' \ 'rz' \ 'shn' \ 'tar' \ 'tar\.7z' 'tar\.7z\.[0-9]{2,}' 't7z' 't7z\.[0-9]{2,}' \ + 'tar\.br' 'tar\.brotli' \ 'tar\.bz2' 'tbz' 'tbz2' \ 'tar\.gz' 'tar\.z' 'taz' 'tgz' \ 'tar\.lrz' \ @@ -43,10 +50,14 @@ 'tar\.lzma' \ 'tar\.rz' \ 'tar\.xz' 'txz' \ + 'tar\.zst' 'tar\.zstd' \ 'tlz' \ + 'tta' \ 'xz' \ - 'zip' 'apk' 'cbz' 'ear' 'ipsw' 'jar' 'odc' 'odf' 'odg' 'odi' 'odm' 'odp' 'ods' 'odt' 'otc' 'otf' 'otg' 'oth' 'oti' 'otp' 'ots' 'ott' 'oxt' 'pk3' 'pk4' 'wsz' 'xpi' \ - 'zoo' + 'zim' \ + 'zip' 'apk' 'cbz' 'crx' 'ear' 'ipsw' 'jar' 'odc' 'odf' 'odg' 'odi' 'odm' 'odp' 'ods' 'odt' 'otc' 'otf' 'otg' 'oth' 'oti' 'otp' 'ots' 'ott' 'oxt' 'pk3' 'pk4' 'wsz' 'xpi' \ + 'zoo' \ + 'zst' 'zstd' # deleted from $(LOCATION) before installation OBSOLETE = \ --- deco-git-180320.old/deco-archive/x/br/extract +++ deco-git-180320/deco-archive/x/br/extract @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=brotli +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -d -f "$1" +fi --- deco-git-180320.old/deco-archive/x/brotli/extract +++ deco-git-180320/deco-archive/x/brotli/extract @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=brotli +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -d -f "$1" +fi --- deco-git-180320.old/deco-archive/x/bz2/extract +++ deco-git-180320/deco-archive/x/bz2/extract @@ -1,3 +1,9 @@ -#!/bin/sh +#!/bin/bash -exec bunzip2 -kf${Verbose+p} "$1" +NN=`which pbzip2 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + exec bunzip2 -kf${Verbose+p} "$1" +else + exec pbzip2 -dkf "$1" +fi --- deco-git-180320.old/deco-archive/x/crx/extract +++ deco-git-180320/deco-archive/x/crx/extract @@ -0,0 +1,21 @@ +#!/bin/bash + +for PROG in bash dd rm unzip +do + NN=`which $PROG 2>/dev/null | wc -l` + + if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 + fi +done + +DDTMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX) +function finish { + rm -rf "$DDTMPDIR" +} +trap finish EXIT + +DDTMPFILE=$DDTMPDIR/data.zip +dd bs=306 skip=1 < "$1" > $DDTMPFILE +unzip -o${Verbose-q} $DDTMPFILE --- deco-git-180320.old/deco-archive/x/gz/extract +++ deco-git-180320/deco-archive/x/gz/extract @@ -1,3 +1,11 @@ -#!/bin/sh +#!/bin/bash -exec gunzip -fN${Verbose+v} "$1" +PROG=gzip +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -dkf "$1" +fi --- deco-git-180320.old/deco-archive/x/jpg/extract +++ deco-git-180320/deco-archive/x/jpg/extract @@ -0,0 +1,40 @@ +#!/bin/bash + +for PROG in grep rm sed wc +do + NN=`which $PROG 2>/dev/null | wc -l` + if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 + fi +done + +NN=`echo "$1" | grep '^[A-Za-z0-9_.,@/+-]*$' | wc -l` +if [ "x$NN" == "x0" ]; then + echo Error: Filename is unsafe: "$1" + exit 1 +fi + +PNMFILE=`echo "$1" | sed 's/\.jpg$/.pnm/'` + +if [ "x$1" == "x$PNMFILE" ]; then + echo Error: Possible upper-lower case issue: "$1" + exit 1 +fi + +NN=`which xconvert 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + NN=`which djpeg 2>/dev/null | wc -l` + + if [ "x$NN" == "x0" ]; then + echo Error: Either imagemagick or djpeg is needed for this + exit 1 + else + rm -fr "$PNMFILE" || exit 1 + exec djpeg < "$1" > "$PNMFILE" + fi +else + rm -fr "$PNMFILE" || exit 1 + exec convert "$1" "$PNMFILE" +fi --- deco-git-180320.old/deco-archive/x/mp3/extract +++ deco-git-180320/deco-archive/x/mp3/extract @@ -0,0 +1,40 @@ +#!/bin/bash + +for PROG in grep rm sed wc +do + NN=`which $PROG 2>/dev/null | wc -l` + if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 + fi +done + +NN=`echo "$1" | grep '^[A-Za-z0-9_.,@/+-]*$' | wc -l` +if [ "x$NN" == "x0" ]; then + echo Error: Filename is unsafe: "$1" + exit 1 +fi + +MP3FILE=`echo "$1" | sed 's/\.mp3$/.wav/'` + +if [ "x$1" == "x$MP3FILE" ]; then + echo Error: Possible upper-lower case issue: "$1" + exit 1 +fi + +NN=`which sox 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + NN=`which ffmpeg 2>/dev/null | wc -l` + + if [ "x$NN" == "x0" ]; then + echo Error: Either sox or ffmpeg is needed for this + exit 1 + else + rm -fr "$MP3FILE" || exit 1 + exec ffmpeg -i "$1" "$MP3FILE" + fi +else + rm -fr "$MP3FILE" || exit 1 + exec sox "$1" "$MP3FILE" +fi --- deco-git-180320.old/deco-archive/x/ogg/extract +++ deco-git-180320/deco-archive/x/ogg/extract @@ -0,0 +1,27 @@ +#!/bin/bash + +for PROG in grep oggdec rm sed wc +do + NN=`which $PROG 2>/dev/null | wc -l` + if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 + fi +done + +NN=`echo "$1" | grep '^[A-Za-z0-9_.,@/+-]*$' | wc -l` +if [ "x$NN" == "x0" ]; then + echo Error: Filename is unsafe: "$1" + exit 1 +fi + +OUTFILE=`echo "$1" | sed 's/\.ogg$/.wav/'` + +if [ "x$1" == "x$OUTFILE" ]; then + echo Error: Possible upper-lower case issue: "$1" + exit 1 +fi + +rm -fr "$OUTFILE" || exit 1 +oggdec --output="$OUTFILE" "$1" || exit 1 +cptime "$1" "$OUTFILE" 2> /dev/null || true --- deco-git-180320.old/deco-archive/x/pdf/extract +++ deco-git-180320/deco-archive/x/pdf/extract @@ -0,0 +1,31 @@ +#!/bin/bash + +for PROG in grep rm sed wc convert pdfimages pdftotext +do + NN=`which $PROG 2>/dev/null | wc -l` + if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 + fi +done + +NN=`echo "$1" | grep '^[A-Za-z0-9_.,@/+-]*$' | wc -l` +if [ "x$NN" == "x0" ]; then + echo Error: Filename is unsafe: "$1" + exit 1 +fi + +y=`echo "$1" | sed 's/\.pdf$//'` +pdfimages "$1" image +pdftotext "$y.pdf" +cptime "$1" "$y.txt" 2> /dev/null || true + +for x in *.ppm +do + if [ -f "$x" ]; then + y=`echo "$x" | sed 's/\.ppm$/.png/'` + convert "$x" "$y" + rm "$x" + cptime "$1" "$y" 2> /dev/null || true + fi +done --- deco-git-180320.old/deco-archive/x/png/extract +++ deco-git-180320/deco-archive/x/png/extract @@ -0,0 +1,40 @@ +#!/bin/bash + +for PROG in grep rm sed wc +do + NN=`which $PROG 2>/dev/null | wc -l` + if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 + fi +done + +NN=`echo "$1" | grep '^[A-Za-z0-9_.,@/+-]*$' | wc -l` +if [ "x$NN" == "x0" ]; then + echo Error: Filename is unsafe: "$1" + exit 1 +fi + +PNMFILE=`echo "$1" | sed 's/\.png$/.pnm/'` + +if [ "x$1" == "x$PNMFILE" ]; then + echo Error: Possible upper-lower case issue: "$1" + exit 1 +fi + +NN=`which convert 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + NN=`which pngtopnm 2>/dev/null | wc -l` + + if [ "x$NN" == "x0" ]; then + echo Error: Either imagemagick or netpbm is needed for this + exit 1 + else + rm -fr "$PNMFILE" || exit 1 + exec pngtopnm < "$1" > "$PNMFILE" + fi +else + rm -fr "$PNMFILE" || exit 1 + exec convert "$1" "$PNMFILE" +fi --- "deco-git-180320.old/deco-archive/x/tar\\.br/extract" +++ "deco-git-180320/deco-archive/x/tar\\.br/extract" @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=brotli +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -c -d < "$1" | tar x${Verbose+vv}f - +fi --- "deco-git-180320.old/deco-archive/x/tar\\.brotli/extract" +++ "deco-git-180320/deco-archive/x/tar\\.brotli/extract" @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=brotli +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -c -d < "$1" | tar x${Verbose+vv}f - +fi --- "deco-git-180320.old/deco-archive/x/tar\\.bz2/extract" +++ "deco-git-180320/deco-archive/x/tar\\.bz2/extract" @@ -1,3 +1,9 @@ -#!/bin/sh +#!/bin/bash -exec tar xj${Verbose+vv}f "$1" +NN=`which pbzip2 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + exec tar xj${Verbose+vv}f "$1" +else + exec pbzip2 -d < "$1" | tar x${Verbose+vv}f - +fi --- "deco-git-180320.old/deco-archive/x/tar\\.gz/extract" +++ "deco-git-180320/deco-archive/x/tar\\.gz/extract" @@ -1,3 +1,9 @@ -#!/bin/sh +#!/bin/bash -exec tar xz${Verbose+vv}f "$1" +NN=`which pigz 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + exec tar xz${Verbose+vv}f "$1" +else + exec pigz -c -d < "$1" | tar x${Verbose+vv}f - +fi --- "deco-git-180320.old/deco-archive/x/tar\\.zst/extract" +++ "deco-git-180320/deco-archive/x/tar\\.zst/extract" @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=zstd +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -d < "$1" | tar x${Verbose+vv}f - +fi --- "deco-git-180320.old/deco-archive/x/tar\\.zstd/extract" +++ "deco-git-180320/deco-archive/x/tar\\.zstd/extract" @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=zstd +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -d < "$1" | tar x${Verbose+vv}f - +fi --- deco-git-180320.old/deco-archive/x/tta/extract +++ deco-git-180320/deco-archive/x/tta/extract @@ -0,0 +1,12 @@ +#!/bin/bash + +PROG=ttaenc +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + $PROG -d "$1" + cptime "$1" "$Name.wav" 2> /dev/null +fi --- deco-git-180320.old/deco-archive/x/zim/extract +++ deco-git-180320/deco-archive/x/zim/extract @@ -0,0 +1,3 @@ +#!/bin/sh + +zimdump dump --dir=. -- "$1" --- deco-git-180320.old/deco-archive/x/zst/extract +++ deco-git-180320/deco-archive/x/zst/extract @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=zstd +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -d -f "$1" +fi --- deco-git-180320.old/deco-archive/x/zstd/extract +++ deco-git-180320/deco-archive/x/zstd/extract @@ -0,0 +1,11 @@ +#!/bin/bash + +PROG=zstd +NN=`which $PROG 2>/dev/null | wc -l` + +if [ "x$NN" == "x0" ]; then + echo Error: $PROG is needed for this + exit 1 +else + exec $PROG -d -f "$1" +fi ====== end of patch ======