refs #273 adds mask2cidr function to convert masks syntax

ogboot_installer
Luis Gerardo Romero Garcia 2024-05-08 09:24:21 +02:00
parent 1b3e59cb8e
commit 6ca77a9367
1 changed files with 11 additions and 0 deletions

View File

@ -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