diff --git a/save.game.link b/save.game.link index 2fe0479..159f133 100755 --- a/save.game.link +++ b/save.game.link @@ -1,9 +1,15 @@ #!/bin/sh # Vars {{{ +debug=0 + ## Steam {{{ steam_id="112595584" steam_userdata=".steam/steam/userdata/${steam_id}" + +## List of Steam games to backup +### 204360 − Castle Crashers − https://pcgamingwiki.com/wiki/Castle_Crashers +steam_games="1 204360 17" ## }}} remote_dir="${HOME}/Nextcloud/games/linux.sgl.script" @@ -34,3 +40,30 @@ fi ## }}} # }}} + +# Manage steam game +for game_id in ${steam_games}; do + local_game_path="${local_steam_userdata}/${game_id}" + local_game_path_type="$(file ${local_steam_userdata}/${game_id} | cut -d' ' -f2)" + + + case ${local_game_path_type} in + ## Data is already a symlink + "symbolic") + [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam for loop — The data of ${game_id} are already symlinked to .... Skip." + ;; + ## Data is still a directory + "directory") + move_steam_game_dir "${game_id}" + ;; + ## Data can't be managed + "cannot") + [ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam for loop — The data of ${game_id} − ${local_game_path} doesn't exist. Skip." + ;; + *) + printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} − ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort" + exit 3 + ;; + esac + +done