Skip to content

Commit aeffd34

Browse files
authored
last print_text_in_color changes
1 parent 1bb9f2f commit aeffd34

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

lib.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ fi
211211
# Check if $1 is open using nmap, if not notify the user
212212
if [ "$(nmap -sS -p "$1" "$WANIP4" | grep -c "open")" == "1" ]
213213
then
214-
printf "${Green}Port $1 is open on $WANIP4!${Color_Off}\n"
214+
print_text_in_color "$ICyan" "Port $1 is open on $WANIP4!"
215215
if [ "$NMAPSTATUS" = "preinstalled" ]
216216
then
217217
print_text_in_color "$ICyan" "nmap was previously installed, not removing."
@@ -222,7 +222,7 @@ else
222222
whiptail --msgbox "Port $1 is not open on $WANIP4. We will do a second try on $2 instead." "$WT_HEIGHT" "$WT_WIDTH"
223223
if [[ "$(nmap -sS -PN -p "$1" "$2" | grep -m 1 "open" | awk '{print $2}')" = "open" ]]
224224
then
225-
printf "${Green}Port $1 is open on $2!${Color_Off}\n"
225+
print_text_in_color "$ICyan" "Port $1 is open on $2!"
226226
if [ "$NMAPSTATUS" = "preinstalled" ]
227227
then
228228
print_text_in_color "$ICyan" "nmap was previously installed, not removing."
@@ -284,19 +284,22 @@ If you think that this is a bug, please report it to https://github.com/nextclou
284284
fi
285285
}
286286

287-
# Test RAM size
287+
# Test RAM size
288288
# Call it like this: ram_check [amount of min RAM in GB] [for which program]
289289
# Example: ram_check 2 Wordpress
290290
ram_check() {
291291
mem_available="$(awk '/MemTotal/{print $2}' /proc/meminfo)"
292292
if [ "${mem_available}" -lt "$((${1}*1002400))" ]
293293
then
294-
printf "${Red}Error: ${1} GB RAM required to install ${2}!${Color_Off}\n" >&2
295-
printf "${Red}Current RAM is: ("$((mem_available/1002400))" GB)${Color_Off}\n" >&2
294+
print_text_in_color "${Red}" "Error: ${1} GB RAM required to install ${2}!" >&2
295+
print_text_in_color "${Red}" "Current RAM is: ("$((mem_available/1002400))" GB)" >&2
296296
sleep 3
297+
msg_box "If you want to bypass this check you could do so by commenting out (# before the line) 'ram_check X' in the script that you are trying to run.
298+
In nextcloud_install_production.sh you can find the check somewhere around line #34.
299+
Please notice that things may be veery slow and not work as expeced. YOU HAVE BEEN WARNED!"
297300
exit 1
298301
else
299-
printf "${Green}RAM for ${2} OK! ("$((mem_available/1002400))" GB)${Color_Off}\n"
302+
print_text_in_color "${IGreen}" "RAM for ${2} OK! ($((mem_available/1002400)) GB)"
300303
fi
301304
}
302305

@@ -307,19 +310,19 @@ cpu_check() {
307310
nr_cpu="$(nproc)"
308311
if [ "${nr_cpu}" -lt "${1}" ]
309312
then
310-
printf "${Red}Error: ${1} CPU required to install ${2}!${Color_Off}\n" >&2
311-
printf "${Red}Current CPU: ("$((nr_cpu))")${Color_Off}\n" >&2
313+
print_text_in_color "${Red}" "Error: ${1} CPU required to install ${2}!" >&2
314+
print_text_in_color "${Red}" "Current CPU: ($((nr_cpu)))" >&2
312315
sleep 3
313316
exit 1
314317
else
315-
printf "${Green}CPU for ${2} OK! ("$((nr_cpu))")${Color_Off}\n"
318+
print_text_in_color "${IGreen}" "CPU for ${2} OK! ($((nr_cpu)))"
316319
fi
317320
}
318321

319322
check_command() {
320323
if ! "$@";
321324
then
322-
printf "${IRed}Sorry but something went wrong. Please report this issue to $ISSUES and include the output of the error message. Thank you!${Color_Off}\n"
325+
print_text_in_color "${Red}" Sorry but something went wrong. Please report this issue to $ISSUES and include the output of the error message. Thank you!"
323326
print_text_in_color "$IRed" "$* failed"
324327
exit 1
325328
fi

0 commit comments

Comments
 (0)