-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·62 lines (52 loc) · 1.44 KB
/
build.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
#!/usr/bin/env bash
# Install system dependencies
sudo apt-get update -y
sudo apt-get install -y --no-install-recommends \
python3 \
can-utils \
xterm \
at-spi2-core \
fonts-hack-ttf
# Reload fonts
fc-cache
# Increase user's permissions to use ip command
echo -e "\e[33mUNSAFE: Increasing user's permissions to use ip command...\e[0m"
# Ask the user if they want to continue
read -p "Do you want to continue? (y/n) " -n 1 -r
# Move to a new line
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "\e[32mIncreasing user's permissions to use ip command...\e[0m"
sudo chmod u+s /bin/ip
else
echo "Operation cancelled by user."
fi
# Install Python dependencies
python3 -m venv .env
source .env/bin/activate
python3 -m pip install -r requirements.txt
# Get the Zenite Solar's CAN_IDS protocol description file
wget https://raw.githubusercontent.com/ZeniteSolar/CAN_IDS/master/can_ids.json -O can_ids.json
# Generate the Simple Can Monitor service file
SERVICE_FILE=$PWD/simple_can_monitor.service
cat << EOF > $SERVICE_FILE
[Unit]
Description=Simple Can Monitor
After=default.target
[Service]
ExecStart=$PWD/run.sh
WorkingDirectory=$PWD
User=$USER
Environment="SPAWN_WINDOW=1"
Environment="DISPLAY=:0"
Restart=always
RestartSec=3
[Install]
WantedBy=default.target
EOF
echo "Service file '$SERVICE_FILE' generated."
# Install the systemd service
sudo systemctl link $SERVICE_FILE
sudo systemctl daemon-reload
sudo systemctl enable simple_can_monitor.service