45 lines
1.2 KiB
Bash
45 lines
1.2 KiB
Bash
#!/bin/sh
|
|
set -eu
|
|
|
|
prepare_volume() {
|
|
path="$1"
|
|
marker="$path/.progression-root-volume-ready"
|
|
mkdir -p "$path"
|
|
if [ ! -e "$marker" ]; then
|
|
echo "Preparing persistent volume for the container user: $path"
|
|
chown -R 0:0 "$path"
|
|
touch "$marker"
|
|
fi
|
|
}
|
|
|
|
prepare_steam_volume() {
|
|
path="$1"
|
|
marker="$path/.progression-steam-owner-v2"
|
|
|
|
# SteamCMD starts as root in this container, but its Linux filesystem
|
|
# workers use the account that owns the SteamCMD installation. Keep both
|
|
# its HOME and Workshop library writable by that account.
|
|
mkdir -p \
|
|
/home/progression/Steam/logs \
|
|
"$path/workshop/content/294100"
|
|
chown -R progression:progression /home/progression
|
|
|
|
if [ ! -e "$marker" ]; then
|
|
echo "Preparing persistent Steam library for SteamCMD: $path"
|
|
chown -R progression:progression "$path"
|
|
touch "$marker"
|
|
chown progression:progression "$marker"
|
|
else
|
|
chown progression:progression \
|
|
"$path" \
|
|
"$path/workshop" \
|
|
"$path/workshop/content" \
|
|
"$path/workshop/content/294100"
|
|
fi
|
|
}
|
|
|
|
prepare_volume /srv/progression/.data
|
|
prepare_steam_volume /srv/steam-library/steamapps
|
|
|
|
exec "$@"
|