From e6b98e85b58f0a0cb1d05cfd1541b3a219b3cdd0 Mon Sep 17 00:00:00 2001 From: sekedus Date: Wed, 5 Jun 2024 19:34:42 +0800 Subject: [PATCH] Add: `update` command --- README.md | 1 + setup | 5 +++-- tamp | 29 +++++++++++++++++++++++++---- update | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 update diff --git a/README.md b/README.md index 9de45e7..a223074 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ cd ~/tamp && bash setup && cd ~/ - tamp start - tamp start-ssl - tamp stop +- tamp update - tamp uninstall ## Credits diff --git a/setup b/setup index e3185b8..3653957 100644 --- a/setup +++ b/setup @@ -52,9 +52,10 @@ fi cd ~/tamp && cp -f config.inc.php /sdcard/htdocs/phpmyadmin/config.inc.php YELLOW='\033[0;33m' +NC='\033[0m' # No Color echo "TAMP installed sucessfully." echo "/sdcard/htdocs - is your document directory." echo "Place your files in /sdcard/htdocs" -echo -e "Run: ${YELLOW}tamp start" +echo -e "Run: ${YELLOW}tamp start${NC}" -#tamp +#tamp-setup diff --git a/tamp b/tamp index ca1eec2..3b8b355 100644 --- a/tamp +++ b/tamp @@ -38,6 +38,24 @@ stop) apachectl stop pgrep mariadb && pkill mariadb ;; +update) + if [ ! -d ~/tamp ]; + then + echo "TAMP directory not found." + git clone https://github.com/sekedus/tamp.git + fi + cd $HOME/tamp + git remote update + STATUS=$(git status -uno | grep 'Your branch is up to date') + echo "Check for TAMP updates.." + if [ -z "$STATUS" ]; then + git reset --hard HEAD + git pull + sh update + else + echo "\033[0;33mAlready up to date.\033[0m" + fi + ;; uninstall) echo "Are you absolutely sure?" echo "" @@ -61,8 +79,11 @@ uninstall) echo "by github.com/sekedus" echo " " echo "commands:" - echo " start Start tamp, localhost:8080" - echo " start-ssl Start tamp with SSL, port :8443" - echo " stop Stop tamp" - echo " uninstall Uninstall tamp" + echo " start Start TAMP, localhost:8080" + echo " start-ssl Start TAMP with SSL, port :8443" + echo " stop Stop TAMP" + echo " update Update TAMP" + echo " uninstall Uninstall TAMP" esac + +# tamp diff --git a/update b/update new file mode 100644 index 0000000..e7552af --- /dev/null +++ b/update @@ -0,0 +1,34 @@ +#!$PREFIX/bin/bash +BLUE='\033[0;34m' +RED='\033[0;31m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +apachectl stop + +pgrep mariadb && pkill mariadb + +echo "${BLUE}Updating TAMP..${NC}" + +rm $PREFIX/etc/apache2/httpd.conf + +cp httpd.conf $PREFIX/etc/apache2/ + +rm $PREFIX/etc/apache2/extra/httpd-ssl.conf + +cp httpd-ssl.conf $PREFIX/etc/apache2/extra/ + +rm $PREFIX/bin/tamp + +chmod +x tamp + +cp tamp $PREFIX/bin/ + +cp -n .htaccess /sdcard/htdocs/ + +cp -n config.inc.php /sdcard/htdocs/phpmyadmin/config.inc.php + +echo "${RED}Done!${NC}" +echo "${YELLOW}TAMP is up to date.${NC}" + +#tamp-update