2024-01-20 22:08:00 -08:00
|
|
|
#!/bin/bash
|
2024-01-19 19:35:32 +01:00
|
|
|
|
2024-01-20 22:08:00 -08:00
|
|
|
if [[ ! "${PUID}" -eq 0 ]] && [[ ! "${PGID}" -eq 0 ]]; then
|
2024-01-21 16:24:31 +01:00
|
|
|
printf "\e[0;32m*****EXECUTING USERMOD*****\e[0m\n"
|
2024-01-20 22:08:00 -08:00
|
|
|
usermod -o -u "${PUID}" steam
|
|
|
|
|
groupmod -o -g "${PGID}" steam
|
|
|
|
|
else
|
2024-01-21 16:24:31 +01:00
|
|
|
printf "\033[31mRunning as root is not supported, please fix your PUID and PGID!\n"
|
2024-01-20 22:08:00 -08:00
|
|
|
exit 1
|
|
|
|
|
fi
|
2024-01-19 14:58:51 +01:00
|
|
|
|
2024-01-24 18:10:24 +07:00
|
|
|
mkdir -p /palworld/backups
|
2024-01-19 14:58:51 +01:00
|
|
|
chown -R steam:steam /palworld
|
|
|
|
|
|
2024-01-19 19:35:32 +01:00
|
|
|
if [ "${UPDATE_ON_BOOT}" = true ]; then
|
2024-01-21 16:24:31 +01:00
|
|
|
printf "\e[0;32m*****STARTING INSTALL/UPDATE*****\e[0m\n"
|
2024-01-20 22:08:00 -08:00
|
|
|
su steam -c '/home/steam/steamcmd/steamcmd.sh +force_install_dir "/palworld" +login anonymous +app_update 2394010 validate +quit'
|
2024-01-19 19:35:32 +01:00
|
|
|
fi
|
2024-01-19 14:58:51 +01:00
|
|
|
|
2024-01-24 18:25:12 -05:00
|
|
|
term_handler() {
|
2024-01-25 18:23:14 +01:00
|
|
|
if [ "${RCON_ENABLED}" = true ]; then
|
2024-01-24 19:00:25 -05:00
|
|
|
rcon-cli save
|
2024-01-24 18:44:15 -05:00
|
|
|
rcon-cli shutdown 1
|
2024-01-24 19:08:04 -05:00
|
|
|
else # Does not save
|
2024-01-25 18:23:14 +01:00
|
|
|
kill -SIGTERM "$(pidof PalServer-Linux-Test)"
|
2024-01-24 18:44:15 -05:00
|
|
|
fi
|
2024-01-24 19:00:25 -05:00
|
|
|
tail --pid=$killpid -f 2>/dev/null
|
2024-01-24 18:25:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
trap 'term_handler' SIGTERM
|
|
|
|
|
|
|
|
|
|
./start.sh &
|
|
|
|
|
killpid="$!"
|
|
|
|
|
wait $killpid
|