From 9a37741d4b35783a32d9d862d8eb55c395325836 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristhian=20Mart=C3=ADnez=20Ochoa?= Date: Sun, 25 Feb 2018 18:13:30 -0700 Subject: [PATCH] force-flag instead delall delall internal flag was renamed to be better described, now is called force-flag and is used always we want to force unattended mode. --- lib/install | 4 ++-- plugins/stack | 36 ++++++++++++++++++------------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/install b/lib/install index 62779ae..aa3769d 100644 --- a/lib/install +++ b/lib/install @@ -783,9 +783,9 @@ config_load() { if [[ -n $(conf_load_read php-ver) ]]; then # PHP variable version in case of Overwriting if [[ $answer == [Oo] && $(conf_read php) == "true" && $(conf_load_read php-ver) != $(conf_read php-ver) ]]; then - conf_write delall true + conf_write force-flag true stack -php -purge - conf_delete delall + conf_delete force-flag fi conf_write php-ver $(conf_load_read php-ver) fi diff --git a/plugins/stack b/plugins/stack index ca24a46..f142e03 100644 --- a/plugins/stack +++ b/plugins/stack @@ -18,10 +18,10 @@ fi # FORCE - Unattended Purge clear_force_flag() { - [[ $(conf_read delall) == "true" ]] && conf_delete delall + [[ $(conf_read force-flag) == "true" ]] && conf_delete force-flag } if [[ $arg == "-purge=force" || $opt == "-purge-server-all=force" || $opt == "-php=force" ]]; then - conf_write delall true + conf_write force-flag true [[ $arg == "-purge=force" ]] && arg="-purge" [[ $opt == "-purge-server-all=force" ]] && opt="-purge-server-all" [[ $opt == "-php=force" ]] && opt="-php" @@ -56,7 +56,7 @@ elif [[ $arg == "-purge" && ( $opt == "-html" || $opt == "-nginx" ) ]]; then echo "" echo "${red} ¡ C A U T I O N ! You are about to remove NGINX from your server!" echo "" - if [[ $(conf_read delall) != "true" ]]; then + if [[ $(conf_read force-flag) != "true" ]]; then echo " ${blu} Are you sure [y/N]? ${end}" while read -r -n 1 -s answer; do answer=${answer:-n} @@ -66,8 +66,8 @@ elif [[ $arg == "-purge" && ( $opt == "-html" || $opt == "-nginx" ) ]]; then done fi - if [[ $answer == [Yy] || $(conf_read delall) == "true" ]]; then - if [[ $(conf_read delall) == "true" && $force == 1 ]]; then + if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then + if [[ $(conf_read force-flag) == "true" && $force == 1 ]]; then answer="Y" else echo "" @@ -126,7 +126,7 @@ elif [[ $arg == "-purge" && $opt == "-php" ]]; then echo "${red} ¡ C A U T I O N ! You are about to remove PHP from your server!" echo " This action will also remove PhpMyAdmin if its installed because depends on PHP. ${end}" echo "" - if [[ $(conf_read delall) != "true" ]]; then + if [[ $(conf_read force-flag) != "true" ]]; then echo " ${blu} Are you sure [y/N]? ${end}" while read -r -n 1 -s answer; do answer=${answer:-n} @@ -136,7 +136,7 @@ elif [[ $arg == "-purge" && $opt == "-php" ]]; then done fi - if [[ $answer == [Yy] || $(conf_read delall) == "true" ]]; then + if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then if [[ $(conf_read mysql-tool) == "true" ]]; then stack -pma -purge fi @@ -179,7 +179,7 @@ elif [[ $arg == "-purge" && $opt == "-mysql" ]]; then echo "" echo "${red} ¡ C A U T I O N ! You are about to remove MySQL from your server! ${end}" echo "" - if [[ $(conf_read delall) != "true" ]]; then + if [[ $(conf_read force-flag) != "true" ]]; then echo " ${blu} Are you sure [y/N]? ${end}" while read -r -n 1 -s answer; do answer=${answer:-n} @@ -189,7 +189,7 @@ elif [[ $arg == "-purge" && $opt == "-mysql" ]]; then done fi - if [[ $answer == [Yy] || $(conf_read delall) == "true" ]]; then + if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then if [[ $(conf_read mysql-tool) == "true" ]]; then conf_write delautopma true stack -pma -purge @@ -238,7 +238,7 @@ elif [[ $arg == "-purge" && $opt == "-pma" ]]; then echo "" echo "${red} ¡ C A U T I O N ! You are about to remove PhpMyAdmin from your server! ${end}" echo "" - if [[ $(conf_read delall) != "true" && $(conf_read delautopma) != "true" ]]; then + if [[ $(conf_read force-flag) != "true" && $(conf_read delautopma) != "true" ]]; then echo " ${blu} Are you sure [y/N]? ${end} " while read -r -n 1 -s answer; do answer=${answer:-n} @@ -248,7 +248,7 @@ elif [[ $arg == "-purge" && $opt == "-pma" ]]; then done fi - if [[ $answer == [Yy] || $(conf_read delall) == "true" || $(conf_read delautopma) == "true" ]]; then + if [[ $answer == [Yy] || $(conf_read force-flag) == "true" || $(conf_read delautopma) == "true" ]]; then echo "phpmyadmin phpmyadmin/dbconfig-remove boolean true" | debconf-set-selections echo "phpmyadmin phpmyadmin/purge boolean true" | debconf-set-selections sudo apt-get -y purge phpmyadmin @@ -275,7 +275,7 @@ elif [[ $arg == "-purge" && $opt == "-web-tools" ]]; then echo "" echo "${red} ¡ C A U T I O N ! You are about to remove all your Web Tools (Postfix, Redis, Memcached, Duplicity and Letsencrypt) from your server! ${end}" echo "" - if [[ $(conf_read delall) != "true" ]]; then + if [[ $(conf_read force-flag) != "true" ]]; then echo " ${blu} Are you sure [y/N]? ${end} " while read -r -n 1 -s answer; do answer=${answer:-n} @@ -285,7 +285,7 @@ elif [[ $arg == "-purge" && $opt == "-web-tools" ]]; then done fi - if [[ $answer == [Yy] || $(conf_read delall) == "true" ]]; then + if [[ $answer == [Yy] || $(conf_read force-flag) == "true" ]]; then if [[ $(conf_read nginx-tool) == "true" ]]; then sudo apt-get -y purge letsencrypt python-boto duplicity duply fi @@ -346,7 +346,7 @@ elif [[ $opt == "-html" || $opt == "-nginx" ]]; then elif [[ $opt == "-php" ]]; then if [[ $(conf_read php) != "true" ]]; then - if [[ $(conf_read nginx) != "true" && $(conf_read delall) != "true" ]]; then + if [[ $(conf_read nginx) != "true" && $(conf_read force-flag) != "true" ]]; then echo "" echo "${blu}Nginx is not installed, do you want to install it too [Y/n]?${end} " while read -r -n 1 -s answer; do @@ -438,13 +438,13 @@ elif [[ $opt == "-php-ver="* ]]; then sudo stack -php -purge=force conf_write php-ver $phpver # force flag prevent to be questioned (Unattended) when nginx is not installed. - conf_write delall true + conf_write force-flag true sudo stack -php sudo stack -pma elif [[ $(conf_read php) == "true" && $(conf_read mysql-tool) != "true" ]]; then sudo stack -php -purge=force conf_write php-ver $phpver - conf_write delall true + conf_write force-flag true sudo stack -php elif [[ $(conf_read php) != "true" && $(conf_read mysql-tool) != "true" ]]; then conf_write php-ver $phpver @@ -465,7 +465,7 @@ elif [[ $opt == "-purge-server-all" ]]; then echo "" echo " If you want to remove your sites data use the webinoly command: 'sudo webinoly -delete-all'" echo "" - if [[ $(conf_read delall) != "true" && $force != 1 ]]; then + if [[ $(conf_read force-flag) != "true" && $force != 1 ]]; then echo " ${blu} Are you sure [y/N]? ${end}" while read -r -n 1 -s answer; do answer=${answer:-n} @@ -478,7 +478,7 @@ elif [[ $opt == "-purge-server-all" ]]; then fi if [[ $answer == [Yy] ]]; then - conf_write delall true + conf_write force-flag true [[ $force == 1 ]] && stack -nginx -purge=force || stack -nginx -purge [[ $force == 1 ]] && stack -mysql -purge=force || stack -mysql -purge [[ $force == 1 ]] && stack -php -purge=force || stack -php -purge