This commit is contained in:
2023-11-20 07:01:50 -06:00
parent 69ec6bd7be
commit 5ecd4c4f59
3 changed files with 101 additions and 15 deletions

View File

@@ -9,16 +9,19 @@ export DAYZ_SERVER_ID=223350
export STEAM_USER="yzaddayz"
export DEBUG=false
export REMOTE_DIR="/mnt/dayz"
export REMOTE_MAPS="$REMOTE_DIR/stock/maps"
export REMOTE_MODS="$REMOTE_DIR/mods"
export REMOTE_STOCK_SERVER="$REMOTE_DIR/stock/DayZServer"
export REMOTE_STOCK_GAME="$REMOTE_DIR/stock/DayZ"
################### GLOBAL VARS ##############################
################### GLOBAL ALIASES ###########################
alias do_sync='rsync -rvltDhu --delete --partial --progress'
################### GLOBAL ALIASES ###########################
################### GLOBAL FUNCTIONS #########################
msg() {
printf '[*] %s\n' "$*"
@@ -26,9 +29,45 @@ msg() {
errmsg() {
>&2 printf '[Error]: %s\n' "$*"
}
mount_dayz_network_drive() {
if ! is_network_drive_mounted ; then
if [ -e /proc/version ] ; then
read -r ver < /proc/version
case $ver in
# WSL
*icrosoft*)
msg "Detected WSL, mounting via drvfs"
sudo mount -t drvfs -o user=samba \
//truenas.local.wvr.sh/dayz /mnt/dayz
;;
*)
msg "Detected Linux, mounting via cifs"
sudo mount -t cifs //truenas.local.wvr.sh/dayz /mnt/dayz \
-o credentials=/root/sambacreds.txt \
-o uid=1000 \
-o gid=1000 \
-o iocharset=utf8 \
-o vers=3.0
esac
unset ver
# asdf
else
errmsg 'could not find /proc/version'
exit 1
fi
fi
if ! is_network_drive_mounted ; then
errmsg 'Could not mount network drive'
exit 1
fi
}
is_network_drive_mounted() {
if [ ! -f "$REMOTE_DIR/canary" ] ; then
return 1
fi
}
################### GLOBAL FUNCTIONS #########################
mount_dayz() {
sudo mount -t drvfs -o user=samba \
//truenas.local.wvr.sh/dayz /mnt/dayz
}