1
0
Fork 0
mirror of https://github.com/Phantop/dotfiles synced 2024-12-02 11:33:10 +00:00
dotfiles/.local/bin/appdwarf
Phantop 05337cb26d Miscellaneous command/package/redirect fixes
Also adds the mpv-mpris library/script back
2021-03-03 14:41:09 -05:00

21 lines
464 B
Bash
Executable file

#!/bin/sh
mkdir appdir
mkdwarfs -i $@ -o appdir/root.dwarfs
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