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:
parent
d2683a6628
commit
d0471ab030
111
Installer.sh
111
Installer.sh
@ -3,9 +3,9 @@
|
||||
# Version: 1.7 (Early Dec 2019)
|
||||
|
||||
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[91m2 \e[97m to install the E-Paper 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[1] \e[97m to update Inky-Calendar software" #Option 1 : UPDATE
|
||||
echo -e "\e[97mEnter \e[91m[2] \e[97m to install Inky-Calendar software" #Option 2 : INSTALL
|
||||
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]"
|
||||
read -r -p 'Waiting for input... ' option
|
||||
|
||||
@ -22,12 +22,12 @@ if [ "$option" = 3 ]; then
|
||||
|
||||
# Remove requirements of software
|
||||
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
|
||||
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
|
||||
|
||||
|
||||
# Print message that libraries have been uninstalled now
|
||||
echo -e "\e[1;36m"The libraries have been removed successfully"\e[0m"
|
||||
sleep 2
|
||||
@ -35,7 +35,7 @@ if [ "$option" = 3 ]; then
|
||||
# Remove the Inky-Calendar directory if it exists
|
||||
echo -e "Removing the Inky-Calendar folder if it exists"
|
||||
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"
|
||||
fi
|
||||
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
|
||||
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
|
||||
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
|
||||
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/settings.py /home/"$USER"/Inky-Calendar/modules/
|
||||
ln -s /home/"$USER"/Inky-Calendar/settings/configuration.py /home/"$USER"/Inky-Calendar/modules/
|
||||
|
||||
# add a short info
|
||||
cat > /home/pi/Inky-Calendar/Info.txt << EOF
|
||||
@ -97,17 +97,26 @@ This document contains a short info of the Inky-Calendar software version
|
||||
|
||||
Version: 1.7
|
||||
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:
|
||||
$(date)
|
||||
EOF
|
||||
echo "$(date)" >> /home/pi/Inky-Calendar/Info.txt
|
||||
echo ""
|
||||
|
||||
# Setting up supervisor
|
||||
echo -e "\e[1;36m"Setting up auto-start of script at boot"\e[0m"
|
||||
sudo apt-get install supervisor -y
|
||||
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
|
||||
|
||||
sudo bash -c 'cat > /etc/supervisor/conf.d/inkycal.conf' << EOF
|
||||
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
|
||||
echo -e "\e[1;36m"Setting up auto-start of script at boot"\e[0m"
|
||||
sudo apt-get install supervisor -y
|
||||
|
||||
sudo bash -c 'cat > /etc/supervisor/conf.d/inkycal.conf' << EOF
|
||||
[program:Inky-Calendar]
|
||||
command = /usr/bin/python3 /home/$USER/Inky-Calendar/modules/inkycal.py
|
||||
stdout_logfile = /home/$USER/Inky-Calendar/logs/logfile.log
|
||||
@ -118,22 +127,58 @@ user = $USER
|
||||
startsecs = 30
|
||||
EOF
|
||||
|
||||
sudo service supervisor reload
|
||||
sudo service supervisor start Inky-Calendar
|
||||
|
||||
echo ""
|
||||
sudo service supervisor reload && sudo service supervisor start Inky-Calendar
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Final words
|
||||
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"
|
||||
|
||||
echo -e "\e[1;31m"To enter your personal details, please use"\e[0m"
|
||||
echo -e "\e[1;31m"the Settings-Web-UI.html web-page"\e[0m"
|
||||
echo -e "\e[1;36m"To do so, open the file Settings-Web-UI.html from"\e[0m"
|
||||
echo -e "\e[1;36m"/home/pi/Inky-Calendar/Settings-Web-UI.html with your browser,"\e[0m"
|
||||
echo -e "\e[1;36m"add your details, click on generate and copy the settings.py"\e[0m"
|
||||
echo -e "\e[1;36m"file to /home/pi/Inky-Calendar/settings/setting.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 /home/$USER/Inky-Calendar/Calendar/E-Paper.py"\e[0m"
|
||||
echo -e "\e[1;36m"The install was successful."\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[97mIf you want to add your details now, selet an option from below"
|
||||
echo -e "\e[97mType [1] to open the settings-web-UI (user-fiendly)"
|
||||
echo -e "\e[97mType [2] to open settings file with nano (can be run on SSH)"
|
||||
echo -e "\e[97mType [3] to open settings file with python3 (can be run on SSH)"
|
||||
echo -e "\e[97mLeave empty to skip this step"
|
||||
echo -e "\e[97mConfirm your selection with [ENTER]"
|
||||
read -r -p 'Waiting for input... ' settings
|
||||
|
||||
# Invalid number selected, abort
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user