forked from JustTemmie/steam-presence
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstaller.sh
executable file
·76 lines (57 loc) · 2.36 KB
/
installer.sh
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
72
73
74
75
76
#!/bin/bash
echo "This script is LINUX ONLY, and it's still in testing phases, if you encounter any bugs please open an issue"
read -p "Press the enter key to continue..."
echo ""
# Check if script is running as root
if [ "$(id -u)" == "0" ]; then
echo "This script cannot be run as root. Please run as a regular user"
exit 1
fi
# Check if config.json file exists
if [ ! -f "config.json" ]; then
echo "Error: config.json file not found. Please make sure it exists in the current directory"
exit 1
fi
# Create steam-presence folder if it does not exist
if [ ! -d "$HOME/steam-presence" ]; then
mkdir -p "$HOME/steam-presence"
fi
echo "Creating symlinks of necessary files..."
# Create symlinks of necessary files
ln -s "$(pwd)/main.py" "$HOME/steam-presence/main.py"
ln -s "$(pwd)/config.json" "$HOME/steam-presence/config.json"
ln -s "$(pwd)/icons.txt" "$HOME/steam-presence/icons.txt"
ln -s "$(pwd)/requirements.txt" "$HOME/steam-presence/requirements.txt"
ln -s "$(pwd)/steam-presence.service" "$HOME/steam-presence/steam-presence.service"
# Create a symlink for games.txt if it exists
if [ -e "$(pwd)/games.txt" ]; then
ln -s "$(pwd)/games.txt" "$HOME/steam-presence/games.txt"
fi
# Create a symlink for gameIDs.json if it exists
if [ -e "$(pwd)/customGameIDs.json" ]; then
ln -s "$(pwd)/customGameIDs.json" "$HOME/steam-presence/customGameIDs.json"
fi
echo "Symlinks created."
# Change to steam-presence directory
cd "$HOME/steam-presence"
echo "Executing commands in steam-presence directory..."
# Execute commands in steam-presence directory
python3.10 -m venv .
./bin/python -m pip install --upgrade pip wheel
./bin/python -m pip install -r requirements.txt
echo ""
echo "Testing if the script works"
echo ""
timeout 2.5s ./bin/python ./main.py
echo "Test might've worked, did it spit out any errors?"
echo "Commands executed."
# Replace "deck" user with local username in steam-presence.service file
echo "Editing service file"
local_username=$(whoami)
sed -i "s/deck/$local_username/g" "$HOME/steam-presence/steam-presence.service"
echo "Starting service"
systemctl --user --now enable "$HOME/steam-presence/steam-presence.service"
echo "If you encountered any errors with this script, please create an issue on the GitHub page"
echo ""
echo "Script completed."
echo "If you ever want to check the status of the script, simply run \"systemctl --user status steam-presence\""