Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Mod Update script for linux
- #
- # by Dr.Pulp - www.FAKKer.de
- # with modifications by Kindling
- #
- #
- #
- # READ FIRST!!!
- #
- # In order to use this script you need to have gunzip, convmv and rsync installed!
- # Be sure to adjust the ARMA_DIR to point to your ARMA/OA game directory and ARMA_SYNC_DIR to point to an alternative storage directory.
- #
- ##################################
- # Configuration start #
- ##################################
- # ARMA II (for ARMA II) or Operation Arrowhead (for OA or CO) directory.
- ARMA_DIR="/home/XXXX/.wine/drive_c/Program Files (x86)/Steam/steamapps/common/arma 2 operation arrowhead"
- # Rsync storage directory for caching files - if this is removed, mods will need to be redownloaded in full to update.
- # This will retain a copy of each mod to avoid problems caused by case-sensitive filesystems.
- ARMA_SYNC_DIR=/home/XXXX/arma-temp
- # Space-delimited list of available mirrors.
- MIRRORLIST=(dev-heaven.net six.bssnet.dk zeus2.zeus-community.net)
- # If parameters are passed to the script, use each parameter as a mod to download.
- if [ $# != 0 ]
- then MODS="$@"
- else
- # MODS contains mods that you'd like to synchronize if no parameters are given.
- # For a complete list of available mods, check http://updater.dev-heaven.net/main
- # Use the mod's name without the @, seperate multiple mods by spaces.
- MODS="rh_m14 ace acex cba cba_oa cba_a2 acex_ru acex_usnavy"
- fi
- ##################################
- # Advanced Configuration #
- ##################################
- RM="`which rm` -r"
- RSYNC="`which rsync` --times -O --no-whole-file -r --delete --progress -h --exclude=.rsync rsync://"
- CP="`which cp` -r"
- GUNZIP="`which gunzip` -r"
- CONVMV="`which convmv` --lower --notest"
- ##################################
- # Configuration end #
- ##################################
- # Function: random mirror selection
- RANDOM_MIRROR() {
- MIRRORCOUNT=${#MIRRORLIST[*]}
- MIRRORCOUNT=`expr $MIRRORCOUNT - 1`
- MIRRORCOUNT=`expr 32767 / $MIRRORCOUNT`
- MIRROR=${MIRRORLIST[$(($RANDOM/$MIRRORCOUNT))]}
- }
- if [ ! -d "$ARMA_DIR" ]
- then echo "ARMAII/OA directory does not exist!"
- exit
- fi
- if [ ! -d "$ARMA_SYNC_DIR" ]
- then echo "Rsync storage directory does not exist!"
- exit
- fi
- # Loop: deleting folder, rsync, decompress and copy for each mod you selected
- for MOD in $MODS
- do
- if [ -d "$ARMA_DIR/@$MOD" ]
- then $RM "$ARMA_DIR/@$MOD"
- fi
- INFOSYNC='Synchronising '$MOD'...'
- echo ' -------------------'
- echo $INFOSYNC
- OK=1
- BAILOUT=0
- until [ "$OK" -lt "1" ]
- do
- RANDOM_MIRROR
- $RSYNC$MIRROR/rel/$MOD/./.pack/ ${ARMA_SYNC_DIR}/@$MOD
- OK=$?
- BAILOUT=`expr $BAILOUT + 1`
- if [ "$BAILOUT" -gt 10 ]
- then
- ENDE='There was a problem during rsync of '$MOD' from '$MIRROR'! Aborting Script to prevent a loop. Check output directories and permissions or add more mirrors.'
- echo $ENDE
- exit
- fi
- done
- INFOCOPY='Copying '$MOD' to the destination folder...'
- echo $INFOCOPY
- $CP ${ARMA_SYNC_DIR}/@$MOD "${ARMA_DIR}"
- INFOZIP='Decompressing '$MOD'...'
- echo $INFOZIP
- $GUNZIP "${ARMA_DIR}/@$MOD/"*
- done
- # Converting filenames to lower case letters
- $CONVMV "${ARMA_DIR}/@"*
- # Copying keys mpmissions, store/userconfig and userconfig to the correct directories
- for MOD in $MODS
- do
- if test -e "${ARMA_DIR}/@$MOD/store/keys"
- then $CP "${ARMA_DIR}/@$MOD/store/keys/"* "${ARMA_DIR}/keys"
- elif test -e "${ARMA_DIR}/@$MOD/keys"
- then $CP "${ARMA_DIR}/@$MOD/keys/"* "${ARMA_DIR}/keys"
- else
- continue
- fi
- if test -e "${ARMA_DIR}/@$MOD/mpmissions"
- then $CP "${ARMA_DIR}/@ace/mpmissions/"* "${ARMA_DIR}/mpmissions"
- else
- continue
- fi
- if test -e "${ARMA_DIR}/@$MOD/userconfig"
- then
- if test -e "${ARMA_DIR}/userconfig/$MOD"
- then
- $CP "${ARMA_DIR}/@$MOD/userconfig/"* "${ARMA_DIR}/userconfig/$MOD/"
- else
- /bin/mkdir -p "${ARMA_DIR}/userconfig/$MOD"
- $CP "${ARMA_DIR}/@$MOD/userconfig/"* "${ARMA_DIR}/userconfig/$MOD/"
- fi
- else
- continue
- fi
- if test -e "${ARMA_DIR}/@$MOD/store/userconfig"
- then
- if test -e "${ARMA_DIR}/userconfig/$MOD"
- then
- $CP "${ARMA_DIR}/@$MOD/store/userconfig/"* "${ARMA_DIR}/userconfig/$MOD/"
- else
- /bin/mkdir -p "${ARMA_DIR}/userconfig/$MOD"
- $CP "${ARMA_DIR}/@$MOD/store/userconfig/"* "${ARMA_DIR}/userconfig/$MOD/"
- fi
- else
- continue
- fi
- done
- exit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement