Backup local Steam Deck save files via ludusavi and rclone
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/lib/systemd/system/backup-saves.service | |
[Unit] | |
Description=Run ludusavi then rsync to offsite backup | |
[Service] | |
Type=simple | |
ExecStart=bash /home/deck/backup_saves.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /usr/lib/systemd/system/backup-saves.timer | |
[Unit] | |
Description=Backup saves scheduling | |
[Timer] | |
OnBootSec=1min | |
OnUnitActiveSec=30min | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# sudo systemctl enable backup-saves.timer | |
# sudo systemctl start backup-saves.timer | |
# get latest version | |
newest=$(curl -sL https://api.github.com/repos/mtkennerly/ludusavi/tags | jq -r '.[0].name' | tr -d "v") | |
# get installed version | |
current=$(ludusavi --version | awk '{print $NF}') | |
# download latest release | |
if (( $(echo "$newest" "$current" | awk '{if ($1 > $2) print 1;}') )); then | |
echo "Downloading newest release: $newest" | |
url=$(curl -sS -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/mtkennerly/ludusavi/releases/latest | jq .assets[1].browser_download_url | xargs) | |
cd /tmp && curl -LJO "$url" | |
unzip "/tmp/ludusavi-v${newest}-linux.zip" | |
chmod +x /tmp/ludusavi | |
mv /tmp/ludusavi /usr/local/bin/ | |
rm "/tmp/ludusavi-v${newest}-linux.zip" | |
else | |
echo "Newest version is already installed: $current" | |
fi | |
# backup save files | |
# # * See `~/.config/ludusavi/config.yaml` | |
echo "Backing up saves" | |
ludusavi backup --force >/dev/null 2>&1 | |
# upload to google drive | |
# # * See `~/.config/rclone/rclone.conf` | |
echo "Syncing to Google Drive" | |
rclone sync --fast-list /home/deck/ludusavi_backup drive:Backup/steam/deck | |
[[ $? = 0 ]] && echo "Successfully backed up to Google drive!" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment