-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathlutris-env
executable file
·71 lines (61 loc) · 1.68 KB
/
lutris-env
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
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -e
move() {
if [[ -e ~/.local/share/lutris.b ]]; then
echo "Destination already exists"
exit 2
fi
echo "Moving production files to a safe location"
mv ~/.local/share/lutris ~/.local/share/lutris.b
mv ~/.cache/lutris ~/.cache/lutris.b
mv ~/.config/lutris ~/.config/lutris.b
}
restore() {
if [[ ! -e ~/.local/share/lutris.b ]]; then
echo "Production files are already present"
exit 2
fi
if [[ -e ~/.local/share/lutris.test ]]; then
echo "Test files are already present"
exit 2
fi
echo "Saving test environment"
if [ -d ~/.local/share/lutris ]; then
mv ~/.local/share/lutris ~/.local/share/lutris.test
mv ~/.cache/lutris ~/.cache/lutris.test
mv ~/.config/lutris ~/.config/lutris.test
fi
echo "Restoring production settings"
mv ~/.local/share/lutris.b ~/.local/share/lutris
mv ~/.cache/lutris.b ~/.cache/lutris
mv ~/.config/lutris.b ~/.config/lutris
}
clean() {
echo "Clearing test environment"
rm -rf ~/.local/share/lutris.test
rm -rf ~/.cache/lutris.test
rm -rf ~/.config/lutris.test
}
info() {
du -h --max-depth=0 ~/.local/share/lutris*
du -h --max-depth=0 ~/.config/lutris*
du -h --max-depth=0 ~/.cache/lutris*
}
sql() {
sqliteman ~/.local/share/lutris/pga.db
}
reset() {
echo "Resetting environment"
restore
clean
move
}
help() {
echo "Commands:"
echo "move: Moves the lutris files to a safe directory"
echo "restore: Restores the original lutris files"
echo "clean: Remove the test environment"
echo "info: Prints the current setup"
echo "sql: opens the lutris db in sqliteman"
}
$1