diff options
author | Linus Nordberg <linus@nordu.net> | 2011-05-31 14:25:14 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2011-05-31 14:31:58 +0200 |
commit | fa01d8dda3f32b3203c6fbaa4dd3c600d76eeaff (patch) | |
tree | 2ae57260de5b7acf81ca04ca213253d569263ad3 | |
parent | 6886c5f57ceb4db04c2e4e4a3d52da1d233698dc (diff) |
Reindent tools/naptr-eduroam.sh.
-rwxr-xr-x[-rw-r--r--] | tools/naptr-eduroam.sh | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/tools/naptr-eduroam.sh b/tools/naptr-eduroam.sh index 9bc6c45..5f04704 100644..100755 --- a/tools/naptr-eduroam.sh +++ b/tools/naptr-eduroam.sh @@ -8,8 +8,8 @@ # For host command this is coloumn 5, for dig it is coloumn 1. usage() { - echo "Usage: ${0} <realm>" - exit 1 + echo "Usage: ${0} <realm>" + exit 1 } test -n "${1}" || usage @@ -19,54 +19,55 @@ DIGCMD=$(command -v dig) HOSTCMD=$(command -v host) dig_it_srv() { - ${DIGCMD} +short srv $SRV_HOST | sort -k1 | - while read line ; do - set $line ; PORT=$3 ; HOST=$4 - echo -e "\thost ${HOST%.}:${PORT}" - done + ${DIGCMD} +short srv $SRV_HOST | sort -k1 | + while read line ; do + set $line ; PORT=$3 ; HOST=$4 + echo -e "\thost ${HOST%.}:${PORT}" + done } dig_it_naptr() { - ${DIGCMD} +short naptr ${REALM} | grep x-eduroam:radius.tls | sort -k1 | - while read line ; do - set $line ; TYPE=$3 ; HOST=$6 - if [ "$TYPE" == "\"s\"" ]; then { - SRV_HOST=${HOST%.} - dig_it_srv; }; fi - done + ${DIGCMD} +short naptr ${REALM} | grep x-eduroam:radius.tls | sort -k1 | + while read line ; do + set $line ; TYPE=$3 ; HOST=$6 + if [ "$TYPE" == "\"s\"" ]; then { + SRV_HOST=${HOST%.} + dig_it_srv; }; + fi + done } host_it_srv() { - ${HOSTCMD} -t srv $SRV_HOST | sort -k5 | - while read line ; do - set $line ; PORT=$7 ; HOST=$8 - echo -e "\thost ${HOST%.}:${PORT}" - done + ${HOSTCMD} -t srv $SRV_HOST | sort -k5 | + while read line ; do + set $line ; PORT=$7 ; HOST=$8 + echo -e "\thost ${HOST%.}:${PORT}" + done } host_it_naptr() { - ${HOSTCMD} -t naptr ${REALM} | grep x-eduroam:radius.tls | sort -k5 | - while read line ; do - set $line ; TYPE=$7 ; HOST=${10} - if [ "$TYPE" == "\"s\"" ]; then { - SRV_HOST=${HOST%.} - host_it_srv; }; fi - - done + ${HOSTCMD} -t naptr ${REALM} | grep x-eduroam:radius.tls | sort -k5 | + while read line ; do + set $line ; TYPE=$7 ; HOST=${10} + if [ "$TYPE" == "\"s\"" ]; then { + SRV_HOST=${HOST%.} + host_it_srv; }; fi + + done } if test -x "${DIGCMD}" ; then - SERVERS=$(dig_it_naptr) + SERVERS=$(dig_it_naptr) elif test -x "${HOSTCMD}" ; then - SERVERS=$(host_it_naptr) + SERVERS=$(host_it_naptr) else - echo "${0} requires either \"dig\" or \"host\" command." - exit 1 + echo "${0} requires either \"dig\" or \"host\" command." + exit 1 fi if test -n "${SERVERS}" ; then - echo -e "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}" - exit 0 + echo -e "server dynamic_radsec.${REALM} {\n${SERVERS}\n\ttype TLS\n}" + exit 0 fi exit 0 |