#!/bin/sh # # values used on both the modserver and individual servers # ------------------------------------------------------------ ################### GLOBAL VARS ############################## export DAYZ_GAME_ID=221100 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' "$*" } errmsg() { >&2 printf '[Error]: %s\n' "$*" } mount_dayz_network_drive() { if ! is_network_drive_mounted ; then sudo mkdir -p /mnt/dayz 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 \ -o rw 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 # test write touch /mnt/dayz/canary.test if [ $? -eq 0 ] ; then rm /mnt/dayz/canary.test else errmsg "Mounted network drive but we do not have write access." exit 1 fi } ################### GLOBAL FUNCTIONS #########################