tmp: Update help text, add more directory permissions checking
This commit is contained in:
parent
6637e750c9
commit
a544d9827d
14
tmp
14
tmp
@ -34,7 +34,7 @@ while getopts ":h" opt; do
|
|||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: $name [TEMPLATE]
|
Usage: $name [TEMPLATE]
|
||||||
Create a temporary directory, copying the folder [TEMPLATE] from
|
Create a temporary directory, copying the folder [TEMPLATE] from
|
||||||
~/Templates/tmp, if it exists.
|
[XDG_TEMPLATES_DIR|~/Templates]/tmp, if it exists.
|
||||||
|
|
||||||
-h Show this help text
|
-h Show this help text
|
||||||
|
|
||||||
@ -59,12 +59,16 @@ if [ -n "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
unset userdirs
|
unset userdirs
|
||||||
copydir="${XDG_TEMPLATES_DIR:-~/Templates}/tmp/$1"
|
copydir="${XDG_TEMPLATES_DIR:-~/Templates}/tmp/$1"
|
||||||
if [ -d "$copydir" ]; then
|
if ! [ -d "$copydir" ]; then
|
||||||
|
log "Could not find template directory \"$copydir\""
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
if ! [ -r "$copydir" ]; then
|
||||||
|
log "Cannot read template directory \"$copydir\""
|
||||||
|
exit 4
|
||||||
|
fi
|
||||||
log "Using template \"$1\""
|
log "Using template \"$1\""
|
||||||
cp -r "$copydir"/* "$tmpdir"
|
cp -r "$copydir"/* "$tmpdir"
|
||||||
else
|
|
||||||
log "Could not find template directory \"$copydir\""
|
|
||||||
fi
|
|
||||||
unset copydir
|
unset copydir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user