Use mktemp to make mounting folder

This commit is contained in:
Phantop 2021-08-09 21:30:43 -04:00
parent 8251c94f9d
commit 3d229b558c

View file

@ -1,7 +1,7 @@
#!/bin/bash
set -eo pipefail
IFS=$'\n\t'
version=1
version=1.1
usage(){
echo "Usage: $(basename "$0") [option] [FILE/FOLDER/URL]"
@ -13,8 +13,7 @@ usage(){
dwarf() {
mkdwarfs -i "$1" -o "$(basename "$1").sh" "${@:2}" --header <(cat << 'EOF'
#!/bin/sh
DIR=/tmp/.dwarf_$(basename "$0")$RANDOM
mkdir "$DIR" 2> /dev/null
DIR="$(mktemp -td dwarf_$(basename "$0")XXXXX)"
dwarfs -o offset=auto "$0" "$DIR" 2> /dev/null
"$DIR/AppRun" "$@"
fusermount -uz "$DIR" 2> /dev/null