summaryrefslogtreecommitdiffstats
path: root/remote/modules/dhcpc-busybox
diff options
context:
space:
mode:
authorSimon Rettberg2016-01-07 16:19:04 +0100
committerSimon Rettberg2016-01-07 16:19:04 +0100
commitfc0683176b88de4736e8a51ad688ca76d90261f9 (patch)
tree18aa5b7bf70dce943801990853c83a80a0cde09b /remote/modules/dhcpc-busybox
parent[printergui] Delete temp file after printing (diff)
downloadtm-scripts-fc0683176b88de4736e8a51ad688ca76d90261f9.tar.gz
tm-scripts-fc0683176b88de4736e8a51ad688ca76d90261f9.tar.xz
tm-scripts-fc0683176b88de4736e8a51ad688ca76d90261f9.zip
[beamergui,udhcpc] Don't create pointless files in /tmp
Diffstat (limited to 'remote/modules/dhcpc-busybox')
-rwxr-xr-xremote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++14
1 files changed, 11 insertions, 3 deletions
diff --git a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++ b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++
index 246b2567..76c4fe95 100755
--- a/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++
+++ b/remote/modules/dhcpc-busybox/data/opt/openslx/scripts/systemd-udhcpc++
@@ -1,11 +1,19 @@
#!/bin/bash
NET_IF="$1"
-NET_IP="$(ip addr show dev "${NET_IF}" | grep "inet " | awk -F " " '{print $2}' | awk -F "/" '{print $1}')"
+NET_IP="$(ip addr show dev "${NET_IF}" | grep -m1 '^\s*inet ' | awk -F " " '{print $2}' | awk -F "/" '{print $1}')"
UDHCPC_OPTS=""
[ ! -z "$NET_IP" ] && UDHCPC_OPTS=" -r $NET_IP"
-echo "udhcp++: running on $NET_IF with additional params $UDHCPC_OPTS" >> "/tmp/udhcpclog"
+
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 -t 8 -s /opt/openslx/scripts/udhcpc-openslx -i "$NET_IF" -p "/run/udhcpc/udhcpc.$NET_IF.pid" || \
+
+/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -O search -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}."
+fi
+
+exit "$RET"
+