From ee3f905580ffbb4f45b5dc190140b7098f0b8648 Mon Sep 17 00:00:00 2001 From: Ravi Shah <63246200+Rav4s@users.noreply.github.com> Date: Sat, 31 Oct 2020 09:35:01 -0500 Subject: [PATCH] Add installer script to automate install --- install.sh | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 install.sh diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..5bb7874 --- /dev/null +++ b/install.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +echo "This script will install the bottlepy web server and allow you to control and monitor the state of your smart garage door opener." +sleep 1 +echo "Before running this script, make sure you've configured your network and done a sudo apt update && sudo apt upgrade, so your system is up to date." +sleep 1 +echo "The default password is xxxx. YOU MUST CHANGE THIS AS IT IS VERY INSECURE." +sleep 1 +read -r -p "Press y to acknowledge and continue running the script. [y/N] " response + +if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]] +then + echo "Making directory..." + mkdir garagedoor && cd garagedoor + sleep 0.5 + echo "Installing Bottlepy..." + pip install bottle + sleep 0.5 + echo "Getting latest py file..." + wget https://raw.githubusercontent.com/Rav4s/Pi-Garage-Door-Opener/master/Python_script_for_garage_door.py + sleep 0.5 + echo "Editing /etc/rc.local for auto startup..." + sed 'x; ${s/.*/python3 /home/pi/Python_script_for_garage_door.py &/;p;x}; 1d' /etc/rc.local + sleep 0.5 + echo "Successful install! Rebooting in 5 seconds!" + sleep 5 + sudo shutdown -r now +else + echo "Bye!" + exit 1 +fi + +exit 0