Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@pythoninthegrass
Last active December 24, 2022 19:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pythoninthegrass/e08d2911f37fde21f496abe987b83cec to your computer and use it in GitHub Desktop.
Save pythoninthegrass/e08d2911f37fde21f496abe987b83cec to your computer and use it in GitHub Desktop.
Backup local Steam Deck save files via ludusavi and rclone
# /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
# /usr/lib/systemd/system/backup-saves.timer
[Unit]
Description=Backup saves scheduling
[Timer]
OnBootSec=1min
OnUnitActiveSec=30min
[Install]
WantedBy=multi-user.target
#!/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