You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use the run.sh script on Alpine linux (which uses busybox). I ran into 2 issues with the run.sh script:
Busybox 'ash' does not have arrays like bash does
Busybox tail does not support the --pid argument
Busybox 'trap' does not properly handle 'EXIT' signals
I fixed (1) by manually splitting the $LAN_PARENT, and (2) by using 'docker wait'. I haven't found a good solution for (3) yet. using trap _cleanup EXIT INT TERM doesn't seem to work either. Even if I end up installing bash, the fix for (2) is still needed though.
diff --git a/run.sh b/run.sh
index a09bf3a..88c06f3 100755
--- a/run.sh
+++ b/run.sh
@@ -172,9 +172,10 @@ _prepare_network() {
LAN_IFACE=br-${LAN_ID:0:12}
# test if $LAN_PARENT is a VLAN of $WAN_PARENT, create it if it doesn't exist and add it to the bridge
- local lan_array=(${LAN_PARENT//./ })
- if [[ ${lan_array[0]} = $WAN_PARENT ]] && ! ip link show $LAN_PARENT >/dev/null 2>&1 ; then
- sudo ip link add link ${lan_array[0]} name $LAN_PARENT type vlan id ${lan_array[1]}
+ local lan_parent_iface=$(echo $LAN_PARENT | cut -d. -f1)
+ local lan_parent_vlan=$(echo $LAN_PARENT | cut -d. -f2)
+ if [[ ${lan_parent_iface} = $WAN_PARENT ]] && ! ip link show $LAN_PARENT >/dev/null 2>&1 ; then
+ sudo ip link add link ${lan_parent_iface} name $LAN_PARENT type vlan id ${lan_parent_vlan}
fi
sudo ip link set $LAN_PARENT master $LAN_IFACE
;;
@@ -220,4 +221,4 @@ main() {
main
trap "_cleanup" EXIT
-tail --pid=$pid -f /dev/null
+docker wait $CONTAINER
The text was updated successfully, but these errors were encountered:
Yes, I could install bash, but I'm trying to keep the set of installed packages on the base image at an absolute minimum (just enough to run docker).
You only have a single bash array (that I've run into) today and the 'cut' method above seems to work to eliminate it.
I am trying to use the run.sh script on Alpine linux (which uses busybox). I ran into 2 issues with the run.sh script:
I fixed (1) by manually splitting the $LAN_PARENT, and (2) by using 'docker wait'. I haven't found a good solution for (3) yet. using
trap _cleanup EXIT INT TERM
doesn't seem to work either. Even if I end up installing bash, the fix for (2) is still needed though.The text was updated successfully, but these errors were encountered: