Polish up tmp a bit more

This commit is contained in:
Salt 2020-10-30 00:00:44 -05:00
parent 74a38a5983
commit 4263f0404a

11
tmp
View File

@ -8,6 +8,7 @@
# Define variables
name="$(basename "$0" .sh)"
tmpdirtemplate="XXXXXX"
tmpdir="$(mktemp -d)"
# Verify them
@ -50,7 +51,7 @@ EOF
esac
done
# Copy in template directory
# Validate $1
if [ -n "$1" ]; then
# Source in XDG dirs, if they exist
userdirs="${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
@ -68,6 +69,14 @@ if [ -n "$1" ]; then
exit 4
fi
log "Using template \"$1\""
tmpdirtemplate="$1.$tmpdirtemplate"
fi
# Make our directory
tmpdir="$(mktemp -dt "tmp.$tmpdirtemplate")"
# Copy in template directory
if [ -n "$1" ] && [ -n "$copydir" ] && [ -n "$tmpdir" ]; then
cp -r "$copydir"/* "$tmpdir"
unset copydir
fi