Please do not use this yet

Adaptations, better installation procedure, option to launch web-ui after install and move the generated file to the correct lcoation. username support. Added option to choose if start at boot is desired or not. Testing in progress. Please do not use this yet.
This commit is contained in:
Ace 2019-12-17 13:47:10 +01:00 committed by GitHub
parent d2683a6628
commit d0471ab030
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,9 +3,9 @@
# Version: 1.7 (Early Dec 2019) # Version: 1.7 (Early Dec 2019)
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 update the E-Paper software" #Option 1 : UPDATE echo -e "\e[97mEnter \e[91m[1] \e[97m to update Inky-Calendar software" #Option 1 : UPDATE
echo -e "\e[97mEnter \e[91m2 \e[97m to install the E-Paper software" #Option 2 : INSTALL echo -e "\e[97mEnter \e[91m[2] \e[97m to install Inky-Calendar software" #Option 2 : INSTALL
echo -e "\e[97mEnter \e[91m3 \e[97m to uninstall the E-Paper software" #Option 3 : UNINSTALL echo -e "\e[97mEnter \e[91m[3] \e[97m to uninstall Inky-Calendar software" #Option 3 : UNINSTALL
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
@ -22,10 +22,10 @@ if [ "$option" = 3 ]; then
# Remove requirements of software # Remove requirements of software
echo -e "\e[1;36m"Removing requirements for Inky-Calendar software"\e[0m" echo -e "\e[1;36m"Removing requirements for Inky-Calendar software"\e[0m"
cd /home/$USER/Inky-Calendar && pip3 uninstall -r requirements.txt && sudo apt-get clean && sudo apt-get autoremove -y cd /home/"$USER"/Inky-Calendar && pip3 uninstall -r requirements.txt && sudo apt-get clean && sudo apt-get autoremove -y
# Remove configuration file for supervisor if it exists # Remove configuration file for supervisor if it exists
if [ -e /etc/supervisor/conf.d/Inky-Calendar.conf ]; then sudo rm /etc/supervisor/conf.d/Inky-Calendar.conf if [ -e /etc/supervisor/conf.d/inkycal.conf ]; then sudo rm /etc/supervisor/conf.d/inkycal.conf
fi fi
# Print message that libraries have been uninstalled now # Print message that libraries have been uninstalled now
@ -35,7 +35,7 @@ if [ "$option" = 3 ]; then
# Remove the Inky-Calendar directory if it exists # Remove the Inky-Calendar directory if it exists
echo -e "Removing the Inky-Calendar folder if it exists" echo -e "Removing the Inky-Calendar folder if it exists"
if [ -d "/home/$USER/Inky-Calendar" ]; then if [ -d "/home/$USER/Inky-Calendar" ]; then
sudo rm -r /home/$USER/Inky-Calendar/ sudo rm -r /home/"$USER"/Inky-Calendar/
echo -e "\e[1;36m"Found Inky-Calendar folder and deleted it"\e[0m" echo -e "\e[1;36m"Found Inky-Calendar folder and deleted it"\e[0m"
fi fi
echo -e "\e[1;36m"All done!"\e[0m" echo -e "\e[1;36m"All done!"\e[0m"
@ -81,15 +81,15 @@ if [ "$option" = 1 ] || [ "$option" = 2 ]; then # This happens when installing o
# Cloning Inky-Calendar repo # Cloning Inky-Calendar repo
echo -e "\e[1;36m"Cloning Inky-Calendar repo from Github"\e[0m" echo -e "\e[1;36m"Cloning Inky-Calendar repo from Github"\e[0m"
cd /home/$USER && git clone -b dev https://github.com/aceisace/Inky-Calendar cd /home/"$USER" && git clone -b dev https://github.com/aceisace/Inky-Calendar
# Installing dependencies # Installing dependencies
echo -e "\e[1;36m"Installing requirements for Inky-Calendar software"\e[0m" echo -e "\e[1;36m"Installing requirements for Inky-Calendar software"\e[0m"
cd /home/$USER/Inky-Calendar && pip3 install -r requirements.txt cd /home/"$USER"/Inky-Calendar && pip3 install -r requirements.txt
# Create symlinks of settings and configuration file # Create symlinks of settings and configuration file
ln -s /home/$USER/Inky-Calendar/settings/settings.py /home/$USER/Inky-Calendar/modules/ ln -s /home/"$USER"/Inky-Calendar/settings/settings.py /home/"$USER"/Inky-Calendar/modules/
ln -s /home/$USER/Inky-Calendar/settings/configuration.py /home/$USER/Inky-Calendar/modules/ ln -s /home/"$USER"/Inky-Calendar/settings/configuration.py /home/"$USER"/Inky-Calendar/modules/
# add a short info # add a short info
cat > /home/pi/Inky-Calendar/Info.txt << EOF cat > /home/pi/Inky-Calendar/Info.txt << EOF
@ -97,12 +97,21 @@ This document contains a short info of the Inky-Calendar software version
Version: 1.7 Version: 1.7
Installer version: 1.7 (Mid December 2019) Installer version: 1.7 (Mid December 2019)
settings file: /home/pi/Inky-Calendar/settings/settings.py settings file: /home/$USER/Inky-Calendar/settings/settings.py
If the time was set correctly, you installed this software on: If the time was set correctly, you installed this software on:
$(date)
EOF EOF
echo "$(date)" >> /home/pi/Inky-Calendar/Info.txt
echo "" echo ""
echo -e "\e[97mDo you want the software to start automatically at boot?"
echo -e "\e[97mPress [Y] for yes or [N] for no. The default option is yes"
echo -e "\e[97mConfirm your selection with [ENTER]"
read -r -p 'Waiting for input... ' autostart
if [ "$autostart" != Y ] && [ "$autostart" != y ] && [ "$autostart" != N ] && [ "$autostart" != n ]; then echo -e "invalid input, aborting now" exit
fi
if [ -z "$autostart" ] || [ "$autostart" = Y ] || [ "$autostart" = y ]; then
# Setting up supervisor # Setting up supervisor
echo -e "\e[1;36m"Setting up auto-start of script 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
@ -118,22 +127,58 @@ user = $USER
startsecs = 30 startsecs = 30
EOF EOF
sudo service supervisor reload sudo service supervisor reload && sudo service supervisor start Inky-Calendar
sudo service supervisor start Inky-Calendar
echo "" echo ""
fi
# Final words # Final words
echo -e "\e[1;36m"The install was successful"\e[0m" echo -e "\e[1;36m"The install was successful."\e[0m"
echo -e "\e[1;36m"The programm is set to start at every boot."\e[0m" sleep 2
echo -e "\e[1;31m"You can now add your personal details in the settings file"\e[0m"
echo -e "\e[1;31m"located in Inky-Calendar/settings/settings.py"\e[0m"
sleep 2
echo -e "\e[1;31m"To enter your personal details, please use"\e[0m" echo -e "\e[97mIf you want to add your details now, selet an option from below"
echo -e "\e[1;31m"the Settings-Web-UI.html web-page"\e[0m" echo -e "\e[97mType [1] to open the settings-web-UI (user-fiendly)"
echo -e "\e[1;36m"To do so, open the file Settings-Web-UI.html from"\e[0m" echo -e "\e[97mType [2] to open settings file with nano (can be run on SSH)"
echo -e "\e[1;36m"/home/pi/Inky-Calendar/Settings-Web-UI.html with your browser,"\e[0m" echo -e "\e[97mType [3] to open settings file with python3 (can be run on SSH)"
echo -e "\e[1;36m"add your details, click on generate and copy the settings.py"\e[0m" echo -e "\e[97mLeave empty to skip this step"
echo -e "\e[1;36m"file to /home/pi/Inky-Calendar/settings/setting.py"\e[0m" echo -e "\e[97mConfirm your selection with [ENTER]"
read -r -p 'Waiting for input... ' settings
echo -e "\e[1;36m"You can test if the programm works by typing:"\e[0m" # Invalid number selected, abort
echo -e "\e[1;36m"python3 /home/$USER/Inky-Calendar/Calendar/E-Paper.py"\e[0m" if [ "$settings" != 1 ] && [ "$settings" != 2 ] && [ "$settings" != 3 ]; then echo -e "invalid number, skipping.."
fi
# No option selected, abort
if [ -z "$settings" ]; then echo -e "You didn't enter anything, skipping.."
fi
# What to do when uninstalling software
if [ "$settings" = 1 ]; then
echo -e "\e[1;36m"Opening web-UI for adding details..."\e[0m"
chromium-browser /home/"$USER"/Inky-Calendar/settings/settings-UI.html
sleep 2
echo -e "\e[97mHave you added your details and clicked on 'Generate'?"
echo -e "\e[97mPress [Y] for yes."
read -r -p 'Waiting for input... ' complete
if [ -z "$complete" ] || [ "$complete" = Y ] || [ "$complete" = y ]; then
echo -e "\e[1;36m"Moving settings file to /home/"$USER"/Inky-Calendar/settings/"\e[0m"
if [ -e /etc/supervisor/conf.d/inkycal.conf ]; then mv /home/"$USER"/Downloads/settings.py /home/"$USER"/Inky-Calendar/settings/
fi
fi
fi
if [ "$settings" = 2 ]; then
echo -e "\e[1;36m"Opening settings file with nano"\e[0m"
nano /home/"$USER"/Inky-Calendar/settings/settings.py
fi
if [ "$settings" = 3 ]; then
echo -e "\e[1;36m"Opening settings file with python3"\e[0m"
python3 /home/"$USER"/Inky-Calendar/settings/settings.py
fi
echo -e "\e[1;36m"You can test if the programm works by running:"\e[0m"
echo -e "\e[1;36m"python3 /home/"$USER"/Inky-Calendar/Calendar/inkycal.py"\e[0m"
fi fi