infest: rm netmaskToPrefixLengh
This commit is contained in:
parent
c5b8e0d368
commit
ee82c6df3a
15
infest
15
infest
@ -43,10 +43,6 @@ main() {
|
|||||||
infest_centos7_64bit() {
|
infest_centos7_64bit() {
|
||||||
server=$1
|
server=$1
|
||||||
address=$(echo $server | jq -r .ip)
|
address=$(echo $server | jq -r .ip)
|
||||||
gateway=$(echo $server | jq -r .gateway)
|
|
||||||
nameserver=8.8.8.8
|
|
||||||
netmask=$(echo $server | jq -r .netmask)
|
|
||||||
prefixLength=$(netmaskToPrefixLengh $netmask)
|
|
||||||
RSYNC_RSH='sshpass -e ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
RSYNC_RSH='sshpass -e ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
||||||
SSHPASS=$(echo $server | jq -r .rootpass)
|
SSHPASS=$(echo $server | jq -r .rootpass)
|
||||||
export SSHPASS
|
export SSHPASS
|
||||||
@ -188,15 +184,4 @@ infest_centos7_64bit() {
|
|||||||
/bin/sh
|
/bin/sh
|
||||||
}
|
}
|
||||||
|
|
||||||
netmaskToPrefixLengh() {
|
|
||||||
binaryNetmask=$(echo $1 | sed 's/^/obase=2;/;s/\./;/g' | bc | tr -d \\n)
|
|
||||||
binaryPrefix=$(echo $binaryNetmask | sed -n 's/^\(1*\)0*$/\1/p')
|
|
||||||
if ! echo $binaryPrefix | grep -q .; then
|
|
||||||
echo $0: bad netmask: $netmask >&2
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
printf %s $binaryPrefix | tr -d 0 | wc -c
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
main "$@"
|
main "$@"
|
||||||
|
Loading…
Reference in New Issue
Block a user