Skip to content

Commit

Permalink
Fix default interface bindings (fourth time)
Browse files Browse the repository at this point in the history
The following changes introduced in Bash 4.3 necessitate this commit:
- Setting the array attribute no longer initializes an array.
- Empty-but-set arrays no longer pass [[ -v ]].

Previous attempts:
feb669f
711c464
e821082
  • Loading branch information
joukewitteveen committed May 6, 2014
1 parent e9c36cc commit b4f7bf8
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/lib/connections/bond
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

. "$SUBR_DIR/ip"

declare -ag BindsToInterfaces
# Make sure BindsToInterfaces is set
BindsToInterfaces=("${BindsToInterfaces[@]}")

bond_up() {
if is_interface "$Interface"; then
Expand Down
3 changes: 2 additions & 1 deletion src/lib/connections/bridge
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

. "$SUBR_DIR/ip"

declare -ag BindsToInterfaces
# Make sure BindsToInterfaces is set
BindsToInterfaces=("${BindsToInterfaces[@]}")

bridge_up() {
if is_interface "$Interface"; then
Expand Down
3 changes: 2 additions & 1 deletion src/lib/connections/dummy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

. "$SUBR_DIR/ip"

declare -ag BindsToInterfaces
# Make sure BindsToInterfaces is set
BindsToInterfaces=("${BindsToInterfaces[@]}")

dummy_up() {
if is_interface "$Interface"; then
Expand Down
3 changes: 2 additions & 1 deletion src/lib/connections/tunnel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

. "$SUBR_DIR/ip"

declare -ag BindsToInterfaces
# Make sure BindsToInterfaces is set
BindsToInterfaces=("${BindsToInterfaces[@]}")

tunnel_up() {
if is_interface "$Interface"; then
Expand Down
3 changes: 2 additions & 1 deletion src/lib/connections/tuntap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

. "$SUBR_DIR/ip"

declare -ag BindsToInterfaces
# Make sure BindsToInterfaces is set
BindsToInterfaces=("${BindsToInterfaces[@]}")

tuntap_up() {
if is_interface "$Interface"; then
Expand Down
2 changes: 1 addition & 1 deletion src/netctl.in
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ unit_enable() {
echo ".include @systemdsystemunitdir@/netctl@.service" > "$unit"
echo -e "\n[Unit]" >> "$unit"
[[ -n $Description ]] && echo "Description=$Description" >> "$unit"
[[ -v BindsToInterfaces ]] || BindsToInterfaces=$Interface
declare -p BindsToInterfaces &> /dev/null || BindsToInterfaces=$Interface
if (( ${#BindsToInterfaces[@]} )); then
: ${InterfaceRoot=sys/subsystem/net/devices/}
printf "BindsTo=$(sd_escape "$InterfaceRoot")%s.device\n" \
Expand Down

0 comments on commit b4f7bf8

Please sign in to comment.