From e8d23701e06e1573b3d0dcce8a371244ee3b8b73 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Tue, 16 Apr 2019 21:21:32 -0400 Subject: [PATCH] don't redownload python --- install.sh | 50 ++++++++++++++++++++++++++------------------------ reset.sh | 24 ++++++++++++++---------- uninstall.sh | 1 - 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/install.sh b/install.sh index 000c6a0..1494e5d 100755 --- a/install.sh +++ b/install.sh @@ -39,19 +39,21 @@ done ################################################################################ echo -e "Installing Sqlite3" -# fetch Sqlite -wget -O sqlite.tar.gz $sqlink 1> $pylogloc 2>> $pylogloc 3>> $pylogloc -if [ $? -ne 0 ] ; then - echo -e "Failed to fetch sqlite, make sure wget is installed and $pylink is what you're after. $pylogmsg" - exit 1 -fi +if [ ! -d sqlite ] ; then + # fetch Sqlite + wget -O sqlite.tar.gz $sqlink 1> $pylogloc 2>> $pylogloc 3>> $pylogloc + if [ $? -ne 0 ] ; then + echo -e "Failed to fetch sqlite, make sure wget is installed and $pylink is what you're after. $pylogmsg" + exit 1 + fi -mkdir sqlite -tar xf sqlite.tar.gz -C sqlite --strip-components=1 1>> $pylogloc 2>> $pylogloc 3>> $pylogloc -if [ $? -ne 0 ] ; then - echo -e "Failed to unzip sqlite. $pylogmsg" - exit 1 -fi + mkdir sqlite + tar xf sqlite.tar.gz -C sqlite --strip-components=1 1>> $pylogloc 2>> $pylogloc 3>> $pylogloc + if [ $? -ne 0 ] ; then + echo -e "Failed to unzip sqlite. $pylogmsg" + exit 1 + fi +fi; cd sqlite if [ $? -ne 0 ] ; then @@ -83,7 +85,6 @@ fi cd .. rm sqlite.tar.gz 1>> $pylogloc 2>> $pylogloc -rm -rf sqlite 1>> $pylogloc 2>> $pylogloc if [ $? -ne 0 ] ; then echo -e "Failed to remove Sqlite install files. $pylogmsg" fi @@ -94,17 +95,19 @@ fi ################################################################################ echo -e "Installing Python" -wget -O python.tar.gz $pylink 1> $pylogloc 2>> $pylogloc 3>> $pylogloc -if [ $? -ne 0 ] ; then - echo -e "Failed to fetch python, make sure wget is installed and $pylink is what you're after. $pylogmsg" - exit 1 -fi +if [ ! -d python ] ; then + wget -O python.tar.gz $pylink 1> $pylogloc 2>> $pylogloc 3>> $pylogloc + if [ $? -ne 0 ] ; then + echo -e "Failed to fetch python, make sure wget is installed and $pylink is what you're after. $pylogmsg" + exit 1 + fi -mkdir python -tar xf python.tar.gz -C python --strip-components=1 1>> $pylogloc 2>> $pylogloc 3>> $pylogloc -if [ $? -ne 0 ] ; then - echo -e "Failed to unzip python. $pylogmsg" - exit 1 + mkdir python + tar xf python.tar.gz -C python --strip-components=1 1>> $pylogloc 2>> $pylogloc 3>> $pylogloc + if [ $? -ne 0 ] ; then + echo -e "Failed to unzip python. $pylogmsg" + exit 1 + fi fi cd python @@ -152,7 +155,6 @@ fi cd .. rm python.tar.gz 1>> $pylogloc 2>> $pylogloc -rm -rf python 1>> $pylogloc 2>> $pylogloc if [ $? -ne 0 ] ; then echo -e "Failed to remove Python install files. $pylogmsg" fi diff --git a/reset.sh b/reset.sh index c519aeb..8fc1abc 100755 --- a/reset.sh +++ b/reset.sh @@ -9,18 +9,22 @@ # source vars source vars +# source vars +source vars + # remove nginx conf -tput setaf 2 echo "Disabling nginx" -tput setaf 9 systemctl stop nginx 1> /dev/null 2> /dev/null systemctl disable nginx 1> /dev/null 2> /dev/null -rm -f /etc/nginx/conf.d/$projectname.conf -# remove gunicorn -tput setaf 2 -echo "Uninstalling gunicorn" -tput setaf 9 -systemctl disable gunicorn 1> /dev/null 2> /dev/null -systemctl stop gunicorn 1> /dev/null 2> /dev/null -rm -f /etc/systemd/system/gunicorn.service \ No newline at end of file +# remove python +echo "Uninstalling Python" +for dir in $(whereis python3 | tr " " "\n" | grep usr/local/bin | tr "\n" " "); +do rm -r $dir; +done; + +# remove sqlite +echo "Uninstalling Sqlite3" +for dir in $(whereis sqlite3 | tr " " "\n" | grep usr/local/bin | tr "\n" " "); +do rm -r $dir; +done; \ No newline at end of file diff --git a/uninstall.sh b/uninstall.sh index cc97e86..a8d150b 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -12,7 +12,6 @@ echo "Disabling nginx" systemctl stop nginx 1> /dev/null 2> /dev/null systemctl disable nginx 1> /dev/null 2> /dev/null - # remove python echo "Uninstalling Python" for dir in $(whereis python3 | tr " " "\n" | grep usr/local/bin | tr "\n" " ");