commit 61fe9512014f9b81460aba0ab2d0b59cee112428 parent 5daf4aa0f9ffab8e424778d5597cdd8a273b587f Author: Morel BĂ©renger <berengermorel76@gmail.com> Date: Thu, 12 Nov 2020 19:59:10 +0100 Revert "improve f76ea195b1: simpler code" This reverts commit ce855d196b63545539c7efb407ed94a44049bc1d. ps prints header, thus using cut is not doable Diffstat:
M | templates/generic/root/etc/sv/udhcpc/run | | | 6 | +++++- |
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/templates/generic/root/etc/sv/udhcpc/run b/templates/generic/root/etc/sv/udhcpc/run @@ -3,7 +3,11 @@ set -e exec 2>&1 -IFACE="$(ps -oargs $PPID | cut -f2 -d' ')" +# not using cut because ps prints a header, and option to +# avoid that "feature" is not standard. Other alternative +# would be to not print 1st line, but it would require 2 +# pipes (ps | tail | cut) and would be similarly random. +IFACE="$(ps -oargs $PPID | sed -n '/runsv/ s/runsv // p')" echo "Starting dhcp client on $IFACE..." exec udhcpc -i ${IFACE} -f -R -n