Add some sane defaults to Steam config

I can't imagine why we would not want compatibility on for all titles or why we would not want to have a good name and the correct path for the default library.
This commit is contained in:
Josh.5
2025-06-23 06:03:31 +00:00
parent e39756c3bf
commit 23e5ec9fa4

View File

@@ -18,15 +18,40 @@ Hidden=false
EOF EOF
)" )"
default_steam_config="$(
cat <<EOF
"InstallConfigStore"
{
"Software"
{
"Valve"
{
"Steam"
{
"CompatToolMapping"
{
"0"
{
"name" "proton_hotfix"
"config" ""
"priority" "75"
}
}
}
}
}
}
EOF
)"
default_steam_library_config="$( default_steam_library_config="$(
cat <<EOF cat <<EOF
"libraryfolders" "libraryfolders"
{ {
"0" "0"
{ {
"path" "/mnt/games" "path" "/home/default/.steam/steam"
"label" "Games" "label" "Home"
"contentid" "5581753361318374545"
"totalsize" "0" "totalsize" "0"
"update_clean_bytes_tally" "0" "update_clean_bytes_tally" "0"
"time_last_update_verified" "0" "time_last_update_verified" "0"
@@ -34,6 +59,28 @@ default_steam_library_config="$(
{ {
} }
} }
"1"
{
"path" "/mnt/games/GameLibrary/Steam"
"label" "Games"
"contentid" "4532270033051814356"
"totalsize" "0"
"update_clean_bytes_tally" "0"
"time_last_update_verified" "0"
"apps"
{
}
}
}
EOF
)"
games_steam_library_config="$(
cat <<EOF
"libraryfolder"
{
"contentid" "4532270033051814356"
"label" "Games"
} }
EOF EOF
)" )"
@@ -49,13 +96,35 @@ if [ "${ENABLE_STEAM:-}" = "true" ]; then
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini
fi fi
# Ensuring Steam Play is enabled for all titles
CONFIG_VDF="${USER_HOME:?}/.steam/steam/config/config.vdf"
if [ ! -f "${CONFIG_VDF}" ]; then
print_step_header "Initializing Steam config"
mkdir -p "$(dirname "${CONFIG_VDF}")"
echo "${default_steam_config}" >"${CONFIG_VDF}"
chown -R "${USER:?}:${USER:?}" "${USER_HOME:?}/.steam"
else
print_step_header "Steam config already exists, skipping initialization"
fi
# Ensure Steam library folder is set to /mnt/games if not already # Ensure Steam library folder is set to /mnt/games if not already
LIBRARY_VDF="${USER_HOME:?}/.steam/steam/steamapps/libraryfolders.vdf" LIBRARY_VDF="${USER_HOME:?}/.steam/steam/steamapps/libraryfolders.vdf"
if [ ! -f "${LIBRARY_VDF}" ] || ! grep -q '"0"' "${LIBRARY_VDF}"; then if [ ! -f "${LIBRARY_VDF}" ]; then
print_step_header "Initializing Steam library folder" print_step_header "Initializing Steam library"
mkdir -p "$(dirname "${LIBRARY_VDF}")" mkdir -p "$(dirname "${LIBRARY_VDF}")"
echo "${default_steam_library_config}" >"${LIBRARY_VDF}" echo "${default_steam_library_config}" >"${LIBRARY_VDF}"
chown "${USER:?}:${USER:?}" "${LIBRARY_VDF}" chown -R "${USER:?}:${USER:?}" "${USER_HOME:?}/.steam"
# Only if we have mounted a /mnt/games path, then make the default games library for steam
if [ -d "/mnt/games" ]; then
mkdir -p "/mnt/games/GameLibrary/Steam/steamapps"
chown "${USER:?}:${USER:?}" \
"/mnt/games/GameLibrary" \
"/mnt/games/GameLibrary/Steam" \
"/mnt/games/GameLibrary/Steam/steamapps"
echo "${games_steam_library_config}" >"/mnt/games/GameLibrary/Steam/libraryfolder.vdf"
fi
else
print_step_header "Steam library config already exists, skipping initialization"
fi fi
else else
print_step_header "Disable Steam service" print_step_header "Disable Steam service"