From 0ea6eb128026b7fe60a4ee42c849ed1a5ced3480 Mon Sep 17 00:00:00 2001 From: Ace Date: Wed, 17 Apr 2019 23:16:45 +0200 Subject: [PATCH] Created template for a new installer --- prototype.sh | 82 +++++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/prototype.sh b/prototype.sh index f8cd47c..43027d8 100644 --- a/prototype.sh +++ b/prototype.sh @@ -1,15 +1,13 @@ -# Please do not use this file. It is only intended for testing new features and can potentially damage the system. #!/bin/bash -# E-Paper-Calendar software installer for the raspberry pi +# E-Paper-Calendar software installer for Raspberry pi # Version: 1.5 (Early Februrary 2019) -# Stability status of this installer: pending +# Stability status of this installer: Confirmed with Raspbain Stretch Lite on 12th March 2019 # Copyright by aceisace echo -e "\e[1mPlease select an option from below:" echo -e "\e[97mEnter \e[91m1 \e[97m to update 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[97mConfirm your selection with [ENTER]" read -r -p 'Waiting for input... ' option @@ -28,29 +26,28 @@ if [ "$option" = 3 ]; then sudo rm /etc/supervisor/conf.d/E-Paper.conf fi echo -e "The libraries have been removed successfully" - echo -e "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/ + echo -e "Removing the Inky-Calendar folder if it exists" + if [ -d "/home/pi/Inky-Calendar" ]; then + sudo rm -r /home/pi/Inky-Calendar/ fi fi if [ "$option" = 1 ]; then echo "Checking if the settings.py exists..." - if [ -e /home/pi/E-Paper-Master/Calendar/settings.py ]; then + if [ -e /home/pi/Inky-Calendar/Calendar/settings.py ]; then echo -e "Found an E-Paper settings file." sleep 2 echo "Backing up the current settings file in the home directory." sleep 2 - cp /home/pi/E-Paper-Master/Calendar/settings.py /home/pi/settings-old.py + cp /home/pi/Inky-Calendar/Calendar/settings.py /home/pi/settings-old.py echo -e "renaming the old E-Paper software folder" sleep 2 - cp -r /home/pi/E-Paper-Master /home/pi/E-Paper-Master-old - sudo rm -r /home/pi/E-Paper-Master + cp -r /home/pi/Inky-Calendar /home/pi/Inky-Calendar-old + sudo rm -r /home/pi/Inky-Calendar echo "Updating now..." - echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" cd else - echo -e "Could not find any settings.py file in /home/pi/E-Paper-Master" + echo -e "Could not find any settings.py file in /home/pi/Inky-Calendar/Calendar" echo -e "Please uninstall the software first and then use the install option" echo -e "Exiting now" exit @@ -69,9 +66,7 @@ if [ "$option" = 2 ]; then # 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" - 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 - pip3 install Pillow==5.3.0 - sudo pip3 install Pillow==5.3.0 + sudo apt-get install python3-pip -y python-rpi.gpio-dbgsym -y python3-rpi.gpio -y python-rpi.gpio -y python3-rpi.gpio-dbgsym -y python3-spidev -y git -y libopenjp2-7-dev -y libtiff5 -y python3-numpy -y echo "" # Running apt-get clean and apt-get autoremove @@ -82,35 +77,45 @@ if [ "$option" = 2 ]; then # Installing packages required by the main script echo -e "\e[1;36m"Installing a few required packages for the E-Paper Software"\e[0m" sudo pip3 install pyowm + sudo pip3 install Pillow==5.3.0 sudo pip3 install ics + sudo pip3 install feedparser pip3 install pyowm pip3 install ics + pip3 install feedparser + pip3 install Pillow==5.3.0 echo -e "\e[1;36m"Finished installing libraries"\e[0m" fi if [ "$option" = 1 ] || [ "$option" = 2 ]; then - echo -e "\e[1;36m"Installing the E-Paper-Calendar Software for your display"\e[0m" + echo -e "\e[1;36m"Installing the Inky-Calendar Software for your display"\e[0m" cd - git clone https://github.com/aceisace/E-Paper-Calendar-with-iCal-sync-and-live-weather - mkdir E-Paper-Master - cd E-Paper-Calendar-with-iCal-sync-and-live-weather - cp -r Calendar /home/pi/E-Paper-Master/ - cp README.md /home/pi/E-Paper-Master/ - cp LICENSE /home/pi/E-Paper-Master/ - cp -r .git /home/pi/E-Paper-Master/ + git clone https://github.com/aceisace/Inky-Calendar + mkdir Inky-Calendar + cd Inky-Calendar + cp -r Calendar /home/pi/Inky-Calendar/ + cp README.md /home/pi/Inky-Calendar/ + cp LICENSE /home/pi/Inky-Calendar/ + cp -r .git /home/pi/Inky-Calendar/ + + # Make a copy of the sample settings.py file + cd /home/pi/Inky-Calendar/Calendar + cp settings.py.sample settings.py cd - sudo rm -r E-Paper-Calendar-with-iCal-sync-and-live-weather + + # Remove the downloaded (temporary) directory + sudo rm -r Inky-Calendar # 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 + cat > /home/pi/Inky-Calendar/Info.txt << EOF +This document contains a short info of the Inky-Calendar software version Version: 1.5 Installer version: 1.5 (Early February 2019) -configuration file: /home/pi/E-Paper-Master/Calendar/settings.py +configuration file: /home/pi/Inky-Calendar/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 "$(date)" >> /home/pi/Inky-Calendar/Info.txt echo "" # Setting up supervisor @@ -119,25 +124,30 @@ EOF sudo bash -c 'cat > /etc/supervisor/conf.d/E-Paper.conf' << EOF [program:E-Paper] -command = sudo /usr/bin/python3.5 /home/pi/E-Paper-Master/Calendar/E-Paper.py -stdout_logfile = /home/pi/E-Paper-Master/E-Paper.log +command = sudo /usr/bin/python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py +stdout_logfile = /home/pi/Inky-Calendar/E-Paper.log stdout_logfile_maxbytes = 1MB -stderr_logfile = /home/pi/E-Paper-Master/E-Paper-err.log +stderr_logfile = /home/pi/Inky-Calendar/E-Paper-err.log stderr_logfile_maxbytes = 1MB EOF sudo service supervisor start E-Paper + + # Installing some new dependencies + echo "Installing some new dependencies" + sudo apt-get install python-numpy -y + sudo pip3 install feedparser + pip3 install feedparser echo "" # Final words echo -e "\e[1;36m"The install was successful"\e[0m" - echo -e "\e[1;36m"The programm will now start at every boot."\e[0m" - + echo -e "\e[1;36m"The programm is set to start at every boot."\e[0m" echo -e "\e[1;31m"Please enter your details in the file 'settings.py'."\e[0m" echo -e "\e[1;31m"If this file is not modified, the programm will not start"\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/Inky-Calendar/Calendar/settings.py"\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/Calendar/E-Paper.py"\e[0m" + echo -e "\e[1;36m"python3.5 /home/pi/Inky-Calendar/Calendar/E-Paper.py"\e[0m" fi