appdwarf: Replace the folder header with an AppRun using bindfs

This commit is contained in:
Phantop 2022-06-11 23:16:03 -04:00
parent 3ebee5f254
commit 654eea6fab
3 changed files with 12 additions and 25 deletions

9
DirRun Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
DIR=
if [ ! -d "$DIR" ]; then
mkdir "$DIR"
bindfs --no-allow-other "$APPDIR" "$DIR"
else
fusermount -u "$DIR"
rmdir "$DIR"
fi

View File

@ -5,7 +5,6 @@ if [ $# -eq 0 ] || [ "$1" = -h ] || [ "$1" = --help ]; then # print help text
echo "Compress a given AppDir (default)"
tput setaf 7
echo " -a, --appimage Convert a given AppImage to appdwarf"
echo " -f, --folder Make image mount to a given folder (no AppRun)"
echo " -u, --url Fetch and convert AppImage from URL"
echo; tput setaf 5
echo " -h, --help Print this help text"
@ -20,17 +19,10 @@ HEAD="$(dirname "$(readlink -f "${0}")")/header"
while true; do # process args
case "$1" in
--appimage | -a)
app="$2"
shift ;;
--folder | -f)
"$HEAD"_folder
HEAD=/tmp/dwarfhead
sed -i "2s|$|\"$2\"|" "$HEAD"
shift ;;
app="$2" ;;
--url | -u)
app=$(basename "$2")
aria2c -x16 -s16 "$2" -o "$app" || wget "$2" -O "$app"
shift ;;
aria2c -x16 -s16 "$2" -o "$app" || wget "$2" -O "$app" ;;
--version | -v)
tput setaf 2; echo appdwarf v3.0
tput setaf 4; echo Built by July 🏳️‍🌈
@ -39,7 +31,7 @@ while true; do # process args
shift; break;;
*)
break;;
esac; shift
esac; shift 2
done
if [ -n "$app" ]; then # handle and extract appimage input, if present

View File

@ -1,14 +0,0 @@
#!/bin/sh
cat > /tmp/dwarfhead << 'EOF'
#!/bin/sh
DIR=
if [ ! -d "$DIR" ]; then
mkdir "$DIR"
ARG="-o offset=auto -o tidy_strategy=swap -o workers=4"
dwarfs $ARG "$0" "$DIR" 2>/dev/null
else
fusermount -u "$DIR"
rmdir "$DIR"
fi
exit
EOF