From 3b1b45c097afcd5074120b4ab235ca78518a9cfe Mon Sep 17 00:00:00 2001 From: Phantop Date: Fri, 5 Aug 2022 09:55:58 -0400 Subject: [PATCH] Improve AppImage check and make README reflect current functionality and dependencies --- README.md | 19 +++++++++++-------- appdwarf | 12 ++++++------ apps/README.md | 1 + 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1417c00..3853db0 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/appdwarf b/appdwarf index 070bb96..721e945 100755 --- a/appdwarf +++ b/appdwarf @@ -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" "$@" diff --git a/apps/README.md b/apps/README.md index 17533a1..af5bfbc 100644 --- a/apps/README.md +++ b/apps/README.md @@ -16,6 +16,7 @@ Script | Function | Source `mknode ` | Latest official NodeJS release | `mkpypy ` | Latest PyPy3 release | `mkrust ` | Latest Rust nightly | +`mksignal` | Latest Signal stable from the Solus repos (requires `eopkg` and may not work on other distros) | `mktex ` | Minimal/custom TeX Live image | `mkwine ` | Latest `wine-staging-tkg` release | `mkwine proton` | GloriousEggroll Proton Builds |