Add a 2nd arg to function to manage different paths
This commit is contained in:
parent
6274615d32
commit
76e7b10082
|
@ -29,7 +29,7 @@ steam_id="112595584"
|
|||
steam_userdata=".steam/steam/userdata/${steam_id}"
|
||||
steam_compatdata=".steam/steam/steamapps/compatdata"
|
||||
|
||||
## List of Steam games to backup {{{
|
||||
## List of Steam saves in userdata to backup {{{
|
||||
### 760 − Steam Screenshots − https://steamdb.info/app/760/
|
||||
### 35700 − Trine Enchanted Edition − https://pcgamingwiki.com/wiki/Trine_Enchanted_Edition
|
||||
### 35720 − Trine 2 Complete Story − https://pcgamingwiki.com/wiki/Trine_2
|
||||
|
@ -41,16 +41,16 @@ steam_compatdata=".steam/steam/steamapps/compatdata"
|
|||
### 255870 − PixelJunk Shooter − https://pcgamingwiki.com/wiki/PixelJunk_Shooter
|
||||
### 312530 − Duck Game − https://pcgamingwiki.com/wiki/Duck_Game
|
||||
### 359840 − Shift Happens − https://pcgamingwiki.com/wiki/Shift_Happens
|
||||
steam_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 {{{
|
||||
# List of Steam saves in compatdata to backup {{{
|
||||
### 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 {{{
|
||||
# List of Steam saves in steamapps to backup {{{
|
||||
### 274190 − Broforce − https://pcgamingwiki.com/wiki/Broforce
|
||||
# }}}
|
||||
## Ids without backups in userdata {{{
|
||||
|
@ -84,8 +84,9 @@ local_unmanaged_games_list="/tmp/unmanaged_games_list"
|
|||
# Move one Steam save game dir {{{
|
||||
move_steam_game_dir() {
|
||||
_game_id="${1}"
|
||||
_local_game_path="${local_steam_userdata}/${_game_id}"
|
||||
_remote_game_path="${remote_steam_userdata}/${_game_id}"
|
||||
_steam_dir="${2}"
|
||||
_local_game_path="${HOME}/${_steam_dir}/${_game_id}"
|
||||
_remote_game_path="${remote_dir}/${_steam_dir}/${_game_id}"
|
||||
|
||||
## If a remote directory doesn't already exists for this game
|
||||
if [ ! -d "${_remote_game_path}" ]; then
|
||||
|
@ -102,8 +103,9 @@ move_steam_game_dir() {
|
|||
# Symlink one Steam save game dir from remote to local {{{
|
||||
symlink_steam_game_dir() {
|
||||
_game_id="${1}"
|
||||
_local_game_path="${local_steam_userdata}/${_game_id}"
|
||||
_remote_game_path="${remote_steam_userdata}/${_game_id}"
|
||||
_steam_dir="${2}"
|
||||
_local_game_path="${HOME}/${_steam_dir}/${_game_id}"
|
||||
_remote_game_path="${remote_dir}/${_steam_dir}/${_game_id}"
|
||||
|
||||
if [ -d "${_remote_game_path}" ]; then
|
||||
ln -s -- "${_remote_game_path}" "${_local_game_path}"
|
||||
|
@ -140,9 +142,9 @@ fi
|
|||
# }}}
|
||||
|
||||
# Manage Steam userdata save 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)"
|
||||
for game_id in ${steam_userdata_games}; do
|
||||
local_game_path="${HOME}/${steam_userdata}/${game_id}"
|
||||
local_game_path_type="$(file ${local_game_path} | cut -d' ' -f2)"
|
||||
|
||||
case ${local_game_path_type} in
|
||||
## Data is already a symlink
|
||||
|
@ -151,13 +153,14 @@ for game_id in ${steam_games}; do
|
|||
;;
|
||||
## Data is still a directory
|
||||
"directory")
|
||||
move_steam_game_dir "${game_id}"
|
||||
move_steam_game_dir "${game_id}" "${steam_userdata}"
|
||||
;;
|
||||
## Data can't be managed
|
||||
## Data doesn't exist
|
||||
"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."
|
||||
symlink_steam_game_dir "${game_id}"
|
||||
symlink_steam_game_dir "${game_id}" "${steam_userdata}"
|
||||
;;
|
||||
## Data can't be managed
|
||||
*)
|
||||
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"
|
||||
exit 3
|
||||
|
@ -181,11 +184,12 @@ for game_id in ${steam_compatdata_games}; do
|
|||
### 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
|
||||
## Data doesn't exist
|
||||
"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
|
||||
;;
|
||||
## 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}")"
|
||||
exit 3
|
||||
|
|
Loading…
Reference in New Issue