doing some testing
This commit is contained in:
		
							
								
								
									
										98
									
								
								prototype.sh
									
									
									
									
									
								
							
							
						
						
									
										98
									
								
								prototype.sh
									
									
									
									
									
								
							| @@ -6,13 +6,14 @@ | |||||||
| # Copyright by aceisace | # Copyright by aceisace | ||||||
|  |  | ||||||
| echo -e "\e[1mPlease select an option from below:" | echo -e "\e[1mPlease select an option from below:" | ||||||
| echo -e "\e[97mEnter \e[91m1 \e[97m to install/update the E-Paper software" | echo -e "\e[97mEnter \e[91m1 \e[97m to update the E-Paper software" | ||||||
| echo -e "\e[97mEnter \e[91m2 \e[97m to uninstall the E-Paper software" | echo -e "\e[97mEnter \e[91m2 \e[97m to install the E-Paper software" | ||||||
|  | echo -e "\e[97mEnter \e[91m3 \e[97m to uninstall the E-Paper software" | ||||||
| echo -e "\e[1mNote: Updating will back up just the settings.py file." | echo -e "\e[1mNote: Updating will back up just the settings.py file." | ||||||
| echo -e "\e[97mConfirm your selection with [ENTER]" | echo -e "\e[97mConfirm your selection with [ENTER]" | ||||||
| read -r -p 'Waiting for input...  ' option | read -r -p 'Waiting for input...  ' option | ||||||
|  |  | ||||||
| if [ "$option" != 1 ] && [ "$option" != 2 ]; then | if [ "$option" != 1 ] && [ "$option" != 2 ] && [ "$option" != 3 ]; then | ||||||
|     echo "invalid number, aborting now" |     echo "invalid number, aborting now" | ||||||
|     exit |     exit | ||||||
| fi | fi | ||||||
| @@ -20,19 +21,20 @@ if [ -z "$option" ]; then | |||||||
|     echo "You didn't enter anything, aborting now." |     echo "You didn't enter anything, aborting now." | ||||||
|     exit |     exit | ||||||
| fi | fi | ||||||
| if [ "$option" = 2 ]; then | if [ "$option" = 3 ]; then | ||||||
|     echo "Removing the E-Paper software now..." |     echo "Removing the E-Paper software now..." | ||||||
|     pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove --purge supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y |     pip3 uninstall Pillow -y && sudo pip3 uninstall Pillow -y && sudo pip3 uninstall pyowm -y&& sudo pip3 uninstall ics -y && pip3 uninstall pyowm -y && pip3 uninstall ics -y && sudo apt-get remove --purge supervisor -y && sudo apt-get clean && sudo apt-get autoremove -y | ||||||
|     if [ -d "/home/pi/test" ]; then |     echo "The libraries have been removed successfully" | ||||||
|     echo "Hooray, it worked!" |     echo "Removing the E-Paper-Calendar folder if it exists" | ||||||
|  |     if [ -d "/home/pi/E-Paper-Master" ]; then | ||||||
|  |         sudo rm -r /home/pi/E-Paper-Master/ | ||||||
|     fi |     fi | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  |  | ||||||
| if [ "$option" = 1 ]; then | if [ "$option" = 1 ]; then | ||||||
|     echo "Checking if the software is installed" |     echo "Checking if the settings.py exists..." | ||||||
|     if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ] |     sleep 2 | ||||||
|     then |     if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ]; then | ||||||
|         echo "Found an E-Paper settings file." |         echo "Found an E-Paper settings file." | ||||||
|         sleep 2 |         sleep 2 | ||||||
| 	echo "Backing up the current settings file in the home directory." | 	echo "Backing up the current settings file in the home directory." | ||||||
| @@ -42,32 +44,18 @@ if [ "$option" = 1 ]; then | |||||||
| 	sleep 2 | 	sleep 2 | ||||||
| 	cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old | 	cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old | ||||||
| 	echo "Updating now..." | 	echo "Updating now..." | ||||||
|         # Getting input to see which E-Paper version is currently being used. | 	echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" | ||||||
|  |         cd | ||||||
|  |     else | ||||||
|  |         echo "Could not find any settings.py file in /home/pi/E-Paper-Master" | ||||||
|  | 	echo "Please uninstall the software first and then use the install option" | ||||||
|  | 	echo "Exiting now" | ||||||
|  | 	exit | ||||||
|     fi |     fi | ||||||
|     echo -e "\e[1mWhich version of the E-Paper display are you using?" | fi | ||||||
|     echo -e "\e[97mEnter \e[91m2 \e[97m if you are using the 2-Colour E-Paper" |  | ||||||
|     echo -e "\e[97mEnter \e[91m3 \e[97m if you are using the 3-Colour E-Paper" |  | ||||||
|     echo -e "\e[97mconfirm your selection with [ENTER]" |  | ||||||
|     read -r -p 'Please type in the number now:  ' digit |  | ||||||
|  |  | ||||||
|     if [ -z "$digit" ]; then | if [ "$option" = 2 ]; then | ||||||
|         echo "You didn't enter anything." |     echo "The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m" | ||||||
|         echo "Aborting now." |  | ||||||
|         exit |  | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     if [ "$digit" != 2 ] && [ "$digit" != 3 ]; then |  | ||||||
|         echo "invalid number, only 2 or 3 can be accepted." |  | ||||||
|         echo "Aborting now." |  | ||||||
|         exit |  | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     if [ "$digit" = 2 ] || [ "$digit" = 3 ]; then |  | ||||||
|         echo "" |  | ||||||
|         echo -e "\e[1;36m"Your input was accepted"\e[0m" |  | ||||||
|         echo -e "\e[1;36m"The installer will finish the rest now. You can enjoy a break in the meanwhile."\e[0m" |  | ||||||
|         echo "" |  | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     # Updating and upgrading the system, without taking too much space |     # Updating and upgrading the system, without taking too much space | ||||||
|     echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m" |     echo -e "\e[1;36m"Running apt-get update and apt-get dist-upgrade for you..."\e[0m" | ||||||
| @@ -75,7 +63,7 @@ if [ "$option" = 1 ]; then | |||||||
|     sudo apt-get update && sudo apt-get dist-upgrade -y |     sudo apt-get update && sudo apt-get dist-upgrade -y | ||||||
|     echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m" |     echo -e "\e[1;36m"System successfully updated and upgraded!"\e[0m" | ||||||
|     echo "" |     echo "" | ||||||
|  |     exit | ||||||
|     # Installing a few packages which are missing on Raspbian Stretch Lite |     # Installing a few packages which are missing on Raspbian Stretch Lite | ||||||
|     echo -e "\e[1;36m"Installing a few packages that are missing on Raspbian Stretch Lite..."\e[0m" |     echo -e "\e[1;36m"Installing a few packages that are missing on Raspbian Stretch Lite..."\e[0m" | ||||||
|     sudo apt-get install python3-pip python-rpi.gpio-dbgsym python3-rpi.gpio python-rpi.gpio python3-rpi.gpio-dbgsym python3-spidev git libopenjp2-7-dev libtiff5 -y |     sudo apt-get install python3-pip python-rpi.gpio-dbgsym python3-rpi.gpio python-rpi.gpio python3-rpi.gpio-dbgsym python3-spidev git libopenjp2-7-dev libtiff5 -y | ||||||
| @@ -94,8 +82,10 @@ if [ "$option" = 1 ]; then | |||||||
|     sudo pip3 install ics |     sudo pip3 install ics | ||||||
|     pip3 install pyowm |     pip3 install pyowm | ||||||
|     pip3 install ics |     pip3 install ics | ||||||
|     echo "" |     echo "Finished installing libraries" | ||||||
|  | fi | ||||||
|  |  | ||||||
|  | if [ "$option" = 2 ] || [ "$option" = 1 ] ; | ||||||
|     echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" |     echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" | ||||||
|     cd |     cd | ||||||
|     git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather |     git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather | ||||||
| @@ -108,41 +98,20 @@ if [ "$option" = 1 ]; then | |||||||
|     cd |     cd | ||||||
|     sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather |     sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather | ||||||
|  |  | ||||||
|     # Using this part for the 2-colour E-Paper version |     # add a short info | ||||||
|     if [ "$digit" = 2 ]; then |     cat > /home/pi/E-Paper-Master/Info.txt << EOF | ||||||
|         # edit the settings file for the 2-colour display option |  | ||||||
|         sed -i 's/display_colours = "bwr"/display_colours = "bw"/' /home/pi/E-Paper-Master/Calendar/settings.py |  | ||||||
|          |  | ||||||
|         # add a short info |  | ||||||
|         cat > /home/pi/E-Paper-Master/Info.txt << EOF |  | ||||||
| This document contains a short info of the E-Paper-Calendar software version | This document contains a short info of the E-Paper-Calendar software version | ||||||
|  |  | ||||||
| Version: 2-Colour E-Paper-version | Version: 1.5 | ||||||
| Installer version: 1.5 (Early February 2019) | Installer version: 1.5 (Early February 2019) | ||||||
| configuration file: /home/pi/E-Paper-Master/Calendar/settings.py | configuration file: /home/pi/E-Paper-Master/Calendar/settings.py | ||||||
| If the time was set correctly, you installed this software on: | If the time was set correctly, you installed this software on: | ||||||
| EOF | EOF | ||||||
|         echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt |     echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt | ||||||
|         echo "" |     echo "" | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     # Using this part for the 3-colour E-Paper version |  | ||||||
|     if [ "$digit" = 3 ]; then |  | ||||||
|         # add a short info |  | ||||||
|         cat > /home/pi/E-Paper-Master/Info.txt << EOF |  | ||||||
| This document contains a short info of the version |  | ||||||
|  |  | ||||||
| Version: 3-Colour E-Paper-version |  | ||||||
| Installer version: 1.5 (Early February 2019) |  | ||||||
| configuration file: /home/pi/E-Paper-Master/Calendar/settings.py |  | ||||||
| If the time was set correctly, you installed this software on: |  | ||||||
| EOF |  | ||||||
|         echo "$(date)" >> /home/pi/E-Paper-Master/Info.txt |  | ||||||
|         echo "" |  | ||||||
|     fi |  | ||||||
|  |  | ||||||
|     # Setting up supervisor |     # Setting up supervisor | ||||||
|     echo -e "\e[1;36m"Setting up the script to start at boot..."\e[0m" |     echo -e "\e[1;36m"Setting up auto-start of script at boot"\e[0m" | ||||||
|     sudo apt-get install supervisor -y |     sudo apt-get install supervisor -y | ||||||
|  |  | ||||||
|     sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF |     sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF | ||||||
| @@ -166,7 +135,6 @@ EOF | |||||||
|  |  | ||||||
|     echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m" |     echo -e "\e[1;36m"To modify the settings file, enter:"\e[0m" | ||||||
|     echo -e "\e[1;36m"nano /home/pi/E-Paper-Master/Calendar/settings.py"\e[0m" |     echo -e "\e[1;36m"nano /home/pi/E-Paper-Master/Calendar/settings.py"\e[0m" | ||||||
|     echo "" |  | ||||||
|     echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m" |     echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m" | ||||||
|     echo -e "\e[1;36m"python3.5 /home/pi/E-Paper-Master/E-Paper.py"\e[0m" |     echo -e "\e[1;36m"python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py"\e[0m" | ||||||
| fi | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user