This commit is contained in:
2023-11-20 20:44:19 -06:00
parent 366253f1f9
commit ddcfe9e2a3
3 changed files with 147 additions and 55 deletions

View File

@@ -33,6 +33,45 @@ die() {
errmsg "$*"
exit 1
}
isnum() {
case $1 in
''|*[!0-9]*)
exit 1
;;
*)
exit 0
esac
}
isempty() {
for arg in "$@" ; do
# exit in error if file
if [ -f "$arg" ] ; then
exit 1
elif [ -L "$arg" ] ; then
# if is a symlink, check what it points to
# note: this only checks one-link level deep
if [ -d "$(readlink "$arg")" ] ; then
exit 0
else
exit 1
fi
elif [ -d "$arg" ] ; then
:
else
# is not a directory or a link to a directory
exit 1
fi
# there should be a way to make this be builtins only
# using printf and glob expansions, look into later
if /bin/rmdir "$arg" 2>/dev/null ; then
/bin/mkdir -p "$arg"
exit 0
else
exit 1
fi
done
}
mount_dayz_network_drive() {
if ! is_network_drive_mounted ; then
sudo mkdir -p /mnt/dayz