Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
AngeIo committed Nov 6, 2022
0 parents commit fa0f54c
Show file tree
Hide file tree
Showing 4 changed files with 575 additions and 0 deletions.
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <https://unlicense.org>
152 changes: 152 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# Steam BKUPER
This script is designed to backup all Steam game save files automatically (optimized for Steam Deck).
## Why this script?
I played a lot on my Steam Deck. One day, I left my console charging all night and when I wanted to get back in game, the OS refused to boot and I was stuck on BIOS. The SSD decided to stop working.
I was a bit worried at first, but then I realised that my game saves should be safe in the Steam Cloud.

But, of course, **I was wrong**.

Why? Because some games do not provide Steam Cloud, like `Just Cause 3`.

I created this script to prevent this from happening one more time and loosing my saves once more.
## Features
- [x] Use Git for backup versioning
- [x] While game is starting and when game is closed, do a backup
- [x] Automatic
## Prerequisites
- Tested on Steam OS 3.0 (Arch Linux) but could be working on other distros
- Git
- ...?
## Usage
### (Optional) Connect to your Steam Deck
If you want to easily access your Steam Deck from your main computer, follow these steps :

You have to create a password before you can access your console with SSH.
First, switch to Desktop Mode, then open the terminal called `Konsole`.
Type this command to define your new password :
```
passwd
```
Now start SSH service and type your password :
```
sudo systemctl start sshd
```
Enable the SSH service so it stays up even after a reboot of the Steam Deck (make it accessible while in Game Mode too!) :
```
sudo systemctl enable sshd
```
For more information, you can check this FAQ from Valve : https://help.steampowered.com/en/faqs/view/671A-4453-E8D2-323C
### Download required files
#### Ludusavi
Tested with version `0.10.0` of `ludusavi`, may work with latest.
Go to the exact path with cd then download and extract archive to get `ludusavi` binary :
```
cd /home/deck/Documents/bin
wget https://github.com/mtkennerly/ludusavi/releases/download/v0.10.0/ludusavi-v0.10.0-linux.zip
unzip ludusavi-v0.10.0-linux.zip
rm ludusavi-v0.10.0-linux.zip
```
`ludusavi` binary exact location is now `/home/deck/Documents/bin/ludusavi`.
#### This repo
I suggest going to this exact path and clone the repo :
```
# If the path below does not exist, create it first with this command
# mkdir -p /home/deck/Documents/gitrepo
cd /home/deck/Documents/gitrepo
git clone https://github.com/AngeIo/steam-bkuper
cd steam-bkuper
```
Then copy the files to the right location :
```
cp my-steam-backup.sh git-sync /home/deck/Documents/bin/
```
Give execution permission to these files :
```
chmod -R 755 /home/deck/Documents/bin
```
Now we can delete the repo :
```
cd /home/deck/Documents/gitrepo
rm -rf /home/deck/Documents/gitrepo/steam-bkuper
```
### Set up Git repo for backups
Create a new repo on GitLab, GitHub, or both.
In my example, this repo is called `steam-saves`.
Then, if you have multiple remote repos, you can link them to the main one like below if you want to store your backups on multiple locations (configured for 2 repos by default, one named `origin` and the other `origin-new`).
```
git remote add origin-new https://gitlab.com/AngeIo/steam-saves.git
```
/!\ Please use the same branch name as above `origin-new` so it matches with `git-sync` script or you'll need to modify it too.
Check that the git remote repos are correctly setup :
```
git remote -v
```
The output should look like this if done correctly :
```
(deck@asundeck steam-saves)$ git remote -v
origin https://github.com/AngeIo/steam-saves.git (fetch)
origin https://github.com/AngeIo/steam-saves.git (push)
origin-new https://gitlab.com/AngeIo/steam-saves.git (fetch)
origin-new https://gitlab.com/AngeIo/steam-saves.git (push)
(deck@asundeck steam-saves)$
```
### Apply script to games
Add to each game's "Launch Options" the command below :
#### Backup after game is closed (recommended)
```
%command% ; /home/deck/Documents/bin/my-steam-backup.sh
```
#### Backup while the game is starting
```
/home/deck/Documents/bin/my-steam-backup.sh ; %command%
```
#### Backup while the game is starting and after the game is closed
```
/home/deck/Documents/bin/my-steam-backup.sh ; %command% ; /home/deck/Documents/bin/my-steam-backup.sh
```
### Make sure everything is working
Start a game with Launch Options configured.
Close it.
Check your remote Git repository (GitHub, GitLab, etc.) if the folder `/home/deck/Documents/gitrepo/steam-saves/ludusavi-backup` is populated with your save files then congratulations! You are now safe from any defects your Steam Deck/PC may encounter!
### Final file tree
Here is what your folders should look like in `/home/deck/Documents` :
```
(deck@asundeck Documents)$ tree
.
├── bin
│   ├── git-sync
│   ├── ludusavi
│   └── my-steam-backup.sh
└── gitrepo
└── steam-saves [Git repo containing your backups]
├── ludusavi-backup
│   ├── Alien_ Isolation
│   │   ├── drive-0
│   │   │   └── home
│   │   │   └── deck
│   │   └── mapping.yaml
[...]
│   └── Uno (2016)
│   ├── drive-0
│   │   └── home
│   │   └── deck
│   └── mapping.yaml
├── README.md
└── typescript
XX directories, XX files
(deck@asundeck Documents)$
```
## Roadmap
- [ ] Use variables/env to modify paths, script names, etc. and prevent users to modify script directly
- [ ] Create an all-in-one script so it's easier to install for users
- [ ] Find a way to loop through all game's Launch Options and add the command automatically
## Contribution
I know this script is far from perfect (school projects takes a lot of my time), that's why you can create pull requests if you wish to improve this script.
Thanks!
## Credits
- Matthew Kennerly and contributors for `ludusavi`
- Simon Thum and contributors for `git-sync`
- Angelo
Loading

0 comments on commit fa0f54c

Please sign in to comment.