1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-12-10 23:47:15 +00:00
dotfiles/.local/bin/appdwarf

25 lines
622 B
Plaintext
Raw Normal View History

2021-02-10 00:11:23 +00:00
#!/bin/sh
mkdir appdir
if not mkdwarfs -i $@ -o appdir/root.dwarfs; then
mkdwarfs -i $@ -o appdir/temp.dwarfs -l0
mkdwarfs --recompress -i appdir/temp.dwarfs -o appdir/root.dwarfs
rm appdir/temp.dwarfs
fi
cat >> appdir/AppRun <<'EOF'
#!/bin/sh
HERE=$(dirname $(readlink -f "${0}"))
DIR=/tmp/.dwarf_$RANDOM
mkdir $DIR 2> /dev/null
dwarfs $HERE/root.dwarfs $DIR 2> /dev/null
$DIR/AppRun $@
fusermount -uz $DIR 2> /dev/null
rmdir $DIR 2> /dev/null
EOF
chmod +x appdir/AppRun
mksquashfs appdir app.sfs -noD
cat $(which appimageruntime) app.sfs > $(basename $@).sh
chmod +x $(basename $@).sh
rm -r appdir app.sfs