-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall-gui.sh
60 lines (48 loc) · 1.72 KB
/
install-gui.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
#!/bin/bash
# github.com/douxxu | git.douxx.tech/piwave-webgui
print_magenta() {
echo -e "\e[35m$1\e[0m"
}
check_status() {
if [ $? -ne 0 ]; then
echo -e "\e[31mError: $1 failed\e[0m"
exit 1
fi
}
print_magenta "
____ __ __ _ ____ _ _ ___
| _ \\__ __ \\ \\ / /__| |__ / ___| | | |_ _|
| |_) \\ \\ /\\ / / \\ \\ /\\ / / _ \\ '_ \\| | _| | | || |
| __/ \\ V V / \\ V V / __/ |_) | |_| | |_| || |
|_| \\_/\\_/ \\_/\\_/ \\___|_.__/ \\____|\\___/|___|
"
echo "Creating directory for PiWave WebGUI..."
CLONE_DIR="$HOME/piwave-webgui"
REPO_URL="https://github.com/douxxu/piwave-webgui"
if [ ! -d "$CLONE_DIR" ]; then
mkdir -p "$CLONE_DIR"
check_status "Creating directory $CLONE_DIR"
else
echo "Directory $CLONE_DIR already exists. Skipping creation."
fi
echo "Installing Flask..."
sudo apt install -y python3-flask
check_status "Installing PiWave"
echo "Cloning PiWave WebGUI repository into $CLONE_DIR..."
git clone "$REPO_URL" "$CLONE_DIR"
check_status "Cloning PiWave WebGUI repository"
echo "Creating aliases in .bashrc..."
if [ -f "$HOME/.bashrc" ]; then
echo -e "\n# PiWave WebGUI Aliases" >> ~/.bashrc
echo "alias pw-webgui='sudo python3 ${CLONE_DIR}/server.py'" >> ~/.bashrc
echo "alias pw-webgui-config='nano ${CLONE_DIR}/piwave.conf'" >> ~/.bashrc
check_status "Appending aliases to .bashrc"
source ~/.bashrc
else
echo -e "\e[31mError: ~/.bashrc not found. Please create it manually.\e[0m"
exit 1
fi
echo "Setup ended. You can now use the following commands AS ROOT:"
echo " - pw-webgui: Start the PiWave WebGUI server."
echo " - pw-webgui-config: Edit the PiWave configuration file."
echo "The repository was cloned into $CLONE_DIR."