scripts/save.game.link

37 lines
1.0 KiB
SYSTEMD
Raw Normal View History

#!/bin/sh
# Vars {{{
2019-10-05 20:05:14 +02:00
## Steam {{{
steam_id="112595584"
steam_userdata=".steam/steam/userdata/${steam_id}"
## }}}
remote_dir="${HOME}/Nextcloud/games/linux.sgl.script"
2019-10-05 20:05:14 +02:00
remote_steam_userdata="${remote_dir}/${steam_userdata}"
2019-10-05 20:05:14 +02:00
local_steam_userdata="${HOME}/${steam_userdata}"
# }}}
# 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 {{{
2019-10-05 20:05:14 +02:00
if [ ! -d "${local_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]?"
2019-10-05 20:05:14 +02:00
read -r create_local_steam_userdata
if [ "${create_local_steam_userdata}" = "" ] || [ "${create_local_steam_userdata}" = "Y" ] || [ "${create_local_steam_userdata}" = "y" ]; then
mkdir -p -- "${local_steam_userdata}"
else
printf '\e[1;35m%-6s\e[m\n' "Steam directory doesn't exists, abort script."
exit 2
fi
fi
## }}}
# }}}