From 6ca77a93678bfd39f094c211ece64d4a5c913393 Mon Sep 17 00:00:00 2001 From: lgromero Date: Wed, 8 May 2024 09:24:21 +0200 Subject: [PATCH] refs #273 adds mask2cidr function to convert masks syntax --- installer/ogboot_installer.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/installer/ogboot_installer.sh b/installer/ogboot_installer.sh index 56529f1..f2ff08f 100644 --- a/installer/ogboot_installer.sh +++ b/installer/ogboot_installer.sh @@ -721,6 +721,16 @@ function backupFile() echoAndLog "${FUNCNAME}(): $file backup success" } +mask2cidr() { + IFS='.' read -ra ADDR <<< "$1" + CIDR=0 + for i in "${ADDR[@]}"; do + CIDR=$((CIDR+$(echo "obase=2; ibase=10; $i" | bc | tr -cd '1' | wc -c))) + done + echo $CIDR +} + + ########################################################################## ################################main###################################### @@ -791,6 +801,7 @@ if [ $? -ne 0 ]; then exit 1 fi + #downloadComposer # #runComposer