Successfull move save of compatdata directory
This commit is contained in:
parent
6bd9b1c6ac
commit
4742f7f7f4
|
@ -43,12 +43,16 @@ steam_compatdata=".steam/steam/steamapps/compatdata"
|
||||||
### 359840 − Shift Happens − https://pcgamingwiki.com/wiki/Shift_Happens
|
### 359840 − Shift Happens − https://pcgamingwiki.com/wiki/Shift_Happens
|
||||||
steam_userdata_games="760 35700 35720 55230 204360 206420 218820 247080 255870 312530 359840"
|
steam_userdata_games="760 35700 35720 55230 204360 206420 218820 247080 255870 312530 359840"
|
||||||
## }}}
|
## }}}
|
||||||
# List of Steam saves in compatdata to backup {{{
|
## Pattern of Steam saves in compatdata to backup {{{
|
||||||
|
### Compatdata is the directory for games using Steam play so it's too big to
|
||||||
|
### be moved to a remote storage.
|
||||||
|
### Add the game id and the directory|file name to backup separated by a slash
|
||||||
|
### eg. GAME_ID/savedata.xml
|
||||||
### 213670 − South Park: The Stick of Truth − https://pcgamingwiki.com/wiki/South_Park:_The_Stick_of_Truth
|
### 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
|
### 359840 − Shift Happens − https://pcgamingwiki.com/wiki/Shift_Happens
|
||||||
### 480490 − Prey (2017) − https://pcgamingwiki.com/wiki/Prey_(2017)
|
### 480490 − Prey (2017) − https://pcgamingwiki.com/wiki/Prey_(2017)
|
||||||
### 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_pattern="686200/userdata.bin"
|
||||||
# }}}
|
# }}}
|
||||||
## 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
|
||||||
|
@ -171,28 +175,46 @@ for game_id in ${steam_userdata_games}; do
|
||||||
done
|
done
|
||||||
# }}}
|
# }}}
|
||||||
# Manage Steam compadata save game {{{
|
# Manage Steam compadata save game {{{
|
||||||
for game_id in ${steam_compatdata_games}; do
|
for game_pattern in ${steam_compatdata_games_pattern}; do
|
||||||
local_game_path="${HOME}/${steam_compatdata}/${game_id}"
|
## Separate the game_id and the directory|file to backup|symlink
|
||||||
local_game_path_type="$(file "${local_game_path}" | cut -d' ' -f2)"
|
game_id="$(echo ${game_pattern} | cut -d"/" -f1)"
|
||||||
|
save_pattern="$(echo ${game_pattern} | cut -d"/" -f2)"
|
||||||
|
|
||||||
case ${local_game_path_type} in
|
### Follow symbolic links but avoid links to dosdevices and keep only one result
|
||||||
|
temp_local_save_path="$(find -L "${HOME}/${steam_compatdata}/${game_id}" -ipath "*dosdevices*" -prune -o -iname "${save_pattern}" | grep -v "dosdevices" | head -n 1)"
|
||||||
|
local_save_path="$(dirname "${temp_local_save_path}")"
|
||||||
|
local_save_path_type="$(ls -ld "${local_save_path}" | sed 's/\(^.\).*/\1/')"
|
||||||
|
## Path independent from local or remote base directory
|
||||||
|
steam_dir="$(printf "%s" "${local_save_path}" | sed -e "s;${HOME}/;;")"
|
||||||
|
|
||||||
|
## Print vars {{{
|
||||||
|
#if [ "${debug}" -eq "0" ]; then
|
||||||
|
#printf '\e[1;35m%-6s\e[m\n' "DEBUG : game ID : ${game_id}"
|
||||||
|
#printf '\e[1;35m%-6s\e[m\n' "DEBUG : save pattern : ${save_pattern}"
|
||||||
|
#printf '\e[1;35m%-6s\e[m\n' "DEBUG : temp local save path : ${temp_local_save_path}"
|
||||||
|
#printf '\e[1;35m%-6s\e[m\n' "DEBUG : local save path : ${local_save_path}"
|
||||||
|
#printf '\e[1;35m%-6s\e[m\n' "DEBUG : local save type : ${local_save_path_type}"
|
||||||
|
#printf '\e[1;35m%-6s\e[m\n' "DEBUG : steam dir : ${steam_dir}"
|
||||||
|
#fi
|
||||||
|
## }}}
|
||||||
|
|
||||||
|
case ${local_save_path_type} in
|
||||||
## Data is already a symlink
|
## Data is already a symlink
|
||||||
"symbolic")
|
"symbolic"|"symboliclink"|"l")
|
||||||
[ "${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."
|
[ "${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
|
## Data is still a directory, try to move it
|
||||||
"directory")
|
"directory"|"d")
|
||||||
### TODO :
|
move_steam_game_dir "$(basename "${steam_dir}")" "$(dirname "${steam_dir}")"
|
||||||
printf '\e[1;35m%-6s\e[m\n' "Steam compatdata for loop − The data of ${game_id} − ${local_game_path} need to move."
|
|
||||||
;;
|
;;
|
||||||
## Data doesn't exist
|
## Data doesn't exist
|
||||||
"cannot")
|
"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."
|
[ "${debug}" -eq "0" ] && printf '\e[1;35m%-6s\e[m\n' "DEBUG : Steam compatdata for loop — The data of ${game_id} − ${local_save_path} doesn't exist. Skip."
|
||||||
### TODO : Try to symlink
|
### TODO : Try to symlink
|
||||||
;;
|
;;
|
||||||
## Data can't be managed
|
## Data can't be managed
|
||||||
*)
|
*)
|
||||||
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}")"
|
printf '\e[1;35m%-6s\e[m\n' "Data of ${game_id} (compatdata) − ${local_save_path} are not managed. Type: ${local_save_path_type}. Abort."
|
||||||
exit 3
|
exit 3
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue