Merge branch 'master' of github.com:pimoroni/enviroplus-python
[EVA-2020-02-2.git] / uninstall.sh
1 #!/bin/bash
2
3 LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'`
4 LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'`
5
6 printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Uninstaller\n\n"
7
8 if [ $(id -u) -ne 0 ]; then
9 printf "Script must be run as root. Try 'sudo ./uninstall.sh'\n"
10 exit 1
11 fi
12
13 cd library
14
15 printf "Unnstalling for Python 2..\n"
16 pip uninstall $LIBRARY_NAME
17
18 if [ -f "/usr/bin/pip3" ]; then
19 printf "Uninstalling for Python 3..\n"
20 pip3 uninstall $LIBRARY_NAME
21 fi
22
23 cd ..
24
25 printf "Disabling serial..\n"
26 # Enable serial terminal over /dev/ttyAMA0
27 raspi-config nonint do_serial 0
28 # Disable serial port
29 raspi-config nonint set_config_var enable_uart 0 /boot/config.txt
30 # Switch serial port back to miniUART
31 sed -i 's/^dtoverlay=pi3-miniuart-bt/#dtoverlay=pi3-miniuart-bt/' /boot/config.txt
32
33 printf "Done!\n"