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 ### 686200 Door Kickers: Action Squad https://pcgamingwiki.com/wiki/Door_Kickers:_Action_Squad
steam_compatdata_games="686200" 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 ### 274190 Broforce https://pcgamingwiki.com/wiki/Broforce
# }}} # }}}
## Ids without backups in userdata {{{ ## 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_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" local_unmanaged_games_list="/tmp/unmanaged_games_list"
# }}} # }}}
@ -127,17 +124,20 @@ if [ ! -d "${remote_dir}" ]; then
exit 1 exit 1
fi fi
## }}} ## }}}
## Ensure Steam dir exist {{{ ## Ensure Steam directories exist {{{
if [ ! -d "${local_steam_userdata}" ]; then for steam_dir in "${steam_userdata}" "${steam_compatdata}"; do
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]?" local_steam_path="${HOME}/${steam_dir}"
read -r create_local_steam_userdata if [ ! -d "${local_steam_path}" ]; then
if [ "${create_local_steam_userdata}" = "" ] || [ "${create_local_steam_userdata}" = "Y" ] || [ "${create_local_steam_userdata}" = "y" ]; 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]?"
mkdir -p -- "${local_steam_userdata}" read -r create_local_steam_userdata
else if [ "${create_local_steam_userdata}" = "" ] || [ "${create_local_steam_userdata}" = "Y" ] || [ "${create_local_steam_userdata}" = "y" ]; then
printf '\e[1;35m%-6s\e[m\n' "Steam directory doesn't exists, abort script." mkdir -p -- "${local_steam_path}"
exit 2 else
printf '\e[1;35m%-6s\e[m\n' "Steam directory (${steam_dir}) doesn't exists, abort script."
exit 2
fi
fi fi
fi done
## }}} ## }}}
# }}} # }}}
@ -200,7 +200,7 @@ for game_id in ${steam_compatdata_games}; do
done done
# }}} # }}}
# List userdata unmanage game id {{{ # List userdata unmanage game id {{{
cd -- "${local_steam_userdata}" || exit 1 cd -- "${HOME}/${steam_userdata}" || exit 1
rm -f -- "${local_unmanaged_games_list}" rm -f -- "${local_unmanaged_games_list}"
find . -maxdepth 1 -type d | grep -vE "${ignore_pattern_steam_id}" > "${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 if [ -s "${local_unmanaged_games_list}" ]; then