From e039dd8caf539a89bd53f1f252c67d9b204c58cf Mon Sep 17 00:00:00 2001 From: mwoolweaver Date: Tue, 16 Apr 2019 02:00:21 -0500 Subject: [PATCH] automation --- install.sh | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) mode change 100644 => 100755 install.sh diff --git a/install.sh b/install.sh old mode 100644 new mode 100755 index 04a59df..4826ef7 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #!/bin/sh ## pihole tweeter -NAMEOFAPP="piholetweeter" -WHATITDOES="This is a script from DarthKeizer to tweet the Pi-Hole stats daily." +NAMEOFAPP="Pi-hole Stats Tweeter" +WHATITDOES="This script will install Pi-Hole-stats-tweeter and setup a cronjob that runs every day at 23:55" { if (whiptail --title "$NAMEOFAPP" --yes-button "Skip" --no-button "Proceed" --yesno "Do you want to setup $NAMEOFAPP? $WHATITDOES" 8 78) @@ -9,23 +9,23 @@ then echo "Declined $NAMEOFAPP" else sudo apt-get install -y python3-pip -sudo python3 -m pip install -U setuptools -sudo python3 -m pip install tweepy -sudo python3 -m pip install request -sudo python3 -m pip install urllib -sudo python3 -m pip install json -sudo python3 -m pip install simplejson -sudo python3 -m pip install datetime -sudo wget https://raw.githubusercontent.com/mwoolweaver/Pi-Hole-stats-tweeter/master/pihole_tweeter.py -P ~/pihole_tweeter/pihole_tweeter.py -sudo wget https://raw.githubusercontent.com/mwoolweaver/Pi-Hole-stats-tweeter/master/config.ini.example -P ~/pihole_tweeter/config.ini -sudo wget http://raw.githubusercontent.com/mwoolweaver/Pi-Hole-stats-tweeter/master/ +pip3 install -U -r https://raw.githubusercontent.com/mwoolweaver/Pi-Hole-stats-tweeter/master/requirements.txt +sudo wget https://raw.githubusercontent.com/mwoolweaver/Pi-Hole-stats-tweeter/master/pihole_tweeter.py -P ~/pihole_tweeter/ +sudo wget https://raw.githubusercontent.com/mwoolweaver/Pi-Hole-stats-tweeter/master/config.ini -P ~/pihole_tweeter/ CONSUMER_KEY=$(whiptail --inputbox "Consumer Key" 20 60 "" 3>&1 1>&2 2>&3) CONSUMER_SECRET=$(whiptail --inputbox "Consumer Secret" 20 60 "" 3>&1 1>&2 2>&3) ACCESS_TOKEN=$(whiptail --inputbox "Access Token" 20 60 "" 3>&1 1>&2 2>&3) ACCESS_TOKEN_SECRET=$(whiptail --inputbox "Access Token Secret" 20 60 "" 3>&1 1>&2 2>&3) -sudo sed -i "s/VALUE1/$CONSUMER_KEY/" ~/pihole_tweeter/config.ini -sudo sed -i "s/VALUE2/$CONSUMER_SECRET/" ~/pihole_tweeter/config.ini -sudo sed -i "s/VALUE3/$ACCESS_TOKEN/" ~/pihole_tweeter/config.ini -sudo sed -i "s/VALUE4/$ACCESS_TOKEN_SECRET/" ~/pihole_tweeter/config.ini +sudo sed -ie "s/VALUE1/$CONSUMER_KEY/" ~/pihole_tweeter/config.ini +sudo sed -ie "s/VALUE2/$CONSUMER_SECRET/" ~/pihole_tweeter/config.ini +sudo sed -ie "s/VALUE3/$ACCESS_TOKEN/" ~/pihole_tweeter/config.ini +sudo sed -ie "s/VALUE4/$ACCESS_TOKEN_SECRET/" ~/pihole_tweeter/config.ini +fi } +{ if +(whiptail --title "$NAMEOFAPP" --yes-button "Skip" --no-button "Proceed" --yesno "Do you want to setup $NAMEOFAPP as a cronjob?" 8 78) +then +echo "did not install cronjob" +else +sudo wget http://raw.githubusercontent.com/mwoolweaver/Pi-Hole-stats-tweeter/master/pi-hole-tweeter-cron -P /etc/cron.d/ +sudo rm ~/pihole_tweeter/config.inie fi } -