summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2013-01-03 16:16:25 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2013-01-03 16:16:25 +0100
commit6539dfe0df5c19e8acb8fe251b46098a25719cbc (patch)
tree72a2e189ca588b4d3878db73cb7171063287d35e
parentfafa6603f87d68fd6b30dcfd4600cb1006e02a9e (diff)
downloadnetctl-6539dfe0df5c19e8acb8fe251b46098a25719cbc.tar.gz
netctl-6539dfe0df5c19e8acb8fe251b46098a25719cbc.tar.xz
Indentation fixes
This settles a style for 'case' statements: The label and closing colons are indented with two spaces, The body is indented with two more, totalling four spaces.
-rw-r--r--contrib/bash-completion8
-rwxr-xr-xsrc/ifplugd.action40
-rw-r--r--src/lib/8021x12
-rwxr-xr-xsrc/lib/auto.action8
-rw-r--r--src/lib/globals10
-rw-r--r--src/lib/ip32
-rwxr-xr-xsrc/lib/network20
-rwxr-xr-xsrc/netctl-auto22
8 files changed, 76 insertions, 76 deletions
diff --git a/contrib/bash-completion b/contrib/bash-completion
index b47d92b..49f1e6b 100644
--- a/contrib/bash-completion
+++ b/contrib/bash-completion
@@ -11,17 +11,17 @@ _netctl()
case $COMP_CWORD in
1)
COMPREPLY=( $(compgen -W "--help --version list store restore stop-all start stop restart switch-to status enable disable reenable" -- $cur) )
- ;;
+ ;;
2)
case $prev in
start|stop|restart|switch-to|status|enable|disable|reenable)
mapfile -t COMPREPLY < <(IFS=$'\n'; compgen -W "$prof" -- $cur)
- ;;
+ ;;
esac
- ;;
+ ;;
*)
COMPREPLY=()
- ;;
+ ;;
esac
} &&
complete -F _netctl netctl
diff --git a/src/ifplugd.action b/src/ifplugd.action
index 762b504..9716bce 100755
--- a/src/ifplugd.action
+++ b/src/ifplugd.action
@@ -17,34 +17,34 @@ case "$2" in
declare -a dhcp_profiles
declare -a static_profiles
while read -r profile; do
- (
- echo "Reading profile '$profile'"
- source "$PROFILE_DIR/$profile"
- [[ "$Interface" == "$1" && "$Connection" == "ethernet" ]] || continue
- is_yes "${AutoWired:-no}" && exit 1 # user preferred AUTO profile
- [[ "$IP" == "dhcp" ]] && exit 2 # dhcp profile
- exit 3 # static profile
- )
- case $? in
- 1) preferred_profiles+=("$profile");;
- 2) dhcp_profiles+=("$profile");;
- 3) static_profiles+=("$profile");;
- esac
+ (
+ echo "Reading profile '$profile'"
+ source "$PROFILE_DIR/$profile"
+ [[ "$Interface" == "$1" && "$Connection" == "ethernet" ]] || continue
+ is_yes "${AutoWired:-no}" && exit 1 # user preferred AUTO profile
+ [[ "$IP" == "dhcp" ]] && exit 2 # dhcp profile
+ exit 3 # static profile
+ )
+ case $? in
+ 1) preferred_profiles+=("$profile");;
+ 2) dhcp_profiles+=("$profile");;
+ 3) static_profiles+=("$profile");;
+ esac
done < <(list_profiles)
if [[ ${#preferred_profiles[@]} > 1 ]]; then
- echo "AutoWired flag for '$1' set in more than one profile (${preferred_profiles[*]})"
+ echo "AutoWired flag for '$1' set in more than one profile (${preferred_profiles[*]})"
fi
for profile in "${preferred_profiles[@]}" "${dhcp_profiles[@]}" "${static_profiles[@]}"; do
- if ForceConnect=yes "$SUBR_DIR/network" start "$profile"; then
- mkdir -p "$(dirname "$PROFILE_FILE")"
- printf "%s" "$profile" > "$PROFILE_FILE"
- exit 0
- fi
+ if ForceConnect=yes "$SUBR_DIR/network" start "$profile"; then
+ mkdir -p "$(dirname "$PROFILE_FILE")"
+ printf "%s" "$profile" > "$PROFILE_FILE"
+ exit 0
+ fi
done
;;
down)
if [[ -e "$PROFILE_FILE" ]]; then
- "$SUBR_DIR/network" stop "$(< "$PROFILE_FILE")" && rm -f "$PROFILE_FILE"
+ "$SUBR_DIR/network" stop "$(< "$PROFILE_FILE")" && rm -f "$PROFILE_FILE"
fi
;;
*)
diff --git a/src/lib/8021x b/src/lib/8021x
index 1cd4343..fa23dd3 100644
--- a/src/lib/8021x
+++ b/src/lib/8021x
@@ -200,27 +200,27 @@ wpa_make_config_block() {
echo "ssid=$(wpa_quote "$ESSID")"
[[ $AP ]] && echo "bssid=${AP,,}"
is_yes "${AdHoc:-no}" && echo "mode=1"
- ;;
+ ;;
wpa-configsection)
printf "%s\n" "${WPAConfigSection[@]}"
return
- ;;
+ ;;
*)
report_error "Unsupported security setting: '$Security'"
return 1
- ;;
+ ;;
esac
# Key management
case $Security in
none)
echo "key_mgmt=NONE"
- ;;
+ ;;
wep)
echo "key_mgmt=NONE"
echo "wep_tx_keyidx=0"
echo "wep_key0=$(wpa_quote "$Key")"
- ;;
+ ;;
wpa)
echo "proto=RSN WPA"
if [[ "${#Key}" -eq 64 ]]; then
@@ -228,7 +228,7 @@ wpa_make_config_block() {
else
echo "psk=$(wpa_quote "$Key")"
fi
- ;;
+ ;;
esac
# Hidden SSID
diff --git a/src/lib/auto.action b/src/lib/auto.action
index bdbb9ad..ae49384 100755
--- a/src/lib/auto.action
+++ b/src/lib/auto.action
@@ -31,7 +31,7 @@ case $action in
netctl-auto stop "$interface"
exit 1
fi
- ;;
+ ;;
DISCONNECT)
if [[ -z $profile ]]; then
dhcpcd -k "$interface"
@@ -42,15 +42,15 @@ case $action in
exit 1
fi
ip_unset && rm -f "$PROFILE_FILE"
- ;;
+ ;;
LOST|REESTABLISHED)
# Not handled.
exit 0
- ;;
+ ;;
*)
# ???
exit 1
- ;;
+ ;;
esac
diff --git a/src/lib/globals b/src/lib/globals
index 8277a40..51acb0d 100644
--- a/src/lib/globals
+++ b/src/lib/globals
@@ -45,14 +45,14 @@ is_yes() {
case ${1,,} in
yes|true|on|1)
return 0
- ;;
+ ;;
no|false|off|0)
return 1
- ;;
+ ;;
*)
report_error "Not a valid truth value: '$1'"
return 1
- ;;
+ ;;
esac
}
@@ -61,8 +61,8 @@ is_yes() {
## Show what we evaluate when debugging, but always evaluate
do_debug() {
- report_debug "${FUNCNAME[1]}:" "$@"
- "$@"
+ report_debug "${FUNCNAME[1]}:" "$@"
+ "$@"
}
## Exit if we are not effectively root
diff --git a/src/lib/ip b/src/lib/ip
index 02d99f4..f2f787d 100644
--- a/src/lib/ip
+++ b/src/lib/ip
@@ -36,20 +36,20 @@ ip_set() {
report_error "DHCP IP lease attempt failed on interface '$Interface'"
return 1
fi
- ;;
+ ;;
dhclient)
rm -f "/run/dhclient-${Interface}.pid"
if ! do_debug dhclient -q -e "TIMEOUT=${TimeoutDHCP:-10}" -pf "/run/dhclient-$Interface.pid" $DhclientOptions "$Interface"; then
report_error "DHCP IP lease attempt failed on interface '$Interface'"
return 1
fi
- ;;
+ ;;
*)
report_error "Unsupported DHCP client: '$DHCPClient'"
return 1
- ;;
+ ;;
esac
- ;;
+ ;;
static)
if [[ $Address ]]; then
for addr in "${Address[@]}"; do
@@ -66,13 +66,13 @@ ip_set() {
return 1
fi
fi
- ;;
+ ;;
""|no)
- ;;
+ ;;
*)
report_error "IP must be either 'dhcp', 'static' or 'no'"
return 1
- ;;
+ ;;
esac
# Add static IP routes
@@ -89,16 +89,16 @@ ip_set() {
case "$IP6" in
dhcp*|stateless|static)
[[ -d "/proc/sys/net/ipv6" ]] || modprobe ipv6
- ;;
+ ;;
no)
[[ -d "/proc/sys/net/ipv6" ]] && sysctl -q -w "net.ipv6.conf.$interface_sysctl.accept_ra=0"
- ;;
+ ;;
"") # undefined IP6 does not prevent RA's from being received -> nop
- ;;
+ ;;
*)
report_error "IP6 must be 'dhcp', 'dhcp-noaddr', 'stateless', 'static' or 'no'"
return 1
- ;;
+ ;;
esac
case "$IP6" in
@@ -114,10 +114,10 @@ ip_set() {
report_error "DHCPv6 IP lease attempt failed on interface '$Interface'"
return 1
fi
- ;;
+ ;;
stateless)
sysctl -q -w "net.ipv6.conf.$interface_sysctl.accept_ra=1"
- ;;
+ ;;
static)
sysctl -q -w "net.ipv6.conf.$interface_sysctl.accept_ra=0"
if [[ -n $Address6 ]]; then
@@ -127,7 +127,7 @@ ip_set() {
fi
done
fi
- ;;
+ ;;
esac
if [[ $IP6 ]]; then
@@ -193,13 +193,13 @@ ip_unset() {
if [[ -f "/run/dhcpcd-$Interface.pid" ]]; then
do_debug dhcpcd -qk "$Interface" >/dev/null
fi
- ;;
+ ;;
dhclient)
if [[ -f "/run/dhclient-$Interface.pid" ]]; then
# Alternatively, use -r instead of -x to also release the lease
do_debug dhclient -q -x "$Interface" -pf "/run/dhclient-$Interface.pid" >/dev/null
fi
- ;;
+ ;;
esac
fi
if [[ "$IP6" == dhcp* ]]; then
diff --git a/src/lib/network b/src/lib/network
index 1117737..bc11da7 100755
--- a/src/lib/network
+++ b/src/lib/network
@@ -22,19 +22,19 @@ interface_is_up() {
## Activate an interface
# $1: interface name
bring_interface_up() {
- local interface=$1
- ip link set dev "$interface" up &>/dev/null
- timeout_wait "${TimeoutUp:-5}" 'interface_is_up "$interface"'
+ local interface=$1
+ ip link set dev "$interface" up &>/dev/null
+ timeout_wait "${TimeoutUp:-5}" 'interface_is_up "$interface"'
}
## Deactivate an interface
# $1: interface name
bring_interface_down() {
- local interface=$1
- ip addr flush dev "$interface" &>/dev/null
- ip link set dev "$interface" down &>/dev/null
- # We reuse the up timeout (down normally is faster)
- timeout_wait "${TimeoutUp:-5}" '! interface_is_up "$interface"'
+ local interface=$1
+ ip addr flush dev "$interface" &>/dev/null
+ ip link set dev "$interface" down &>/dev/null
+ # We reuse the up timeout (down normally is faster)
+ timeout_wait "${TimeoutUp:-5}" '! interface_is_up "$interface"'
}
@@ -69,7 +69,7 @@ case $1 in
exit 1
fi
report_notice "Started network profile '$Profile'"
- ;;
+ ;;
stop)
report_notice "Stopping network profile '$Profile'..."
# JP: sandbox the eval
@@ -88,7 +88,7 @@ case $1 in
exit 1
fi
report_notice "Stopped network profile '$Profile'"
- ;;
+ ;;
esac
diff --git a/src/netctl-auto b/src/netctl-auto
index 1264469..a799b4b 100755
--- a/src/netctl-auto
+++ b/src/netctl-auto
@@ -35,16 +35,16 @@ case $STARTSTOP in
list_profiles | while read -r profile; do
report_debug "Examining profile '$profile'"
(
- source "$PROFILE_DIR/$profile"
- is_yes "${ExcludeAuto:-no}" && exit 1
- : ${Security:=none}
- [[ $Interface != "$INTERFACE" ]] && exit 1
- [[ $Connection != "wireless" ]] && exit 1
- # Exclude wpa-config, the wpa_conf is 'complete' and doesn't fit in this scheme
- [[ $Security == "wpa-config" ]] && exit 1
+ source "$PROFILE_DIR/$profile"
+ [[ $Interface == "$INTERFACE" ]] || continue
+ is_yes "${ExcludeAuto:-no}" && exit 1
+ [[ $Connection != "wireless" ]] && exit 1
+ : ${Security:=none}
+ # Exclude wpa-config, the wpa_conf is 'complete' and doesn't fit in this scheme
+ [[ $Security == "wpa-config" ]] && exit 1
- printf "%s\n" "network={" "$(wpa_make_config_block)" "id_str=\"$profile\"" "}" >> "$WPA_CONF"
- report_notice "Included profile '$profile'"
+ printf "%s\n" "network={" "$(wpa_make_config_block)" "id_str=\"$profile\"" "}" >> "$WPA_CONF"
+ report_notice "Included profile '$profile'"
)
done
@@ -58,7 +58,7 @@ case $STARTSTOP in
wpa_stop "$INTERFACE"
fi
exit 1
- ;;
+ ;;
stop)
if [[ -e $PROFILE_FILE ]]; then
"$SUBR_DIR/network" stop "$(< "$PROFILE_FILE")" && rm -f "$PROFILE_FILE"
@@ -71,7 +71,7 @@ case $STARTSTOP in
[[ $RFKill ]] && disable_rf "$INTERFACE" "$RFKill"
fi
timeout_wait 1 '[[ ! -f "$PIDFILE" ]]' || kill "$(< "$PIDFILE")"
- ;;
+ ;;
esac