Ensure to restore all Steam directories

This commit is contained in:
Jeremy Gardais 2019-10-08 22:51:22 +02:00
parent f8e516c37c
commit 6bd9b1c6ac
1 changed files with 15 additions and 15 deletions

View File

@ -50,7 +50,7 @@ steam_userdata_games="760 35700 35720 55230 204360 206420 218820 247080 255870 3
### 686200 Door Kickers: Action Squad https://pcgamingwiki.com/wiki/Door_Kickers:_Action_Squad
steam_compatdata_games="686200"
# }}}
# List of Steam saves in steamapps to backup {{{
## List of Steam saves in steamapps to backup {{{
### 274190 Broforce https://pcgamingwiki.com/wiki/Broforce
# }}}
## Ids without backups in userdata {{{
@ -73,9 +73,6 @@ ignore_pattern_steam_id="(7|620|49520|55230|213670|219150|241100|242680|251470|2
## }}}
remote_dir="${HOME}/Nextcloud/games/linux.sgl.script"
remote_steam_userdata="${remote_dir}/${steam_userdata}"
local_steam_userdata="${HOME}/${steam_userdata}"
local_unmanaged_games_list="/tmp/unmanaged_games_list"
# }}}
@ -127,17 +124,20 @@ if [ ! -d "${remote_dir}" ]; then
exit 1
fi
## }}}
## Ensure Steam dir exist {{{
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]?"
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
## Ensure Steam directories exist {{{
for steam_dir in "${steam_userdata}" "${steam_compatdata}"; do
local_steam_path="${HOME}/${steam_dir}"
if [ ! -d "${local_steam_path}" ]; then
printf '\e[1;35m%-6s\e[m\n' "The Steam directory ${steam_dir} for your ID (${steam_id}) doesn't exists yet… Should it must be create (for restoration,…) [Y/n]?"
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_path}"
else
printf '\e[1;35m%-6s\e[m\n' "Steam directory (${steam_dir}) doesn't exists, abort script."
exit 2
fi
fi
fi
done
## }}}
# }}}
@ -200,7 +200,7 @@ for game_id in ${steam_compatdata_games}; do
done
# }}}
# List userdata unmanage game id {{{
cd -- "${local_steam_userdata}" || exit 1
cd -- "${HOME}/${steam_userdata}" || exit 1
rm -f -- "${local_unmanaged_games_list}"
find . -maxdepth 1 -type d | grep -vE "${ignore_pattern_steam_id}" > "${local_unmanaged_games_list}"
if [ -s "${local_unmanaged_games_list}" ]; then