mirror of
https://github.com/Phantop/appdwarf.git
synced 2025-01-09 21:56:52 +00:00
zzexe: moved here from my dotfiles
This commit is contained in:
parent
ed2a43c751
commit
582fff0047
19
README.md
19
README.md
|
@ -23,7 +23,24 @@ For your own programs, simply create an AppImage-style AppDir and run `appdwarf
|
||||||
You can also invoke `appdwarf -a {appimage}` to convert an apimage.
|
You can also invoke `appdwarf -a {appimage}` to convert an apimage.
|
||||||
I suggest checking the help (listed via `appdwarf --help`) for other options.
|
I suggest checking the help (listed via `appdwarf --help`) for other options.
|
||||||
|
|
||||||
The apps folder contains other scripts for specific programs that will download all necessary files and create a resulting appdwarf in the same folder.
|
The apps folder contains other scripts for specific programs that will download all
|
||||||
|
necessary files and create a resulting appdwarf in the same folder.
|
||||||
|
|
||||||
|
## `zzexe`
|
||||||
|
|
||||||
|
`zzexe` is a small tool similar to `gzexe` that instead uses zstd to compress single applications.
|
||||||
|
I've included it because it has a similar goal to `appdwarf` on the whole, just on a smaller scale.
|
||||||
|
|
||||||
|
I wrote it in part because I felt that `gzexe` was overly complicated, as I used to
|
||||||
|
just use a lightly modified version of it that replaces `gzip` with `zstd`,
|
||||||
|
and to add a couple additional features.
|
||||||
|
|
||||||
|
It supports adding in a prefix command to the file using the `-p` options e.g.
|
||||||
|
`zzexe -p wine some.exe` will generate a compressed file that will then run the exe.
|
||||||
|
|
||||||
|
It also automatically appends the extension of the source file to the temporary file
|
||||||
|
created when ran since some programs care about that, such as an emulator only
|
||||||
|
running games of an expected file extension.
|
||||||
|
|
||||||
## Known Issues
|
## Known Issues
|
||||||
|
|
||||||
|
|
34
zzexe
Executable file
34
zzexe
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#!/bin/sh
|
||||||
|
tmp=$(mktemp -u)
|
||||||
|
if [ "$1" = "-d" ]; then
|
||||||
|
shift
|
||||||
|
tail -n +11 "$1" | zstd -do "$tmp" &&
|
||||||
|
mv "$tmp" "$1"
|
||||||
|
chmod +x "$1"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" = "-p" ]; then
|
||||||
|
shift
|
||||||
|
prefix="$1 "
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo '#!/bin/sh' >> "$tmp"
|
||||||
|
echo 'out=$(mktemp -t .zzXXXX.'"${1##*.}"\) >> "$tmp"
|
||||||
|
cat >> "$tmp" << 'EOF'
|
||||||
|
dir=$(dirname "$0")
|
||||||
|
tail -n +11 "$0" | zstd -cd > "$out"
|
||||||
|
chmod +x "$out"
|
||||||
|
ln -s "$out" "$dir"
|
||||||
|
trap "res=$?" 0 1 2 3 5 10 13 15
|
||||||
|
EOF
|
||||||
|
echo "$prefix"'$dir/$(basename $out) "$@"' >> "$tmp"
|
||||||
|
cat >> "$tmp" << 'EOF'
|
||||||
|
rm "$out" "$dir"/$(basename $out)
|
||||||
|
exit $res
|
||||||
|
EOF
|
||||||
|
|
||||||
|
zstdmt --ultra -c22 --long "$1" >> "$tmp" || exit 1
|
||||||
|
mv "$tmp" "$1"
|
||||||
|
chmod +x "$1"
|
Loading…
Reference in a new issue