Update Install_mods.sh
This commit is contained in:
+12
-14
@@ -9,8 +9,8 @@ STEAM_ACCT_USERNAME="{steam account with ARMA 3 BOUGHT!}"
|
|||||||
ARMA3_ID=107410
|
ARMA3_ID=107410
|
||||||
|
|
||||||
# Fill these two arrays with the mods of choosing. Make sure the mod names are correct.
|
# Fill these two arrays with the mods of choosing. Make sure the mod names are correct.
|
||||||
MOD_NAMES=("@antistasi")
|
MOD_NAMES=("@antistasi" "@cba_a3" "@enhanced_movement" "@rhsafrf" "@rhsusaf" "@advanced_sling_loading" "@advanced_towing")
|
||||||
MODS=(2867537125)
|
MODS=(2867537125 450814997 333310405 843425103 843577117 615007497 639837898)
|
||||||
|
|
||||||
function workshop_download () {
|
function workshop_download () {
|
||||||
steamcmd +login $STEAM_ACCT_USERNAME +workshop_download_item $ARMA3_ID $1 validate +quit
|
steamcmd +login $STEAM_ACCT_USERNAME +workshop_download_item $ARMA3_ID $1 validate +quit
|
||||||
@@ -54,17 +54,16 @@ function apply_mod_signing_keys_to_server () {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
};
|
};
|
||||||
|
|
||||||
function remove_mod_signing_keys_from_server () {
|
function remove_mod_signing_keys_from_server () {
|
||||||
pushd $(pwd)
|
pushd $(pwd)
|
||||||
cd /app/serverfiles/keys/
|
cd /app/serverfiles/keys/
|
||||||
find . ! -name a3.bikey -maxdepth 1 -type f -delete
|
find . -maxdepth 1 ! -name a3.bikey -type f -delete
|
||||||
popd
|
popd
|
||||||
};
|
};
|
||||||
|
|
||||||
function check_mod_names_and_mods_array_lengths () {
|
function check_mod_names_and_mods_array_lengths () {
|
||||||
local -n array1="$1"
|
array1="$1"
|
||||||
local -n array2="$2"
|
array2="$2"
|
||||||
|
|
||||||
if [[ ! ${#array1[@]} -eq ${#array2[@]} ]]; then
|
if [[ ! ${#array1[@]} -eq ${#array2[@]} ]]; then
|
||||||
echo "Arrays MOD_NAMES and MODS are not correctly filled, please check."
|
echo "Arrays MOD_NAMES and MODS are not correctly filled, please check."
|
||||||
@@ -73,9 +72,9 @@ function check_mod_names_and_mods_array_lengths () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
function replace_mods_value () {
|
function replace_mods_value () {
|
||||||
local -n MOD_ARRAY="$1"
|
MOD_ARRAY="$1"
|
||||||
local LINUXGSM_SERVER_CONFIG="/app/lgsm/config-lgsm/arma3server/arma3server.cfg"
|
LINUXGSM_SERVER_CONFIG="/app/lgsm/config-lgsm/arma3server/arma3server.cfg"
|
||||||
local MOD_LIST=""
|
MOD_LIST=""
|
||||||
|
|
||||||
if [[ ! -e "$LINUXGSM_SERVER_CONFIG" ]]; then
|
if [[ ! -e "$LINUXGSM_SERVER_CONFIG" ]]; then
|
||||||
echo "Error: File $LINUXGSM_SERVER_CONFIG does not exist."
|
echo "Error: File $LINUXGSM_SERVER_CONFIG does not exist."
|
||||||
@@ -87,14 +86,14 @@ function replace_mods_value () {
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Use sed to find the line and replace the current value of mods with the new string
|
# Use sed to find the line and replace the current value of mods with the new string
|
||||||
sed -i "s/^mods=\"[^\"]*\"/mods=\"$MOD_LIST\"/" "$LINUXGSM_SERVER_CONFIG"
|
sed -i "s/^mods=\".*\"$/mods=\"$MOD_LIST\"/g" $LINUXGSM_SERVER_CONFIG
|
||||||
|
|
||||||
echo "The mods value has been updated in $LINUXGSM_SERVER_CONFIG."
|
echo "The mods value has been updated in $LINUXGSM_SERVER_CONFIG."
|
||||||
};
|
};
|
||||||
|
|
||||||
function start () {
|
function start () {
|
||||||
local counter=1
|
counter=1
|
||||||
local maxtries=5
|
maxtries=5
|
||||||
check_mod_names_and_mods_array_lengths ${MOD_NAMES} ${MODS}
|
check_mod_names_and_mods_array_lengths ${MOD_NAMES} ${MODS}
|
||||||
remove_mod_signing_keys_from_server
|
remove_mod_signing_keys_from_server
|
||||||
steamcmd +login $STEAM_ACCT_USERNAME +quit # buffer steam login for mod download and update!
|
steamcmd +login $STEAM_ACCT_USERNAME +quit # buffer steam login for mod download and update!
|
||||||
@@ -111,8 +110,7 @@ function start () {
|
|||||||
apply_mod_signing_keys_to_server ${MOD_NAMES[$i]}
|
apply_mod_signing_keys_to_server ${MOD_NAMES[$i]}
|
||||||
sleep 5 # Prevent downloading too fast and getting rate limited.
|
sleep 5 # Prevent downloading too fast and getting rate limited.
|
||||||
done
|
done
|
||||||
check_and_fix_depth
|
replace_mods_value ${MOD_NAMES}
|
||||||
replace_mods_value ${MODS}
|
|
||||||
echo "Thank you for using Mod Downloader!"
|
echo "Thank you for using Mod Downloader!"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user