If steam is enabled and this is the first boot, create the library config
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
|
||||
print_header "Configure Steam"
|
||||
|
||||
steam_autostart_desktop="$(cat <<EOF
|
||||
steam_autostart_desktop="$(
|
||||
cat <<EOF
|
||||
[Desktop Entry]
|
||||
Encoding=UTF-8
|
||||
Type=Application
|
||||
@@ -17,16 +18,45 @@ Hidden=false
|
||||
EOF
|
||||
)"
|
||||
|
||||
default_steam_library_config="$(
|
||||
cat <<EOF
|
||||
"libraryfolders"
|
||||
{
|
||||
"0"
|
||||
{
|
||||
"path" "/mnt/games"
|
||||
"label" "Games"
|
||||
"contentid" "5581753361318374545"
|
||||
"totalsize" "0"
|
||||
"update_clean_bytes_tally" "0"
|
||||
"time_last_update_verified" "0"
|
||||
"apps"
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)"
|
||||
|
||||
if [ "${ENABLE_STEAM:-}" = "true" ]; then
|
||||
if [ "${MODE}" == "s" ] | [ "${MODE}" == "secondary" ]; then
|
||||
if [ "${MODE}" == "s" ] || [ "${MODE}" == "secondary" ]; then
|
||||
print_step_header "Enable Steam supervisor.d service"
|
||||
sed -i 's|^autostart.*=.*$|autostart=true|' /etc/supervisor.d/steam.ini
|
||||
else
|
||||
print_step_header "Enable Steam auto-start script"
|
||||
mkdir -p "${USER_HOME:?}/.config/autostart"
|
||||
echo "${steam_autostart_desktop:?}" > "${USER_HOME:?}/.config/autostart/Steam.desktop"
|
||||
echo "${steam_autostart_desktop:?}" >"${USER_HOME:?}/.config/autostart/Steam.desktop"
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini
|
||||
fi
|
||||
|
||||
# Ensure Steam library folder is set to /mnt/games if not already
|
||||
LIBRARY_VDF="${USER_HOME:?}/.steam/steam/steamapps/libraryfolders.vdf"
|
||||
if [ ! -f "${LIBRARY_VDF}" ] || ! grep -q '"0"' "${LIBRARY_VDF}"; then
|
||||
print_step_header "Initializing Steam library folder"
|
||||
mkdir -p "$(dirname "${LIBRARY_VDF}")"
|
||||
echo "${default_steam_library_config}" >"${LIBRARY_VDF}"
|
||||
chown "${USER:?}:${USER:?}" "${LIBRARY_VDF}"
|
||||
fi
|
||||
else
|
||||
print_step_header "Disable Steam service"
|
||||
sed -i 's|^autostart.*=.*$|autostart=false|' /etc/supervisor.d/steam.ini
|
||||
|
||||
Reference in New Issue
Block a user