From 999f9d40096a39ee38f813275dc0b733fe2ce438 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 23 Jul 2018 12:18:15 +0200 Subject: [dhcpc-busybox] Lowercase variable names UID collided with a read-only bash builtin. It's recommended anyways to use lowercase variable names in shell scripts, so let's do this... --- .../data/opt/openslx/scripts/systemd-udhcpc++ | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'core/modules/dhcpc-busybox') diff --git a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ index 4548d1d1..608ec846 100755 --- a/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ +++ b/core/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ @@ -1,27 +1,27 @@ #!/bin/bash -NET_IF="$1" -NET_IP="$(ip addr show dev "${NET_IF}" | grep -m1 '^\s*inet ' | awk -F " " '{print $2}' | awk -F "/" '{print $1}')" +net_if="$1" +net_ip="$(ip addr show dev "${net_if}" | grep -m1 '^\s*inet ' | awk -F " " '{print $2}' | awk -F "/" '{print $1}')" -UDHCPC_OPTS="" -if [ -n "$NET_IP" ]; then - UDHCPC_OPTS="$UDHCPC_OPTS -r $NET_IP" +udhcpc_opts="" +if [ -n "$net_ip" ]; then + udhcpc_opts="$udhcpc_opts -r $net_ip" fi -UID=$(dmidecode -s system-uuid | sed -r 's/^(..)(..)(..)(..)-(..)(..)-(..)(..)-(....)-/00\4\3\2\1\6\5\8\7\9/') -if [ "${#UID}" = 34 ]; then - echo "Using SMBIOS UID for DHCP" - UDHCPC_OPTS="$UDHCPC_OPTS -x 0x3d:$UID" +uid=$(dmidecode -s system-uuid | sed -r 's/^(..)(..)(..)(..)-(..)(..)-(..)(..)-(....)-/00\4\3\2\1\6\5\8\7\9/') +if [ "${#uid}" = 34 ]; then + echo "Using SMBIOS uid for DHCP" + udhcpc_opts="$udhcpc_opts -x 0x3d:$uid" fi mkdir -p /run/udhcpc || echo "Could not create '/run/udhcpc'." -/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -O search -O wins -t 8 -s /opt/openslx/scripts/udhcpc-openslx -i "$NET_IF" -p "/run/udhcpc/udhcpc.$NET_IF.pid" -RET=$? +/opt/openslx/sbin/udhcpc ${udhcpc_opts} -O domain -O nissrv -O nisdomain -O wpad -O search -O wins -t 8 -s /opt/openslx/scripts/udhcpc-openslx -i "${net_if}" -p "/run/udhcpc/udhcpc.${net_if}.pid" +ret=$? -if [ "$RET" != 0 ]; then - slxlog "udhcpc" "Could not run 'udhcpc ${UDHCPC_OPTS}' on ${NET_IF}." +if [ "${ret}" != 0 ]; then + slxlog "udhcpc" "Could not run 'udhcpc ${udhcpc_opts}' on ${net_if}." fi -exit "$RET" +exit "${ret}" -- cgit v1.2.3-55-g7522