-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·33 lines (28 loc) · 831 Bytes
/
install.sh
File metadata and controls
executable file
·33 lines (28 loc) · 831 Bytes
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
#!/bin/bash
if ! [[ -f "/usr/bin/python3" ]]
then
echo "No python3 found"
exit
fi
echo "Checking for PIP..."
if ! [[ $(dpkg -l |grep "^ii python3-pip ") ]]
then
echo "Installing python3 pip..."
sudo apt-get install python3-pip
fi
echo "Installing pip module 'pyserial'"
/usr/bin/python3 -m pip install pyserial
echo "Checking for FHEM installation..."
if [ -d "/opt/fhem" ]
then
read -p "Allow FHEM to run 'centronic-stick.py' as $USER? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
if ! sudo grep -E '^fhem.*centronic-stick.py' /etc/sudoers
then
sudo echo "# allow fhem user to execute centronic-stick.py as $USER" >> /etc/sudoers
sudo echo "fhem ALL=($USER) NOPASSWD: $PWD/centronic-stick.py" >> /etc/sudoers
fi
fi
fi
echo "Installation completed"