- Timestamp:
- Jun 9, 2014, 2:00:26 PM (10 years ago)
- Location:
- scripts
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
scripts/etc/cron.d/7dtd-backup
r22 r53 1 #0 * * * * root /usr/local/bin/7dtd.sh backup1 #0 * * * * root nice -n 15 /usr/local/bin/7dtd.sh backup -
scripts/usr/local/lib/7dtd/VERSION
r52 r53 1 Version: 1 41 Version: 15 2 2 Release: 2014-06-09 -
scripts/usr/local/lib/7dtd/commands/backup.sh
r52 r53 13 13 local fileI 14 14 for fileI in "$SDTD_BACKUP_ROOT"/*; do 15 if [ $fileI -nt $LatestBackup -a -d $fileI]; then15 if [ "$fileI" -nt "$LatestBackup" -a -d "$fileI" ]; then 16 16 LatestBackup=$fileI 17 17 fi … … 64 64 (( num++ )) 65 65 if [ $num -gt $removeBut ]; then 66 rm $F66 rm -Rf $F 67 67 fi 68 68 done … … 82 82 local maxKBytes=$(( $SDTD_BACKUP_MAX_STORAGE*1024 )) 83 83 local curNumFiles=$(ls -t1 $SDTD_BACKUP_ROOT | wc -l) 84 while [ $(du -sk $SDTD_BACKUP_ROOT ) -gt $maxKBytes -a $curNumFiles -gt $keepMin ]; do84 while [ $(du -sk $SDTD_BACKUP_ROOT | tr '[:blank:]' ' ' | cut -d\ -f1) -gt $maxKBytes -a $curNumFiles -gt $keepMin ]; do 85 85 local toDel=$(ls -tr1 | head -n 1) 86 86 rm -Rf $toDel … … 90 90 91 91 for H in $(getHooksFor backup); do 92 $H $NewBackup 92 if [ "$SDTD_BACKUP_COMPRESS" = "all" ]; then 93 $H $NewBackup.tar.gz 94 else 95 $H $NewBackup 96 fi 93 97 done 94 98 } -
scripts/usr/local/lib/7dtd/commands/updateengine.sh
r48 r53 4 4 5 5 sdtdCommandUpdateengine() { 6 for I in $(getInstanceList); do 7 if [ $(isRunning $I) -eq 1 ]; then 8 echo "At least one instance is still running (\"$I\")." 9 echo "Before updating the engine please stop all instances!" 10 return 11 fi 12 done 6 local FORCED=no 7 local CHECKONLY=no 8 if [ "$1" = "--force" ]; then 9 FORCED=yes 10 fi 13 11 14 12 if [ ! -e $SDTD_BASE/steamcmd ]; then … … 21 19 fi 22 20 23 cd $SDTD_BASE/steamcmd 21 if [ "$1" = "--check" -o "$2" = "--check" ]; then 22 local LOCAL=$(getLocalEngineVersion) 23 local REMOTE=$(getRemoteEngineVersion) 24 if [ $REMOTE -gt $LOCAL ]; then 25 echo "Newer engine version available." 26 else 27 echo "Engine up to date." 28 fi 29 echo "Local buildid: $LOCAL" 30 echo "Available buildid: $REMOTE" 31 return 32 fi 24 33 25 ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_BASE/engine "+app_update 251570" validate +quit 34 for I in $(getInstanceList); do 35 if [ $(isRunning $I) -eq 1 ]; then 36 echo "At least one instance is still running (\"$I\")." 37 echo "Before updating the engine please stop all instances!" 38 return 39 fi 40 done 26 41 27 cp $SDTD_BASE/linux_files/engine/* $SDTD_BASE/engine/ -R28 cp $SDTD_BASE/engine/Install/32bit/SteamworksManaged.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/42 local LOCAL=$(getLocalEngineVersion) 43 local REMOTE=$(getRemoteEngineVersion) 29 44 30 chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine 45 if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then 46 echo "A newer version of the engine is available." 47 echo "Local buildid: $LOCAL" 48 echo "Available buildid: $REMOTE" 49 echo 50 51 while : ; do 52 local CONTINUE 53 read -p "Continue? (yn) " CONTINUE 54 case $CONTINUE in 55 y) 56 echo "Updating..." 57 break 58 ;; 59 n) 60 echo "Canceled" 61 return 62 ;; 63 *) 64 echo "Wrong input" 65 esac 66 done 67 68 cd $SDTD_BASE/steamcmd 69 ./steamcmd.sh +@sSteamCmdForcePlatformType windows +login $STEAM_USER $STEAM_PASS +force_install_dir $SDTD_BASE/engine "+app_update 251570" validate +quit 70 71 cp $SDTD_BASE/linux_files/engine/* $SDTD_BASE/engine/ -R 72 cp $SDTD_BASE/engine/Install/32bit/SteamworksManaged.dll $SDTD_BASE/engine/7DaysToDie_Data/Managed/ 73 74 chown $SDTD_USER.$SDTD_GROUP -R $SDTD_BASE/engine 75 else 76 echo "Engine is already at the newest build (local: $LOCAL, remote: $REMOTE)." 77 fi 31 78 } 32 79 33 80 sdtdCommandUpdateengineHelp() { 34 echo "Usage: $(basename $0) updateengine "81 echo "Usage: $(basename $0) updateengine [--force | --check]" 35 82 echo 36 echo "Update the engine (aka game) files of 7dtd." 83 echo "Check for a newer version of engine (aka game) files of 7dtd. If there is a newer" 84 echo "version they can be updated by this command." 85 echo 86 echo "If --force is specified you are asked if you want to redownload the engine" 87 echo "even if there is no new version available." 88 echo 89 echo "If --check is specified it will only output the current local and remote build ids" 90 echo "and if an update is available." 37 91 } 38 92 … … 40 94 echo "Update the 7dtd engine files" 41 95 } 96 97 sdtdCommandUpdateengineExpects() { 98 case $1 in 99 2) 100 echo "--force --check" 101 ;; 102 esac 103 } 104 -
scripts/usr/local/lib/7dtd/commands/updatescripts.sh
r51 r53 4 4 5 5 sdtdCommandUpdatescripts() { 6 LOCAL=$(cat /usr/local/lib/7dtd/VERSION | grep "Version" | cut -d\ -f2)7 REMOTE=$(wget -qO- http://illy.bz/fi/7dtd/VERSION | grep "Version" | cut -d\ -f2)6 local LOCAL=$(cat /usr/local/lib/7dtd/VERSION | grep "Version" | cut -d\ -f2) 7 local REMOTE=$(wget -qO- http://illy.bz/fi/7dtd/VERSION | grep "Version" | cut -d\ -f2) 8 8 9 if [ $REMOTE -gt $LOCAL ]; then 9 local FORCED 10 if [ "$1" = "--force" ]; then 11 FORCED=yes 12 else 13 FORCED=no 14 fi 15 if [ "$FORCED" = "yes" -o $REMOTE -gt $LOCAL ]; then 10 16 echo "A newer version of the scripts is available." 11 17 echo "Local: v.$LOCAL" … … 58 64 59 65 sdtdCommandUpdatescriptsHelp() { 60 echo "Usage: $(basename $0) updatescripts "66 echo "Usage: $(basename $0) updatescripts [--force]" 61 67 echo 62 68 echo "Check for a newer version of the management scripts. If there is a newer" 63 69 echo "version they can be updated by this command." 70 echo 71 echo "If --force is specified you are asked if you want to redownload the scripts" 72 echo "even if there is no new version available." 64 73 } 65 74 … … 68 77 } 69 78 79 sdtdCommandUpdatescriptsExpects() { 80 case $1 in 81 2) 82 echo "--force" 83 ;; 84 esac 85 } 86 -
scripts/usr/local/lib/7dtd/common.sh
r46 r53 94 94 echo 0 95 95 fi 96 } 97 98 # Get the local engine version number (i.e. build id) 99 # Returns: 100 # 0 if no engine installed or no appmanifest found or buildid could not be read 101 # Build Id otherwise 102 getLocalEngineVersion() { 103 local APPMANIFEST=$(find $SDTD_BASE/engine -type f -name "appmanifest_251570.acf") 104 local LOCAL=0 105 if [ -f "$APPMANIFEST" ]; then 106 LOCAL=$(grep buildid "$APPMANIFEST" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) 107 if [ $(isANumber "$LOCAL") -eq 0 ]; then 108 LOCAL=0 109 fi 110 fi 111 echo $LOCAL 112 } 113 114 # Get the latest remote engine version number (i.e. build id) 115 # Returns: 116 # 1 if build id could not be retrieved 117 # Build Id otherwise 118 getRemoteEngineVersion() { 119 cd $SDTD_BASE/steamcmd 120 local REMOTE=$(./steamcmd.sh "+app_info_print 251570" +quit | grep -EA 1000 "^\s+\"branches\"$" | grep -EA 5 "^\s+\"public\"$" | grep -m 1 -EB 10 "^\s+}$" | grep -E "^\s+\"buildid\"\s+" | tr '[:blank:]"' ' ' | tr -s ' ' | cut -d\ -f3) 121 if [ $(isANumber "$REMOTE") -eq 0 ]; then 122 REMOTE=1 123 fi 124 echo $REMOTE 96 125 } 97 126
Note:
See TracChangeset
for help on using the changeset viewer.