* [PATCH] udhcpc: specify full path for ip command calls
@ 2016-02-09 12:20 Mark O'Donovan
2016-02-09 13:58 ` Joshua G Lock
0 siblings, 1 reply; 3+ messages in thread
From: Mark O'Donovan @ 2016-02-09 12:20 UTC (permalink / raw)
To: openembedded-core; +Cc: Mark O'Donovan
Running with a restricted environment (e.g. cron) was causing
issues as we check for the ip command with full path and call
without full path
---
meta/recipes-core/busybox/files/simple.script | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
index 22168b0..e233c3c 100644
--- a/meta/recipes-core/busybox/files/simple.script
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -28,8 +28,8 @@ case "$1" in
fi
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
- ip addr flush dev $interface
- ip link set dev $interface up
+ /sbin/ip addr flush dev $interface
+ /sbin/ip link set dev $interface up
else
/sbin/ifconfig $interface 0.0.0.0
fi
@@ -38,7 +38,7 @@ case "$1" in
renew|bound)
if [ $have_bin_ip -eq 1 ]; then
- ip addr add dev $interface local $ip/$mask $BROADCAST
+ /sbin/ip addr add dev $interface local $ip/$mask $BROADCAST
else
/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
fi
@@ -59,7 +59,7 @@ case "$1" in
metric=10
for i in $router ; do
if [ $have_bin_ip -eq 1 ]; then
- ip route add default via $i metric $metric
+ /sbin/ip route add default via $i metric $metric
else
route add default gw $i dev $interface metric $metric 2>/dev/null
fi
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] udhcpc: specify full path for ip command calls
2016-02-09 12:20 [PATCH] udhcpc: specify full path for ip command calls Mark O'Donovan
@ 2016-02-09 13:58 ` Joshua G Lock
2016-02-10 9:23 ` [PATCH v2] " Mark O'Donovan
0 siblings, 1 reply; 3+ messages in thread
From: Joshua G Lock @ 2016-02-09 13:58 UTC (permalink / raw)
To: openembedded-core
On Tue, 2016-02-09 at 12:20 +0000, Mark O'Donovan wrote:
> Running with a restricted environment (e.g. cron) was causing
> issues as we check for the ip command with full path and call
> without full path
This change should probably change the /sbin/ path in the script to a
symbol and use sed to replace it with the expansion of ${sbindir}
rather than hard-coding a path which isn't always correct.
Regards,
Joshua
> ---
> meta/recipes-core/busybox/files/simple.script | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meta/recipes-core/busybox/files/simple.script
> b/meta/recipes-core/busybox/files/simple.script
> index 22168b0..e233c3c 100644
> --- a/meta/recipes-core/busybox/files/simple.script
> +++ b/meta/recipes-core/busybox/files/simple.script
> @@ -28,8 +28,8 @@ case "$1" in
> fi
> if ! root_is_nfs ; then
> if [ $have_bin_ip -eq 1 ]; then
> - ip addr flush dev $interface
> - ip link set dev $interface up
> + /sbin/ip addr flush dev $interface
> + /sbin/ip link set dev $interface up
> else
> /sbin/ifconfig $interface 0.0.0.0
> fi
> @@ -38,7 +38,7 @@ case "$1" in
>
> renew|bound)
> if [ $have_bin_ip -eq 1 ]; then
> - ip addr add dev $interface local $ip/$mask
> $BROADCAST
> + /sbin/ip addr add dev $interface local
> $ip/$mask $BROADCAST
> else
> /sbin/ifconfig $interface $ip $BROADCAST
> $NETMASK
> fi
> @@ -59,7 +59,7 @@ case "$1" in
> metric=10
> for i in $router ; do
> if [ $have_bin_ip -eq 1 ]; then
> - ip route add default via $i
> metric $metric
> + /sbin/ip route add default
> via $i metric $metric
> else
> route add default gw $i dev
> $interface metric $metric 2>/dev/null
> fi
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH v2] udhcpc: specify full path for ip command calls
2016-02-09 13:58 ` Joshua G Lock
@ 2016-02-10 9:23 ` Mark O'Donovan
0 siblings, 0 replies; 3+ messages in thread
From: Mark O'Donovan @ 2016-02-10 9:23 UTC (permalink / raw)
To: openembedded-core; +Cc: Mark O'Donovan
Signed-off-by: Mark O'Donovan <modonovan@biotector.com>
---
meta/recipes-core/busybox/busybox.inc | 3 ++-
meta/recipes-core/busybox/files/simple.script | 28 +++++++++++++--------------
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/meta/recipes-core/busybox/busybox.inc b/meta/recipes-core/busybox/busybox.inc
index f74d1a4..4827d08 100644
--- a/meta/recipes-core/busybox/busybox.inc
+++ b/meta/recipes-core/busybox/busybox.inc
@@ -258,7 +258,8 @@ do_install () {
if grep "CONFIG_UDHCPC=y" ${B}/.config; then
install -d ${D}${sysconfdir}/udhcpc.d
install -d ${D}${datadir}/udhcpc
- install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
+ install -m 0755 ${WORKDIR}/simple.script ${D}${sysconfdir}/udhcpc.d/50default
+ sed -i "s:/SBIN_DIR/:${base_sbindir}/:" ${D}${sysconfdir}/udhcpc.d/50default
install -m 0755 ${WORKDIR}/default.script ${D}${datadir}/udhcpc/default.script
fi
if grep "CONFIG_INETD=y" ${B}/.config; then
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
index 22168b0..6ed0293 100644
--- a/meta/recipes-core/busybox/files/simple.script
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -14,7 +14,7 @@ root_is_nfs() {
}
have_bin_ip=0
-if [ -x /sbin/ip ]; then
+if [ -x /SBIN_DIR/ip ]; then
have_bin_ip=1
BROADCAST="broadcast +"
fi
@@ -23,34 +23,34 @@ fi
case "$1" in
deconfig)
- if [ -x /sbin/resolvconf ]; then
- /sbin/resolvconf -d "${interface}.udhcpc"
+ if [ -x /SBIN_DIR/resolvconf ]; then
+ /SBIN_DIR/resolvconf -d "${interface}.udhcpc"
fi
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
- ip addr flush dev $interface
- ip link set dev $interface up
+ /SBIN_DIR/ip addr flush dev $interface
+ /SBIN_DIR/ip link set dev $interface up
else
- /sbin/ifconfig $interface 0.0.0.0
+ /SBIN_DIR/ifconfig $interface 0.0.0.0
fi
fi
;;
renew|bound)
if [ $have_bin_ip -eq 1 ]; then
- ip addr add dev $interface local $ip/$mask $BROADCAST
+ /SBIN_DIR/ip addr add dev $interface local $ip/$mask $BROADCAST
else
- /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+ /SBIN_DIR/ifconfig $interface $ip $BROADCAST $NETMASK
fi
if [ -n "$router" ] ; then
if ! root_is_nfs ; then
if [ $have_bin_ip -eq 1 ]; then
- while ip route del default dev $interface 2>/dev/null ; do
+ while /SBIN_DIR/ip route del default dev $interface 2>/dev/null ; do
:
done
else
- while route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
+ while /SBIN_DIR/route del default gw 0.0.0.0 dev $interface 2>/dev/null ; do
:
done
fi
@@ -59,9 +59,9 @@ case "$1" in
metric=10
for i in $router ; do
if [ $have_bin_ip -eq 1 ]; then
- ip route add default via $i metric $metric
+ /SBIN_DIR/ip route add default via $i metric $metric
else
- route add default gw $i dev $interface metric $metric 2>/dev/null
+ /SBIN_DIR/route add default gw $i dev $interface metric $metric 2>/dev/null
fi
metric=$(($metric + 1))
done
@@ -77,8 +77,8 @@ case "$1" in
"
done
- if [ -x /sbin/resolvconf ]; then
- echo -n "$R" | /sbin/resolvconf -a "${interface}.udhcpc"
+ if [ -x /SBIN_DIR/resolvconf ]; then
+ echo -n "$R" | /SBIN_DIR/resolvconf -a "${interface}.udhcpc"
else
echo -n "$R" > "$RESOLV_CONF"
fi
--
1.9.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-02-10 9:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-09 12:20 [PATCH] udhcpc: specify full path for ip command calls Mark O'Donovan
2016-02-09 13:58 ` Joshua G Lock
2016-02-10 9:23 ` [PATCH v2] " Mark O'Donovan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.