-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathnoita_backup
More file actions
executable file
·61 lines (54 loc) · 1.03 KB
/
noita_backup
File metadata and controls
executable file
·61 lines (54 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/sh
### manage my noita backups
SAVE_DIR="$HOME/.steam/steam/steamapps/compatdata/881100/pfx/drive_c/users/steamuser/AppData/LocalLow/Nolla_Games_Noita/"
SAVE_NAME="save00_$2.bck"
backup() {
printf "Backup? [Y/n] "
read -r ans
if [ ! "$ans" ] || [ "$ans" = "Y" ] || [ "$ans" = "y" ]; then
if test -d "$SAVE_DIR$SAVE_NAME"; then
rm -r "$SAVE_DIR$SAVE_NAME"
fi
cp -r "$SAVE_DIR/save00" "$SAVE_DIR$SAVE_NAME"
echo "Done"
else
echo "Aborted"
exit 1
fi
}
restore() {
printf "Restore? [Y/n] "
read -r ans
if [ ! "$ans" ] || [ "$ans" = "Y" ] || [ "$ans" = "y" ]; then
if ! test -d "$SAVE_DIR$SAVE_NAME"; then
echo "No such save. Aborting.."
exit 1
fi
if test -d "$SAVE_DIR/save00"; then
rm -r "$SAVE_DIR/save00"
fi
cp -r "$SAVE_DIR$SAVE_NAME" "$SAVE_DIR/save00"
echo "Done"
else
echo "Aborted"
exit 1
fi
}
list() {
ls -lA "$SAVE_DIR"
}
case $1 in
"-b")
backup
;;
"-l")
list
;;
"-r")
restore
;;
*)
echo "No op given."
backup
;;
esac