aboutsummaryrefslogtreecommitdiffstats
path: root/run.sh
diff options
context:
space:
mode:
authorMichael Grote2024-06-05 21:10:07 +0200
committerMichael Grote2024-06-05 21:10:07 +0200
commitcbc3022e3190f0736f23f55e131d26e1b55ef67a (patch)
treee656120df2ea7b2f213fa4a2f4e5419ec6bcf2f7 /run.sh
parentad68beab3e574d430fd73a60556025460391774f (diff)
fix shellcheck errorsHEADmaster
Signed-off-by: Michael Grote <michael.grote@posteo.de>
Diffstat (limited to 'run.sh')
-rw-r--r--run.sh13
1 files changed, 7 insertions, 6 deletions
diff --git a/run.sh b/run.sh
index 427b838..00d5998 100644
--- a/run.sh
+++ b/run.sh
@@ -10,15 +10,16 @@ if [[ -z "$VLANS" ]];then
exit 1
fi
# build interface list with parent interface and vlan ids
-ALLVLANIF=$(echo -n $VLANS | sed -re "s/\b([0-9]+)/${INTERFACE}.\1/g")
+ALLVLANIF=$(echo -n "$VLANS" | sed -re "s/\b([0-9]+)/${INTERFACE}.\1/g")
# get MTU of parent interface
MTU=$(ip link show $INTERFACE | grep -Ei 'mtu \d+' | cut -d " " -f2)
# cleanup non used vlan interfaces
-for VLAN in $(ls -1 /sys/class/net | grep -E "^${INTERFACE}\\." | grep -Ev "$(echo $ALLVLANIF | tr ' ' '|')") ;do
+# shellcheck disable=SC2010
+for VLAN in $(ls -1 /sys/class/net | grep -E "^${INTERFACE}\\." | grep -Ev "$(echo "$ALLVLANIF" | tr ' ' '|')") ;do
echo "Deleting orphaned interface: $VLAN"
- ip link delete $VLAN
+ ip link delete "$VLAN"
done
# for each vlan id
@@ -27,7 +28,7 @@ for VLAN in $VLANS; do
# create vlan interface
[[ ! -d "/sys/class/net/${VLANIF}" ]] && {
echo "Creating interface ${VLANIF}"
- ip link add link $INTERFACE name "$VLANIF" mtu $MTU type vlan id $VLAN
+ ip link add link $INTERFACE name "$VLANIF" mtu "$MTU" type vlan id "$VLAN"
}
echo "Bring up $VLANIF interface"
ip link set "$VLANIF" up
@@ -38,9 +39,9 @@ for VLAN in $VLANS; do
rm "/var/run/udhcpc.${VLANIF}.pid"
}
echo "Starting dhcp client on ${VLANIF}"
- udhcpc -b -i $VLANIF -x hostname:"$HOSTNAME" -p "/var/run/udhcpc.${VLANIF}.pid"
+ udhcpc -b -i "$VLANIF" -x hostname:"$HOSTNAME" -p "/var/run/udhcpc.${VLANIF}.pid"
done
echo "Starting mDNS repeater process ... "
# run repeater on vlan interfaces
-exec /bin/mdns-repeater -f $ALLVLANIF
+exec /bin/mdns-repeater -f "$ALLVLANIF"