[arch-projects] [netctl][PACH] Fix default interface bindings (fourth time)

Jouke Witteveen j.witteveen at gmail.com
Sat Apr 26 18:30:35 EDT 2014


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:
feb669f4b2a15e6ea1d84be336f12be4650f9d2d
711c46457ae9fef52c7c529d89c67d0d526f73ef
e8210827fd59e4539a70af55cb452b211633fedd
---
 src/lib/connections/bond   | 2 +-
 src/lib/connections/bridge | 2 +-
 src/lib/connections/dummy  | 2 +-
 src/lib/connections/tunnel | 2 +-
 src/lib/connections/tuntap | 2 +-
 src/netctl.in              | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lib/connections/bond b/src/lib/connections/bond
index 2909b90..cf6da54 100644
--- a/src/lib/connections/bond
+++ b/src/lib/connections/bond
@@ -2,7 +2,7 @@
 
 . "$SUBR_DIR/ip"
 
-declare -ag BindsToInterfaces
+BindsToInterfaces=("${BindsToInterfaces[@]}")
 
 bond_up() {
     if is_interface "$Interface"; then
diff --git a/src/lib/connections/bridge b/src/lib/connections/bridge
index 1b25f2b..3d8f55f 100644
--- a/src/lib/connections/bridge
+++ b/src/lib/connections/bridge
@@ -2,7 +2,7 @@
 
 . "$SUBR_DIR/ip"
 
-declare -ag BindsToInterfaces
+BindsToInterfaces=("${BindsToInterfaces[@]}")
 
 bridge_up() {
     if is_interface "$Interface"; then
diff --git a/src/lib/connections/dummy b/src/lib/connections/dummy
index 5a12d1e..1b33516 100644
--- a/src/lib/connections/dummy
+++ b/src/lib/connections/dummy
@@ -2,7 +2,7 @@
 
 . "$SUBR_DIR/ip"
 
-declare -ag BindsToInterfaces
+BindsToInterfaces=("${BindsToInterfaces[@]}")
 
 dummy_up() {
     if is_interface "$Interface"; then
diff --git a/src/lib/connections/tunnel b/src/lib/connections/tunnel
index ab62cc7..9c51af5 100644
--- a/src/lib/connections/tunnel
+++ b/src/lib/connections/tunnel
@@ -2,7 +2,7 @@
 
 . "$SUBR_DIR/ip"
 
-declare -ag BindsToInterfaces
+BindsToInterfaces=("${BindsToInterfaces[@]}")
 
 tunnel_up() {
     if is_interface "$Interface"; then
diff --git a/src/lib/connections/tuntap b/src/lib/connections/tuntap
index 2c00839..2026f5b 100644
--- a/src/lib/connections/tuntap
+++ b/src/lib/connections/tuntap
@@ -2,7 +2,7 @@
 
 . "$SUBR_DIR/ip"
 
-declare -ag BindsToInterfaces
+BindsToInterfaces=("${BindsToInterfaces[@]}")
 
 tuntap_up() {
     if is_interface "$Interface"; then
diff --git a/src/netctl.in b/src/netctl.in
index 6babecf..dc19ab0 100644
--- a/src/netctl.in
+++ b/src/netctl.in
@@ -111,7 +111,7 @@ unit_enable() {
     echo ".include @systemdsystemunitdir@/netctl at .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" \
-- 
1.9.2



More information about the arch-projects mailing list