Prepare loop for compatdata save game

This commit is contained in:
Jeremy Gardais 2019-10-08 18:22:44 +02:00
parent b23fb57850
commit b43e40d9a1
1 changed files with 44 additions and 10 deletions

View File

@ -27,11 +27,13 @@ debug=0
## Steam {{{ ## Steam {{{
steam_id="112595584" steam_id="112595584"
steam_userdata=".steam/steam/userdata/${steam_id}" steam_userdata=".steam/steam/userdata/${steam_id}"
steam_compatdata=".steam/steam/steamapps/compatdata"
## List of Steam games to backup {{{ ## List of Steam games to backup {{{
### 760 Steam Screenshots https://steamdb.info/app/760/ ### 760 Steam Screenshots https://steamdb.info/app/760/
### 35700 Trine Enchanted Edition https://pcgamingwiki.com/wiki/Trine_Enchanted_Edition ### 35700 Trine Enchanted Edition https://pcgamingwiki.com/wiki/Trine_Enchanted_Edition
### 35720 Trine 2 Complete Story https://pcgamingwiki.com/wiki/Trine_2 ### 35720 Trine 2 Complete Story https://pcgamingwiki.com/wiki/Trine_2
### 55230 Saints Row: The Third https://pcgamingwiki.com/wiki/Saints_Row:_The_Third
### 204360 Castle Crashers https://pcgamingwiki.com/wiki/Castle_Crashers ### 204360 Castle Crashers https://pcgamingwiki.com/wiki/Castle_Crashers
### 206420 Saints Row IV https://pcgamingwiki.com/wiki/Saints_Row_IV ### 206420 Saints Row IV https://pcgamingwiki.com/wiki/Saints_Row_IV
### 218820 Mercenary Kings https://pcgamingwiki.com/wiki/Mercenary_Kings ### 218820 Mercenary Kings https://pcgamingwiki.com/wiki/Mercenary_Kings
@ -39,27 +41,31 @@ steam_userdata=".steam/steam/userdata/${steam_id}"
### 255870 PixelJunk Shooter https://pcgamingwiki.com/wiki/PixelJunk_Shooter ### 255870 PixelJunk Shooter https://pcgamingwiki.com/wiki/PixelJunk_Shooter
### 312530 Duck Game https://pcgamingwiki.com/wiki/Duck_Game ### 312530 Duck Game https://pcgamingwiki.com/wiki/Duck_Game
### 359840 Shift Happens https://pcgamingwiki.com/wiki/Shift_Happens ### 359840 Shift Happens https://pcgamingwiki.com/wiki/Shift_Happens
steam_games="760 35700 35720 204360 206420 218820 247080 255870 312530 359840" steam_games="760 35700 35720 55230 204360 206420 218820 247080 255870 312530 359840"
## }}} ## }}}
# List of Steam saves in compatdata {{{
### 213670 South Park: The Stick of Truth https://pcgamingwiki.com/wiki/South_Park:_The_Stick_of_Truth
### 359840 Shift Happens https://pcgamingwiki.com/wiki/Shift_Happens
### 480490 Prey (2017) https://pcgamingwiki.com/wiki/Prey_(2017)
### 686200 Door Kickers: Action Squad https://pcgamingwiki.com/wiki/Door_Kickers:_Action_Squad
steam_compatdata_games="686200"
# }}}
# List of Steam saves in steamapps {{{
### 274190 Broforce https://pcgamingwiki.com/wiki/Broforce
# }}}
## Ids without backups in userdata {{{ ## Ids without backups in userdata {{{
### 7 Unknown ### 7 Unknown
### 620 Portal 2 https://pcgamingwiki.com/wiki/Portal_2 ### 620 Portal 2 https://pcgamingwiki.com/wiki/Portal_2
### 49520 Borderlands 2 https://pcgamingwiki.com/wiki/Borderlands_2 ### 49520 Borderlands 2 https://pcgamingwiki.com/wiki/Borderlands_2
### 55230 Saints Row: The Third https://pcgamingwiki.com/wiki/Saints_Row:_The_Third
### 213670 South Park: The Stick of Truth https://pcgamingwiki.com/wiki/South_Park:_The_Stick_of_Truth
### 219150 Hotline Miami https://pcgamingwiki.com/wiki/Hotline_Miami ### 219150 Hotline Miami https://pcgamingwiki.com/wiki/Hotline_Miami
### 241100 Steam Controller Configs https://steamdb.info/app/241100/ ### 241100 Steam Controller Configs https://steamdb.info/app/241100/
### 242680 Nuclear Throne https://pcgamingwiki.com/wiki/Nuclear_Throne ### 242680 Nuclear Throne https://pcgamingwiki.com/wiki/Nuclear_Throne
### 251470 TowerFall Ascension https://pcgamingwiki.com/wiki/TowerFall_Ascension ### 251470 TowerFall Ascension https://pcgamingwiki.com/wiki/TowerFall_Ascension
### 255870 PixelJunk Shooter https://pcgamingwiki.com/wiki/PixelJunk_Shooter ### 255870 PixelJunk Shooter https://pcgamingwiki.com/wiki/PixelJunk_Shooter
### 268990 The Dishwasher: Vampire Smile https://pcgamingwiki.com/wiki/The_Dishwasher:_Vampire_Smile ### 268990 The Dishwasher: Vampire Smile https://pcgamingwiki.com/wiki/The_Dishwasher:_Vampire_Smile
### 274190 Broforce https://pcgamingwiki.com/wiki/Broforce
### 295790 Never Alone https://pcgamingwiki.com/wiki/Never_Alone ### 295790 Never Alone https://pcgamingwiki.com/wiki/Never_Alone
### 359840 Shift Happens https://pcgamingwiki.com/wiki/Shift_Happens
### 416600 Full Metal Furies https://pcgamingwiki.com/wiki/Full_Metal_Furies ### 416600 Full Metal Furies https://pcgamingwiki.com/wiki/Full_Metal_Furies
### 474210 Butcher https://pcgamingwiki.com/wiki/Butcher ### 474210 Butcher https://pcgamingwiki.com/wiki/Butcher
### 480490 Prey (2017) https://pcgamingwiki.com/wiki/Prey_(2017)
### 686200 Door Kickers: Action Squad https://pcgamingwiki.com/wiki/Door_Kickers:_Action_Squad
### 697660 Jump Gunners https://pcgamingwiki.com/wiki/Jump_Gunners ### 697660 Jump Gunners https://pcgamingwiki.com/wiki/Jump_Gunners
### 728880 Overcooked! 2 https://pcgamingwiki.com/wiki/Overcooked!_2 ### 728880 Overcooked! 2 https://pcgamingwiki.com/wiki/Overcooked!_2
ignore_pattern_steam_id="(7|620|49520|55230|213670|219150|241100|242680|251470|255870|268990|274190|295790|416600|474210|480490|686200|697660|728880|config|ugc|ugcmsgcache|\.)$" ignore_pattern_steam_id="(7|620|49520|55230|213670|219150|241100|242680|251470|255870|268990|274190|295790|416600|474210|480490|686200|697660|728880|config|ugc|ugcmsgcache|\.)$"
@ -133,7 +139,7 @@ fi
# }}} # }}}
# Manage Steam save game {{{ # Manage Steam userdata save game {{{
for game_id in ${steam_games}; do for game_id in ${steam_games}; do
local_game_path="${local_steam_userdata}/${game_id}" local_game_path="${local_steam_userdata}/${game_id}"
local_game_path_type="$(file ${local_steam_userdata}/${game_id} | cut -d' ' -f2)" local_game_path_type="$(file ${local_steam_userdata}/${game_id} | cut -d' ' -f2)"
@ -153,7 +159,7 @@ for game_id in ${steam_games}; do
symlink_steam_game_dir "${game_id}" symlink_steam_game_dir "${game_id}"
;; ;;
*) *)
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort" printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} (userdata) ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"
# TODO: why test twice the last game_id and exit on symbolic link… # TODO: why test twice the last game_id and exit on symbolic link…
#exit 3 #exit 3
;; ;;
@ -161,7 +167,35 @@ for game_id in ${steam_games}; do
done done
# }}} # }}}
# List unmanage game id {{{ # Manage Steam compadata save game {{{
for game_id in ${steam_compatdata_games}; do
local_game_path="${HOME}/${steam_compatdata}/${game_id}"
local_game_path_type="$(file "${local_game_path}" | 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 compatdata for loop — The data of ${game_id} are already symlinked to .... Skip."
;;
## Data is still a directory, try to move it
"directory")
### TODO:
printf '\e[1;35m%-6s\e[m\n' "Steam compatdata for loop The data of ${game_id} ${local_game_path} need to move."
;;
## Data can't be managed
"cannot")
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG: Steam compatdata for loop — The data of ${game_id} ${local_game_path} doesn't exist. Skip."
### TODO: Try to symlink
;;
*)
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} (compatdata) ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort: $(file "${local_game_path}")"
exit 3
;;
esac
done
# }}}
# List userdata unmanage game id {{{
cd -- "${local_steam_userdata}" || exit 1 cd -- "${local_steam_userdata}" || exit 1
rm -f -- "${local_unmanaged_games_list}" rm -f -- "${local_unmanaged_games_list}"
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort" printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} ${local_game_path} are not managed. Type: ${local_game_path_type}. Abort"