31 lines
1.3 KiB
Plaintext
Executable File
31 lines
1.3 KiB
Plaintext
Executable File
#!/command/with-contenv /bin/sh
|
|
# SPDX-FileCopyrightText: 2022 - 2023 Daniel Wolf <nephatrine@gmail.com>
|
|
#
|
|
# SPDX-License-Identifier: ISC
|
|
|
|
if [ -d /opt/quake2/openffa/highscores ]; then
|
|
if [ -z "${QUAKE2_DATA}" ]; then
|
|
if [ -n "${QUAKE2_INSTALL}" ] && [ ! "${QUAKE2_INSTALL}" = "true" ] && [ ! "${QUAKE2_INSTALL}" = "false" ]; then
|
|
export QUAKE2_DATA="${QUAKE2_INSTALL}"
|
|
else
|
|
export QUAKE2_DATA="/mnt/config"
|
|
fi
|
|
fi
|
|
if [ -z "${QUAKE2_DATA_SUBPATH}" ]; then
|
|
export QUAKE2_DATA_SUBPATH=/data/quake2
|
|
fi
|
|
if [[ ! -d "${QUAKE2_DATA}${QUAKE2_DATA_SUBPATH}/openffa/highscores" ]]; then
|
|
/command/s6-setuidgid guardian /bin/mkdir -p "${QUAKE2_DATA}${QUAKE2_DATA_SUBPATH}/openffa/highscores"
|
|
if [[ -d "${QUAKE2_DATA}${QUAKE2_DATA_SUBPATH}/openffa/highscores" ]]; then
|
|
/command/s6-setuidgid guardian /bin/cp -Rv /opt/quake2/openffa/highscores/. "${QUAKE2_DATA}${QUAKE2_DATA_SUBPATH}/openffa/highscores/"
|
|
/bin/rm -rf /opt/quake2/openffa/highscores
|
|
fi
|
|
fi
|
|
fi
|
|
if /usr/bin/pgrep -f quakedock >/dev/null; then
|
|
/command/s6-setuidgid guardian /usr/bin/screen -S quakedock -X stuff "$(/bin/echo -ne \"say QUAKE II SERVER SHUTTING DOWN!\r\")"
|
|
sleep 6
|
|
/command/s6-setuidgid guardian /usr/bin/screen -S quakedock -X stuff "$(/bin/echo -ne \"quit\r\")"
|
|
sleep 2
|
|
fi
|