Commit 0ada3802 authored by Evan Hunt's avatar Evan Hunt
Browse files

[master] awk portability fix

parent a0b4f6d9
...@@ -894,11 +894,13 @@ n=`expr $n + 1` ...@@ -894,11 +894,13 @@ n=`expr $n + 1`
echo "I:testing updating inline secure serial via 'rndc signing -serial' ($n)" echo "I:testing updating inline secure serial via 'rndc signing -serial' ($n)"
ret=0 ret=0
$DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.n3.pre.test$n $DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.n3.pre.test$n
newserial=`awk '$4 == "SOA" { print $7 + 10}' dig.out.n3.pre.test$n` # NOTE: use printf("%u") instead of print, to work around a bug in old
# awk implememntations that convert ints > 999999 to scientific notation
newserial=`awk '$4 == "SOA" { printf("%u\n", $7 + 10) }' dig.out.n3.pre.test$n`
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 signing -serial ${newserial:-0} nsec3 > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 signing -serial ${newserial:-0} nsec3 > /dev/null 2>&1
sleep 1 sleep 1
$DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.ns3.post.test$n $DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.ns3.post.test$n
serial=`awk '$4 == "SOA" { print $7 }' dig.out.ns3.post.test$n` serial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.ns3.post.test$n`
[ ${newserial:-0} -eq ${serial:-1} ] || ret=1 [ ${newserial:-0} -eq ${serial:-1} ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret` status=`expr $status + $ret`
...@@ -907,8 +909,8 @@ n=`expr $n + 1` ...@@ -907,8 +909,8 @@ n=`expr $n + 1`
echo "I:testing updating inline secure serial via 'rndc signing -serial' with negative change ($n)" echo "I:testing updating inline secure serial via 'rndc signing -serial' with negative change ($n)"
ret=0 ret=0
$DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.n3.pre.test$n $DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.n3.pre.test$n
oldserial=`awk '$4 == "SOA" { print $7 }' dig.out.n3.pre.test$n` oldserial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.n3.pre.test$n`
newserial=`awk '$4 == "SOA" { print $7 - 10}' dig.out.n3.pre.test$n` newserial=`awk '$4 == "SOA" { printf("%u\n", $7 - 10) }' dig.out.n3.pre.test$n`
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 signing -serial ${newserial:-0} nsec3 > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 signing -serial ${newserial:-0} nsec3 > /dev/null 2>&1
sleep 1 sleep 1
$DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.ns3.post.test$n $DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.ns3.post.test$n
...@@ -924,14 +926,14 @@ n=`expr $n + 1` ...@@ -924,14 +926,14 @@ n=`expr $n + 1`
echo "I:testing updating inline secure serial via 'rndc signing -serial' when frozen ($n)" echo "I:testing updating inline secure serial via 'rndc signing -serial' when frozen ($n)"
ret=0 ret=0
$DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.n3.pre.test$n $DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.n3.pre.test$n
oldserial=`awk '$4 == "SOA" { print $7 }' dig.out.n3.pre.test$n` oldserial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.n3.pre.test$n`
newserial=`awk '$4 == "SOA" { print $7 + 10}' dig.out.n3.pre.test$n` newserial=`awk '$4 == "SOA" { printf("%u\n", $7 + 10) }' dig.out.n3.pre.test$n`
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 freeze nsec3 > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 freeze nsec3 > /dev/null 2>&1
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 signing -serial ${newserial:-0} nsec3 > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 signing -serial ${newserial:-0} nsec3 > /dev/null 2>&1
$RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 thaw nsec3 > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.3 -p 9953 thaw nsec3 > /dev/null 2>&1
sleep 1 sleep 1
$DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.ns3.post.test$n $DIG nsec3. SOA -p 5300 @10.53.0.3 > dig.out.ns3.post.test$n
serial=`awk '$4 == "SOA" { print $7 }' dig.out.ns3.post.test$n` serial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.ns3.post.test$n`
[ ${newserial:-0} -eq ${serial:-1} ] || ret=1 [ ${newserial:-0} -eq ${serial:-1} ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret` status=`expr $status + $ret`
...@@ -940,11 +942,11 @@ n=`expr $n + 1` ...@@ -940,11 +942,11 @@ n=`expr $n + 1`
echo "I:testing updating dynamic serial via 'rndc signing -serial' ($n)" echo "I:testing updating dynamic serial via 'rndc signing -serial' ($n)"
ret=0 ret=0
$DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.pre.test$n $DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.pre.test$n
newserial=`awk '$4 == "SOA" { print $7 + 10}' dig.out.ns2.pre.test$n` newserial=`awk '$4 == "SOA" { printf("%u\n", $7 + 10) }' dig.out.ns2.pre.test$n`
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 signing -serial ${newserial:-0} bits > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 signing -serial ${newserial:-0} bits > /dev/null 2>&1
sleep 1 sleep 1
$DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.post.test$n $DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.post.test$n
serial=`awk '$4 == "SOA" { print $7 }' dig.out.ns2.post.test$n` serial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.ns2.post.test$n`
[ ${newserial:-0} -eq ${serial:-1} ] || ret=1 [ ${newserial:-0} -eq ${serial:-1} ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret` status=`expr $status + $ret`
...@@ -953,12 +955,12 @@ n=`expr $n + 1` ...@@ -953,12 +955,12 @@ n=`expr $n + 1`
echo "I:testing updating dynamic serial via 'rndc signing -serial' with negative change ($n)" echo "I:testing updating dynamic serial via 'rndc signing -serial' with negative change ($n)"
ret=0 ret=0
$DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.pre.test$n $DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.pre.test$n
oldserial=`awk '$4 == "SOA" { print $7 }' dig.out.ns2.pre.test$n` oldserial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.ns2.pre.test$n`
newserial=`awk '$4 == "SOA" { print $7 - 10}' dig.out.ns2.pre.test$n` newserial=`awk '$4 == "SOA" { printf("%u\n", $7 - 10) }' dig.out.ns2.pre.test$n`
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 signing -serial ${newserial:-0} bits > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 signing -serial ${newserial:-0} bits > /dev/null 2>&1
sleep 1 sleep 1
$DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.post.test$n $DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.post.test$n
serial=`awk '$4 == "SOA" { print $7 }' dig.out.ns2.post.test$n` serial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.ns2.post.test$n`
[ ${oldserial:-0} -eq ${serial:-1} ] || ret=1 [ ${oldserial:-0} -eq ${serial:-1} ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret` status=`expr $status + $ret`
...@@ -967,14 +969,14 @@ n=`expr $n + 1` ...@@ -967,14 +969,14 @@ n=`expr $n + 1`
echo "I:testing updating dynamic serial via 'rndc signing -serial' when frozen ($n)" echo "I:testing updating dynamic serial via 'rndc signing -serial' when frozen ($n)"
ret=0 ret=0
$DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.pre.test$n $DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.pre.test$n
oldserial=`awk '$4 == "SOA" { print $7 }' dig.out.ns2.pre.test$n` oldserial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.ns2.pre.test$n`
newserial=`awk '$4 == "SOA" { print $7 + 10}' dig.out.ns2.pre.test$n` newserial=`awk '$4 == "SOA" { printf("%u\n", $7 + 10) }' dig.out.ns2.pre.test$n`
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 freeze bits > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 freeze bits > /dev/null 2>&1
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 signing -serial ${newserial:-0} bits > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 signing -serial ${newserial:-0} bits > /dev/null 2>&1
$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 thaw bits > /dev/null 2>&1 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 thaw bits > /dev/null 2>&1
sleep 1 sleep 1
$DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.post.test$n $DIG bits. SOA -p 5300 @10.53.0.2 > dig.out.ns2.post.test$n
serial=`awk '$4 == "SOA" { print $7 }' dig.out.ns2.post.test$n` serial=`awk '$4 == "SOA" { printf("%u\n", $7) }' dig.out.ns2.post.test$n`
[ ${oldserial:-0} -eq ${serial:-1} ] || ret=1 [ ${oldserial:-0} -eq ${serial:-1} ] || ret=1
if [ $ret != 0 ]; then echo "I:failed"; fi if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret` status=`expr $status + $ret`
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment