scripts/save.game.link

32 lines
873 B
SYSTEMD
Raw Normal View History

#!/bin/sh
# Vars {{{
remote_dir="${HOME}/Nextcloud/games/linux.sgl.script"
steam_id="1"
steam_userdata="${HOME}/.steam/steam/userdata/${steam_id}"
# }}}
# Tests {{{
## Ensure remote dir exist {{{
if [ ! -d "${remote_dir}" ]; then
printf '\e[1;35m%-6s\e[m\n' "The directory for save game doesn't exists: ${remote_dir}"
exit 1
fi
## }}}
## Ensure Steam dir exist {{{
if [ ! -d "${steam_userdata}" ]; then
printf '\e[1;35m%-6s\e[m\n' "The Steam directory for your ID (${steam_id}) doesn't exists yet… Should it must be create (for restoration,…) [Y/n]?"
read -r create_steam_userdata
if [ "${create_steam_userdata}" = "" ] || [ "${create_steam_userdata}" = "Y" ] || [ "${create_steam_userdata}" = "y" ]; then
mkdir -p -- "${steam_userdata}"
else
printf '\e[1;35m%-6s\e[m\n' "Steam directory doesn't exists, abort script."
exit 2
fi
fi
## }}}
# }}}