File tree Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Expand file tree Collapse file tree 2 files changed +19
-9
lines changed Original file line number Diff line number Diff line change @@ -218,18 +218,28 @@ local PROMPT="$1"
218218 whiptail --msgbox " ${PROMPT} " " $WT_HEIGHT " " $WT_WIDTH "
219219}
220220
221- # Check if program is installed (is_this_installed apache2)
222- is_this_installed () {
221+ # Check if program is installed (stop_if_installed apache2)
222+ stop_if_installed () {
223223if [ " $( dpkg-query -W -f=' ${Status}' " ${1} " 2> /dev/null | grep -c " ok installed" ) " == " 1" ]
224224then
225225 print_text_in_color " $IRed " " ${1} is installed, it must be a clean server."
226226 exit 1
227227fi
228228}
229229
230+ # Check if program is installed (is_this_installed apache2)
231+ is_this_installed () {
232+ if dpkg-query -W -f=' ${Status}' " ${1} " | grep -q " ok installed"
233+ then
234+ return 0
235+ else
236+ return 1
237+ fi
238+ }
239+
230240# Install_if_not program
231241install_if_not () {
232- if [[ " $( is_this_installed " ${1} " ) " != " ${1} is installed, it must be a clean server." ]]
242+ if [[ " $( stop_if_installed " ${1} " ) " != " ${1} is installed, it must be a clean server." ]]
233243then
234244 apt update -q4 & spinner_loading && apt install " ${1} " -y
235245fi
Original file line number Diff line number Diff line change @@ -54,12 +54,12 @@ if ! version 18.04 "$DISTRO" 18.04.4; then
5454fi
5555
5656# Check if it's a clean server
57- is_this_installed postgresql
58- is_this_installed apache2
59- is_this_installed nginx
60- is_this_installed php
61- is_this_installed mysql-common
62- is_this_installed mariadb-server
57+ stop_if_installed postgresql
58+ stop_if_installed apache2
59+ stop_if_installed nginx
60+ stop_if_installed php
61+ stop_if_installed mysql-common
62+ stop_if_installed mariadb-server
6363
6464# Create $SCRIPTS dir
6565if [ ! -d " $SCRIPTS " ]
You can’t perform that action at this time.
0 commit comments