slight info and error reporting cleanup

This commit is contained in:
Phantop 2022-05-12 20:32:37 -04:00
parent 9e948de066
commit 44fe9a32b1
3 changed files with 12 additions and 10 deletions

View file

@ -20,7 +20,7 @@ If you only wish to run an existing image, only `dwarfs` is needed in PATH.
## How to create an appdwarf ## How to create an appdwarf
For your own programs, simply create an AppImage-style AppDir and run `appdwarf {directory}`. For your own programs, simply create an AppImage-style AppDir and run `appdwarf {directory}`.
You can also invoke `appdwarf -a {appimage}` to convert an apimage. You can also invoke `appdwarf -a {AppImage}` to convert an AppImage.
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 The apps folder contains other scripts for specific programs that will download all

View file

@ -5,7 +5,7 @@ if [ $# -eq 0 ] || [ "$1" = -h ] || [ "$1" = --help ]; then # print help text
echo "Compress a given AppDir (default)" echo "Compress a given AppDir (default)"
tput setaf 7 tput setaf 7
echo " -a, --appimage Convert a given AppImage to appdwarf" echo " -a, --appimage Convert a given AppImage to appdwarf"
echo " -f, --folder Make mount toggle image for a given folder" echo " -f, --folder Make image mount to a given folder (no AppRun)"
echo " -s, --separate Use old, separated header format" echo " -s, --separate Use old, separated header format"
echo " -u, --url Fetch and convert AppImage from URL" echo " -u, --url Fetch and convert AppImage from URL"
echo; tput setaf 5 echo; tput setaf 5
@ -35,9 +35,8 @@ while true; do # process args
aria2c -x16 -s16 "$2" -o "$app" || wget "$2" -O "$app" aria2c -x16 -s16 "$2" -o "$app" || wget "$2" -O "$app"
shift ;; shift ;;
--version | -v) --version | -v)
tput setaf 4 tput setaf 2; echo appdwarf v2.9
echo appdwarf v2.9 tput setaf 4; echo Built by July 🏳️‍🌈
echo Maintained by phantop.
exit ;; exit ;;
--) --)
shift; break;; shift; break;;
@ -47,15 +46,18 @@ while true; do # process args
done done
if [ -n "$app" ]; then # handle and extract appimage input, if present if [ -n "$app" ]; then # handle and extract appimage input, if present
[ ! -f "$app" ] && tput setaf 1 && echo "$app" is not a valid file && exit 1 [ ! -f "$app" ] && tput setaf 1 && echo "$app" is not a valid file >&2 && exit 1
file -i "$app" | grep -qv x-executable && tput setaf 1 &&
echo "$app" is not an AppImage >&2 && exit 1
chmod +x "$app" chmod +x "$app"
rm -rf squashfs-root rm -rf squashfs-root
"$(realpath "$app")" --appimage-extract || exit 1 "$(realpath "$app")" --appimage-extract
rm "$app"
set -- "$(basename "$app" .AppImage)" "$@" set -- "$(basename "$app" .AppImage)" "$@"
mv squashfs-root "$1" mv squashfs-root "$1"
fi fi
[ ! -d "$1" ] && tput setaf 1 && echo "$1" is not a valid folder && exit 1 [ ! -d "$1" ] && tput setaf 1 && echo "$1" is not a valid folder >&2 && exit 1
mkdwarfs -o "$(realpath "$1").sh" -B5 --header "$HEAD" -i "$@" mkdwarfs -o "$(realpath "$1").sh" -B5 --header "$HEAD" -i "$@"
chmod +x "$(realpath "$1").sh" chmod +x "$(realpath "$1").sh"

View file

@ -9,7 +9,7 @@ curl -L "$LINK" | bsdtar xf - -C$DIR
mv $DIR/node* $DIR/node mv $DIR/node* $DIR/node
strip $DIR/node/bin/node strip $DIR/node/bin/node
cp "$(dirname "$(readlinjrek -f "${0}")")"/../AppRun $DIR/node cp "$(dirname "$(readlink -f "${0}")")"/../AppRun $DIR/node
sed -i 5s#/#/bin/# $DIR/node/AppRun sed -i 5s#/#/bin/# $DIR/node/AppRun
appdwarf $DIR/node appdwarf $DIR/node