2021-10-26 19:01:32 +00:00
|
|
|
#!/bin/sh
|
2021-11-13 07:32:16 +00:00
|
|
|
if [ "$1" == "-d" ]; then
|
|
|
|
shift
|
|
|
|
tail -n +11 "$@" | zstd -do "$@"~ &&
|
|
|
|
mv "$@"~ "$@"
|
|
|
|
chmod +x "$@"
|
2021-10-26 19:01:32 +00:00
|
|
|
else
|
2021-11-13 07:32:16 +00:00
|
|
|
cat > "$@"~ << 'EOF'
|
|
|
|
#!/bin/sh
|
|
|
|
dir=`dirname $0`
|
|
|
|
out=`mktemp -t .zzXXXX`
|
|
|
|
tail -n +11 $0 | zstd -cd > $out
|
|
|
|
chmod +x $out
|
|
|
|
ln -s $out $dir
|
|
|
|
trap "res=$?" 0 1 2 3 5 10 13 15
|
|
|
|
$dir/`basename $out` $@
|
|
|
|
rm $out $dir/`basename $out`
|
|
|
|
exit $res
|
2021-10-26 19:01:32 +00:00
|
|
|
EOF
|
2021-11-13 07:32:16 +00:00
|
|
|
zstd --ultra -22 "$@"
|
|
|
|
rm "$@"
|
|
|
|
cat "$@"~ "$@".zst > "$@"
|
|
|
|
rm "$@".zst "$@~"
|
|
|
|
chmod +x "$@"
|
|
|
|
fi
|