Merge pull request #2 from Red5d/patch-1
Calculate correct netmask in case prefixlen is not 24, 20, or 16
This commit is contained in:
commit
6692713656
33
install.sh
33
install.sh
|
@ -267,17 +267,28 @@ postbootstrap_configuration() {
|
||||||
read ignored netmask <&${grepfd}
|
read ignored netmask <&${grepfd}
|
||||||
read ignored gateway <&${grepfd}
|
read ignored gateway <&${grepfd}
|
||||||
exec {grepfd}<&-
|
exec {grepfd}<&-
|
||||||
case ${netmask} in
|
mask2cidr() {
|
||||||
255.255.255.0)
|
nbits=0
|
||||||
prefixlen=24
|
IFS=.
|
||||||
;;
|
for dec in $1 ; do
|
||||||
255.255.240.0)
|
case $dec in
|
||||||
prefixlen=20
|
255) let nbits+=8;;
|
||||||
;;
|
254) let nbits+=7;;
|
||||||
255.255.0.0)
|
252) let nbits+=6;;
|
||||||
prefixlen=16
|
248) let nbits+=5;;
|
||||||
;;
|
240) let nbits+=4;;
|
||||||
esac
|
224) let nbits+=3;;
|
||||||
|
192) let nbits+=2;;
|
||||||
|
128) let nbits+=1;;
|
||||||
|
0);;
|
||||||
|
*) echo "Error: $dec is not recognised"; exit 1
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
echo "$nbits"
|
||||||
|
}
|
||||||
|
|
||||||
|
prefixlen=$(mask2cidr ${netmask})
|
||||||
|
|
||||||
cat > /archroot/etc/systemd/network/internet.network <<EOF
|
cat > /archroot/etc/systemd/network/internet.network <<EOF
|
||||||
[Match]
|
[Match]
|
||||||
Name=eth0
|
Name=eth0
|
||||||
|
|
Loading…
Reference in New Issue