Dependency check. Remove tmp_dir on exit.

This commit is contained in:
the-sane 2021-01-15 20:02:10 -05:00 committed by GitHub
parent 35fd12b672
commit 62477143f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,6 +38,12 @@
# Contributor: https://github.com/Termuellinator # Contributor: https://github.com/Termuellinator
############################################################################ ############################################################################
# Check for dependencies
if [ ! -x "$(command -v mktemp2)" ] || [ ! -x "$(command -v basename)" ]; then
echo -e "One or more required packages were not found on this system.\nPlease check that the following packages are installed:\n- mktemp (part of gnu coreutils)\n- basename (part of gnu coreutils)"
exit 1
fi
wine_conf="winedir.conf" wine_conf="winedir.conf"
game_conf="gamedir.conf" game_conf="gamedir.conf"
backup_conf="backupdir.conf" backup_conf="backupdir.conf"
@ -57,7 +63,9 @@ fi
# .config subdirectory # .config subdirectory
conf_subdir="starcitizen-lug" conf_subdir="starcitizen-lug"
tmp_dir="$(mktemp -d --suffix=".lughelper" || echo "/tmp")" # Temporary directory
tmp_dir="$(mktemp -d --suffix=".lughelper")"
trap 'rm -r "$tmp_dir"' EXIT
# The game's user subdirectory name # The game's user subdirectory name
user_subdir_name="USER" user_subdir_name="USER"