Enforce function declaration format in bash8
Check that function calls look like ^function foo {$ in bash8, and fix
all existing failures of that check. Add a note to HACKING.rst
Change-Id: Ic19eecb39e0b20273d1bcd551a42fe400d54e938
diff --git a/tools/install_openvpn.sh b/tools/install_openvpn.sh
index 2f52aa1..9a4f036 100755
--- a/tools/install_openvpn.sh
+++ b/tools/install_openvpn.sh
@@ -22,7 +22,7 @@
fi
# Do some IP manipulation
-function cidr2netmask() {
+function cidr2netmask {
set -- $(( 5 - ($1 / 8) )) 255 255 255 255 $(( (255 << (8 - ($1 % 8))) & 255 )) 0 0 0
if [[ $1 -gt 1 ]]; then
shift $1
@@ -50,7 +50,7 @@
VPN_DIR=/etc/openvpn
CA_DIR=$VPN_DIR/easy-rsa
-usage() {
+function usage {
echo "$0 - OpenVPN install and certificate generation"
echo ""
echo "$0 --client name"
@@ -102,7 +102,7 @@
openvpn --genkey --secret $CA_DIR/keys/ta.key ## Build a TLS key
fi
-do_server() {
+function do_server {
NAME=$1
# Generate server certificate
$CA_DIR/pkitool --server $NAME
@@ -162,7 +162,7 @@
/etc/init.d/openvpn restart
}
-do_client() {
+function do_client {
NAME=$1
# Generate a client certificate
$CA_DIR/pkitool $NAME