diff options
author | Simon Rettberg | 2016-01-07 16:19:04 +0100 |
---|---|---|
committer | Simon Rettberg | 2016-01-07 16:19:04 +0100 |
commit | fc0683176b88de4736e8a51ad688ca76d90261f9 (patch) | |
tree | 18aa5b7bf70dce943801990853c83a80a0cde09b /remote/modules/dhcpc-busybox | |
parent | [printergui] Delete temp file after printing (diff) | |
download | tm-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-x | remote/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" + |