Improve AppImage check and make README reflect current functionality and dependencies

This commit is contained in:
Phantop 2022-08-05 09:55:58 -04:00
parent 7f0f4e3f81
commit 3b1b45c097
3 changed files with 18 additions and 14 deletions

View file

@ -5,17 +5,21 @@ either as a local file or from a URL, into a highly compressed portable image us
[dwarfs](https://github.com/mhx/dwarfs).
This is a small script and the bulk of the work is in the original `dwarfs` project,
so all credit deserves to go there. It has not been extensively tested so I cannot
guarantee it will function without issue.
so all credit deserves to go there. This script has not been extensively tested so I
cannot guarantee it will function without issue.
## Requirements
In order to create the images, you will need:
- [dwarfs](https://github.com/mhx/dwarfs), specifically the `dwarfs` and `mkdwarfs` utilities.
- Some coreutils implementation
- [dwarfs](https://github.com/mhx/dwarfs), specifically `mkdwarfs`
- This may in turn require further dependencies, and specifically relies on the presence of FUSE for mounting images.
- `dwarfsck` and `dwarfsextract` also allow for additional functionality
- Squashfs-tools for AppImage functionality
- `zstd` for creating or running `zzexe` files
If you only wish to run an existing image, only `dwarfs` is needed in PATH.
If you only wish to run an existing appdwarf, only `dwarfs` is needed in PATH.
## How to create an appdwarf
@ -44,7 +48,6 @@ It also automatically appends the extension of the source file to the temporary
created when ran since some programs care about that, such as an emulator only
running games of an expected file extension.
`zzexe` requires `zstd` for both creating and running files and `moreutils` for creating them.
As of June 2022, `zzexe` has been integrated into the main `appdwarf` script. It can
be run either with the `-z` flag or by renaming the `appdwarf` script to `zzexe`.
As of June 2022, `zzexe` has been integrated into the main `appdwarf` script.
I have implemented a heuristic that should automatically detect regular files and
run `zzexe` on them, however you can directly invoke it with the `-z` option.

View file

@ -30,8 +30,8 @@ unappimage() {
a=$(readelf -h "$1" | sed '13!d;s/[^0-9]//g')
b=$(readelf -h "$1" | sed '18!d;s/[^0-9]//g')
c=$(readelf -h "$1" | sed '19!d;s/[^0-9]//g')
o=$(echo "$a" + "$b" \* "$c" | bc)
unsquashfs -o "$o" "$1"
o=$(echo "$a" + "$b" \* "$c" | bc) # calculate offset via ELF header
unsquashfs -o "$o" "$@"
}
zzexe() {
@ -79,7 +79,7 @@ case "$1" in
shift
zzexe "$@" ;;
--version | -v )
tput setaf 2; echo appdwarf 2022.07.24
tput setaf 2; echo appdwarf 2022.08.05
tput setaf 6; echo Built by July 🏳️‍🌈; exit ;;
-* | '' )
echo "Usage: appdwarf [option] [APP/FILE/FOLDER/URL] [compression options]"
@ -124,13 +124,13 @@ if [ ! -d "$1" ]; then # directory doesn't exist, see if this is an appimage
fi
fi
rm -rf squashfs-root
# this is a file, but it might be an existing dwarfs image
if dwarfsck -d0 -i"$1"; then
set -- "$@" --recompress=none
elif file "$1" | grep -q ELF && unappimage "$1"; then
echo "AppImage found. Converting..."
elif test "$(hexdump -n11 -e'"%x"' "$1")" = 464c457f1010224941; then
echo "AppImage found. Converting..." # appimage magic matched
app="$(basename "$1" .AppImage)"
unappimage "$1"
rm -rf "$1" "$app"
shift
set -- "$app" "$@"

View file

@ -16,6 +16,7 @@ Script | Function | Source
`mknode ` | Latest official NodeJS release | <https://nodejs.org>
`mkpypy ` | Latest PyPy3 release | <https://www.pypy.org>
`mkrust ` | Latest Rust nightly | <https://rust-lang.org>
`mksignal` | Latest Signal stable from the Solus repos (requires `eopkg` and may not work on other distros) | <https://signal.org>
`mktex ` | Minimal/custom TeX Live image | <https://ctan.org>
`mkwine ` | Latest `wine-staging-tkg` release | <https://github.com/Kron4ek/Wine-Builds>
`mkwine proton` | GloriousEggroll Proton Builds | <https://github.com/GloriousEggroll/proton-ge-custom>