Skip to content

Commit

Permalink
fix: Comeback of BepInEx 5.4.5 (#222)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinanrra authored Dec 12, 2023
1 parent 18e207b commit 55ac926
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ STOPSIGNAL SIGTERM

####Labels####
LABEL maintainer="vinanrra"
LABEL build_version="version: 0.6.1"
LABEL build_version="version: 0.6.2"

####Environments ####
ENV TimeZone=Europe/Madrid HOME=/home/sdtdserver LANG=en_US.utf8 TERM=xterm DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -93,6 +93,7 @@ ENV PUID=1000 PGID=1000 \
UNDEAD_LEGACY=no UNDEAD_LEGACY_VERSION=stable UNDEAD_LEGACY_UPDATE=no UNDEAD_LEGACY_URL=False \
ENZOMBIES=no ENZOMBIES_ADDON_SNUFKIN=no ENZOMBIES_ADDON_ROBELOTO=no ENZOMBIES_ADDON_NONUDES=no ENZOMBIES_UPDATE=no \
CPM=no CPM_UPDATE=no \
BEPINEX=no BEPINEX_UPDATE=no \
CHANGE_CONFIG_DIR_OWNERSHIP=YES \
DARKNESS_FALLS_URL=False DARKNESS_FALLS=no DARKNESS_FALLS_UPDATE=no

Expand Down
4 changes: 4 additions & 0 deletions docs/mods_support.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Remember that some mods can't be installed with others, if you have problems wit
- Environments:
- CPM
- CPM_UPDATE
- [BepInEz](https://github.com/BepInEx/BepInEx)
- Environments:
- BEPINEX
- BEPINEX_UPDATE
- [Darkness Falls](https://community.7daystodie.com/topic/4941-darkness-falls-they-mostly-come-out-at-night/)
- Environments:
- DARKNESS_FALLS
Expand Down
7 changes: 7 additions & 0 deletions docs/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@
| `CPM=NO` | Install [CPM](https://docs.csmm.app/en/cpm/), CPM version will be installed according to 7 days to die branch version, this will also install Allocs Fixes **optional** | YES, NO |
| `CPM_UPDATE=NO` | Update [CPM](https://docs.csmm.app/en/cpm/), CPM on every server start, depending of your 7 days to die version, requiere UPDATE_MODS=YES **optional** | YES, NO |

### BepInEx

| Parameter | Function | Values |
| --- | --- | :---: |
| `BEPINEX=NO` | Install [BEPINEX](https://github.com/BepInEx/BepInEx), latest BEPINEX version will be installed**optional** | YES, NO |
| `BEPINEX_UPDATE=NO` | Update [BEPINEX](https://github.com/BepInEx/BepInEx), BEPINEX on every server start, requiere UPDATE_MODS=YES **optional** | YES, NO |

### START MODES

| START_MODE | Information |
Expand Down
4 changes: 4 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ docker run -d \
-e ENZOMBIES_UPDATE=NO \
-e CPM=NO \
-e CPM_UPDATE=NO \
-e BEPINEX=NO \
-e BEPINEX_UPDATE=NO \
-e BACKUP=NO \
-e MONITOR=NO \
-e PUID=1000 \
Expand Down Expand Up @@ -78,6 +80,8 @@ services:
- ENZOMBIES_UPDATE=NO # Optional - Update EnZombies mod and addons before server start
- CPM=NO # Optional - CSMM Patron's Mod (CPM)
- CPM_UPDATE=NO # Optional - Update CPM before server start
- BEPINEX=NO # Optional - BepInEx
- BEPINEX_UPDATE=NO # Optional - Update BepInEx before server start
- BACKUP=NO # Optional - Backup server at 5 AM
- MONITOR=NO # Optional - Keeps server up if crash
volumes:
Expand Down
88 changes: 88 additions & 0 deletions scripts/Mods/bepinex.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash

BASEPATH="/home/sdtdserver"
SERVERFILES_FOLDER="${BASEPATH}/serverfiles"
BEPINEX_SH="${SERVERFILES_FOLDER}/run_bepinex.sh"
LSGMSDTDSERVERCFG="${BASEPATH}/lgsm/config-lgsm/sdtdserver/sdtdserver.cfg"

# Get latest version (Removed until fix https://github.com/BepInEx/BepInEx/issues/592)
#DL_LINK=$(curl -L -s https://api.github.com/repos/BepInEx/BepInEx/releases/latest | grep -o -E "https://github.com/BepInEx/BepInEx/releases/download/(.*)/BepInEx_unix_(.*).zip")
DL_LINK="https://github.com/BepInEx/BepInEx/releases/download/v5.4.5/BepInEx_unix_5.4.5.0.zip"

downloadRelease() {
curl "$DL_LINK" -SsL -o BepInEx.zip
}

echo "[BepInEx] Downloading release from ${DL_LINK}"

echo "[BepInEx] Downloading files"

downloadRelease

echo "[BepInEx] Extracting files"

mkdir -p BepInEx-temp
unzip -q BepInEx.zip -d BepInEx-temp

echo "[BepInEx] Removing older version"

rm -rf $SERVERFILES_FOLDER/BepInEx
rm -rf $SERVERFILES_FOLDER/doorstop_libs

echo "[BepInEx] Installing components"

cp -a BepInEx-temp/. $SERVERFILES_FOLDER

echo "[BepInEx] Editing run_bepinex.sh"

echo "[BepInEx] Editing executable_name"

if grep -q "7DaysToDieServer.x86_64" $BEPINEX_SH
then
echo "[BepInEx] Skiping executable_name changes, already replaced"
else
sed -i '/.*executable_name="".*/ s/""/"7DaysToDieServer.x86_64"/' $BEPINEX_SH
fi

echo "[BepInEx] Editing command last execution"

if grep -q "sdtdserver.xml" $BEPINEX_SH
then
sed -i '/.*config_file=""/ s/""/sdtdserver.xml/' $BEPINEX_SH
else
sed -i '/^.*NEEDED.*/a config_file="sdtdserver.xml"' $BEPINEX_SH
sed -i '/"${executable_path}"/ s/"${executable_path}"/"${executable_path}" -configfile=$config_file/' $BEPINEX_SH
fi

echo "[BepInEx] Fixing executable_type"

sed -i 's/executable_type=.*/executable_type=$(LD_PRELOAD="" file -b "${executable_path}")/' $BEPINEX_SH

echo "[BepInEx] Replacing start parameters for LinuxGSM"

if grep -q "startparameters" $LSGMSDTDSERVERCFG
then
sed -i 's/startparameters=.*/startparameters=""/' $LSGMSDTDSERVERCFG
else
echo startparameters='""' >> $LSGMSDTDSERVERCFG
fi

echo "[BepInEx] Replacing executable for LinuxGSM"

if grep -q "executable" $LSGMSDTDSERVERCFG
then
sed -i 's/executable=.*/executable=".\/run_bepinex.sh"/' $LSGMSDTDSERVERCFG
else
echo executable='"./run_bepinex.sh"' >> $LSGMSDTDSERVERCFG
fi

echo "[BepInEx] Applying executable permssions"

chmod u+x $BEPINEX_SH

echo "[BepInEx] Cleanup"

rm BepInEx.zip
rm -rf BepInEx-temp

echo "[BepInEx] Finished! ヽ(´▽\`)/"
4 changes: 4 additions & 0 deletions scripts/Mods/mods_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ if [ "${ENZOMBIES,,}" == 'yes' ]
source $scriptsDir/Mods/enZombies.sh
fi

if [ "${BEPINEX,,}" == 'yes' ] && [ "${UNDEAD_LEGACY,,}" == 'no' ]
then
source $scriptsDir/Mods/bepinex.sh
fi
5 changes: 5 additions & 0 deletions scripts/Mods/mods_update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ if [ "${ENZOMBIES,,}" == 'yes' ] && [ "${ENZOMBIES_UPDATE,,}" == 'yes' ]
source $scriptsDir/Mods/enZombies.sh
fi

if [ "${BEPINEX,,}" == 'yes' ] && [ "${BEPINEX_UPDATE,,}" == 'yes' ] && [ "${UNDEAD_LEGACY,,}" == 'no' ]
then
source $scriptsDir/Mods/bepinex.sh
fi

echo "[INFO] Updating/Installing mods finished"
7 changes: 7 additions & 0 deletions scripts/Mods/undead_legacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ if [ "${MIRROR_EXT}" == 'tar' ]; then
unzip -q "${MIRROR_FILE}" -d undeadlegacy-temp
fi

if [ -d "$SERVERFILES_FOLDER/BepInEx" ]
then
echo "[Undead Legacy] Removing existing BepInEx, because Undead Legacy already come with BepInEx"
rm -rf $SERVERFILES_FOLDER/BepInEx
rm -rf $SERVERFILES_FOLDER/doorstop_libs
fi

echo "[Undead Legacy] Installing mod"

if [ "${UNDEAD_LEGACY_VERSION}" == 'exp' ]; then
Expand Down

0 comments on commit 55ac926

Please sign in to comment.