From: Marcin Siodelski Date: Wed, 4 Jun 2014 16:13:23 +0000 (+0200) Subject: [3422] Implemented option parsing in the keactrl script. X-Git-Tag: trac3434_base~6^2~23 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=200b4ebc88a403455f0563e002a2c46b9c5ecc97;p=thirdparty%2Fkea.git [3422] Implemented option parsing in the keactrl script. --- diff --git a/src/bin/keactrl/keactrl.in b/src/bin/keactrl/keactrl.in index 52ac44d819..46399ce31e 100644 --- a/src/bin/keactrl/keactrl.in +++ b/src/bin/keactrl/keactrl.in @@ -23,9 +23,29 @@ else dhcp_ddns=@libexecdir@/@PACKAGE@/b10-dhcp-ddns fi -# Currently, it doesn't do anything useful. Just prints the locations -# of the binaries. -printf "${dhcpv4_srv}\n" -printf "${dhcpv6_srv}\n" -printf "${dhcp_ddns}\n" +optstring=c:v:46 + +config_file= +verbose=0 +kea4=0 +kea6=0 + +while getopts ${optstring} opt +do + case ${opt} in + c) config_file=${OPTARG} ;; + v) verbose=$(( ${verbose} + 1 )) ;; + 4) kea4=$(( ${kea4} + 1 )) ;; + 6) kea6=$(( ${kea6} + 1 )) ;; + *) exit 1; + esac +done + +if [ ${kea4} -eq 0 -a ${kea6} -eq 0 ]; then + kea4=1 + kea6=1 +fi + +printf "${kea4}\n" +printf "${kea6}\n"