initscripts: use quotes for shell variable comparision
PATCH 1/4 initscripts: use quotes for shell variable comparision
Helps to execute it with busybox shell
--- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +1 -1
@@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap" # # Check the root filesystem. # -if test -f /fastboot || test $rootcheck = no +if test -f /fastboot || test "$rootcheck" = "no" then test $rootcheck = yes && echo "Fast boot, no filesystem check" else
Signature · 1 line
2.29.2
PATCH 2/4 busybox: Install /etc/default/rcS when used as init system
This helps in using sysvinit scripts with busybox init system as well
--- meta/recipes-core/busybox/busybox.inc | 1 + meta/recipes-core/busybox/busybox_1.32.0.bb | 1 + meta/recipes-core/busybox/files/rcS.default | 1 + 3 files changed, 3 insertions(+) create mode 100644 meta/recipes-core/busybox/files/rcS.default
meta/recipes-core/busybox/busybox.inc +1 -0
@@ -312,6 +312,7 @@ do_install () { if grep -q "CONFIG_INIT=y" ${B}/.config; then install -D -m 0755 ${WORKDIR}/rcS ${D}${sysconfdir}/init.d/rcS install -D -m 0755 ${WORKDIR}/rcK ${D}${sysconfdir}/init.d/rcK + install -D -m 0755 ${WORKDIR}/rcS.default ${D}${sysconfdir}/default/rcS fi if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
meta/recipes-core/busybox/busybox_1.32.0.bb +1 -0
@@ -33,6 +33,7 @@ SRC_URI = "https://busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \ file://getopts.cfg \ file://resize.cfg \ ${@["", "file://init.cfg"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \ + ${@["", "file://rcS.default"][(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'busybox')]} \ ${@["", "file://mdev.cfg"][(d.getVar('VIRTUAL-RUNTIME_dev_manager') == 'busybox-mdev')]} \ file://syslog.cfg \ file://unicode.cfg \
meta/recipes-core/busybox/files/rcS.default new file +1 -0
@@ -0,0 +1 @@ +# SULOGIN = "yes"
Signature · 1 line
2.29.2
PATCH 3/4 busybox: Run mdev as daemon
In reply to Khem RajWhen busybox is used for device management, kernel needs to support older/obsolete mechanism via CONFIG_UEVENT_HELPER and CONFIG_UEVENT_HELPER_PATH to enable /proc/sys/kernel/hotplug but this would require kernel defconfig change and will always be needed when mdev is used, intead run it in daemon mode
Update mdev init script to run mdev in daemon mode
--- meta/recipes-core/busybox/busybox/mdev.cfg | 2 + meta/recipes-core/busybox/files/mdev | 56 +++++++++++++++------- 2 files changed, 41 insertions(+), 17 deletions(-)
meta/recipes-core/busybox/busybox/mdev.cfg +2 -0
@@ -9,3 +9,5 @@ CONFIG_SETSID=y CONFIG_CTTYHACK=y CONFIG_FEATURE_SHADOWPASSWDS=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_MDEV_DAEMON=y
meta/recipes-core/busybox/files/mdev +39 -17
60 lines not on this page · raw message
Signature · 1 line
2.29.2
Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
Quoted 49 lines · Khem Raj
When busybox is used for device management, kernel needs to support older/obsolete mechanism via
CONFIG_UEVENT_HELPERandCONFIG_UEVENT_HELPER_PATHto enable/proc/sys/kernel/hotplugbut this would require kernel defconfig change and will always be needed when mdev is used, intead run it in daemon modeUpdate mdev init script to run mdev in daemon mode
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/busybox/busybox/mdev.cfg | 2 + meta/recipes-core/busybox/files/mdev | 56 +++++++++++++++------- 2 files changed, 41 insertions(+), 17 deletions(-)meta/recipes-core/busybox/busybox/mdev.cfg +2
-0@@ -9,3 +9,5 @@ CONFIG_SETSID=y CONFIG_CTTYHACK=y CONFIG_FEATURE_SHADOWPASSWDS=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_MDEV_DAEMON=ymeta/recipes-core/busybox/files/mdev +1
-15@@ -1,21 +1,43 @@ #!/bin/sh -mount -t proc proc /proc -mount -t sysfs sysfs /sys -mount -t tmpfs tmpfs /dev -o size=64k,mode=0755 -mkdir /dev/pts /dev/shm -chmod 777 /dev/shm -mount -t devpts devpts /dev/pts -touch /dev/mdev.seq -#sysctl -w kernel.hotplug=/sbin/mdev -echo "/sbin/mdev" > /proc/sys/kernel/hotplug -mdev -s - # -# We might have mounted something over /dev, see if /dev/initctl is there. +# Run the mdev daemon # -if test ! -p /dev/initctl -then - rm -f /dev/initctl
meta/recipes-core/busybox/files/mdev line 12
Quoted 10 lines
meta/recipes-core/busybox/files/mdev +8
-2- mknod -m 600 /dev/initctl p -fi + +DAEMON="mdev" +PIDFILE="/var/run/$DAEMON.pid" + + +start() { + echo -n "Starting $DAEMON... " + start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -df
Where do these start-stop-daemon options come from? Using -b for an application which is designed to run as a daemon (and deliberately telling that app to run in the foreground) looks odd, etc.
Are there bugs or limitations in mdev which you are trying to workaround?
Quoted 37 lines
meta/recipes-core/busybox/files/mdev +30
-1+ [ $? -eq 0 ] && echo "OK" || echo "ERROR" + + # coldplug modules + find /sys/ -name modalias -print0 | \ + xargs -0 sort -u | \ + tr '\n' '\0' | \ + xargs -0 modprobe -abq +} + +stop() { + echo -n "Stopping $DAEMON... " + start-stop-daemon -K -p $PIDFILE + [ $? -eq 0 ] && echo "OK" || echo "ERROR" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? --2.29.2
Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
Afaik, running a daemon in foreground mode and instructing start-stop-daemon to background it is common practice if the daemon doesn’t support writing a pidfile itself, so start-stop-daemon can handle it itself. Without using foregrounded process + -b, it wouldn’t know the resulting process id. If busybox mdev supports a pidfile, this wouldn’t be necessary.
--
Christopher “kergoth” Larson
[email protected], [email protected], [email protected] Founder - BitBake, OpenEmbedded, OpenZaurus
Senior Software Engineer, Mentor Graphics, a Siemens Business
Quoted 108 lines · On Dec 17, 2020, 4:59 PM -0700, Andre McCurdy <[email protected]>, wrote:
Quoted 49 lines · Khem Raj
When busybox is used for device management, kernel needs to support older/obsolete mechanism via
CONFIG_UEVENT_HELPERandCONFIG_UEVENT_HELPER_PATHto enable/proc/sys/kernel/hotplugbut this would require kernel defconfig change and will always be needed when mdev is used, intead run it in daemon modeUpdate mdev init script to run mdev in daemon mode
Signed-off-by Khem Raj <[email protected]>---
meta/recipes-core/busybox/busybox/mdev.cfg | 2 + meta/recipes-core/busybox/files/mdev | 56 +++++++++++++++-------2 files changed, 41 insertions(+), 17 deletions(-)meta/recipes-core/busybox/busybox/mdev.cfg +0
-0@@ -9,3 +9,5 @@ CONFIG_SETSID=y
CONFIG_CTTYHACK=y
CONFIG_FEATURE_SHADOWPASSWDS=ymeta/recipes-core/busybox/busybox/mdev.cfg +2
-0+CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_MDEV_DAEMON=ymeta/recipes-core/busybox/files/mdev +1
-15@@ -1,21 +1,43 @@ #!/bin/sh -mount -t proc proc /proc -mount -t sysfs sysfs /sys -mount -t tmpfs tmpfs /dev -o size=64k,mode=0755 -mkdir /dev/pts /dev/shm -chmod 777 /dev/shm -mount -t devpts devpts /dev/pts -touch /dev/mdev.seq -#sysctl -w kernel.hotplug=/sbin/mdev -echo "/sbin/mdev" > /proc/sys/kernel/hotplug -mdev -s - # -# We might have mounted something over /dev, see if /dev/initctl is there. +# Run the mdev daemon # -if test ! -p /dev/initctl -then - rm -f /dev/initctlmeta/recipes-core/busybox/files/mdev line 12
Quoted 10 lines
meta/recipes-core/busybox/files/mdev +8
-2- mknod -m 600 /dev/initctl p -fi + +DAEMON="mdev" +PIDFILE="/var/run/$DAEMON.pid" + + +start() { + echo -n "Starting $DAEMON... " + start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -dfWhere do these start-stop-daemon options come from? Using -b for an application which is designed to run as a daemon (and deliberately telling that app to run in the foreground) looks odd, etc.
Are there bugs or limitations in mdev which you are trying to workaround?
Quoted 37 lines
meta/recipes-core/busybox/files/mdev +30
-1+ [ $? -eq 0 ] && echo "OK" || echo "ERROR" + + # coldplug modules + find /sys/ -name modalias -print0 | \ + xargs -0 sort -u | \ + tr '\n' '\0' | \ + xargs -0 modprobe -abq +} + +stop() { + echo -n "Stopping $DAEMON... " + start-stop-daemon -K -p $PIDFILE + [ $? -eq 0 ] && echo "OK" || echo "ERROR" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? --2.29.2
Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
In reply to Andre McCurdyQuoted 66 lines · Andre McCurdy
Quoted 49 lines · Khem Raj
When busybox is used for device management, kernel needs to support older/obsolete mechanism via
CONFIG_UEVENT_HELPERandCONFIG_UEVENT_HELPER_PATHto enable/proc/sys/kernel/hotplugbut this would require kernel defconfig change and will always be needed when mdev is used, intead run it in daemon modeUpdate mdev init script to run mdev in daemon mode
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/busybox/busybox/mdev.cfg | 2 + meta/recipes-core/busybox/files/mdev | 56 +++++++++++++++------- 2 files changed, 41 insertions(+), 17 deletions(-)meta/recipes-core/busybox/busybox/mdev.cfg +2
-0@@ -9,3 +9,5 @@ CONFIG_SETSID=y CONFIG_CTTYHACK=y CONFIG_FEATURE_SHADOWPASSWDS=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_MDEV_DAEMON=ymeta/recipes-core/busybox/files/mdev +1
-15@@ -1,21 +1,43 @@ #!/bin/sh -mount -t proc proc /proc -mount -t sysfs sysfs /sys -mount -t tmpfs tmpfs /dev -o size=64k,mode=0755 -mkdir /dev/pts /dev/shm -chmod 777 /dev/shm -mount -t devpts devpts /dev/pts -touch /dev/mdev.seq -#sysctl -w kernel.hotplug=/sbin/mdev -echo "/sbin/mdev" > /proc/sys/kernel/hotplug -mdev -s - # -# We might have mounted something over /dev, see if /dev/initctl is there. +# Run the mdev daemon # -if test ! -p /dev/initctl -then - rm -f /dev/initctlmeta/recipes-core/busybox/files/mdev line 12
Quoted 10 lines
meta/recipes-core/busybox/files/mdev +8
-2- mknod -m 600 /dev/initctl p -fi + +DAEMON="mdev" +PIDFILE="/var/run/$DAEMON.pid" + + +start() { + echo -n "Starting $DAEMON... " + start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -dfWhere do these start-stop-daemon options come from? Using -b for an application which is designed to run as a daemon (and deliberately telling that app to run in the foreground) looks odd, etc.
Quoted 2 lines
Are there bugs or limitations in mdev which you are trying to workaround?
its using start-stop-daemon applet from busybox which does have these options implemented, its so that start-stop-daemon takes the control of the daemon
Quoted 37 lines
Quoted 37 lines
meta/recipes-core/busybox/files/mdev +30
-1+ [ $? -eq 0 ] && echo "OK" || echo "ERROR" + + # coldplug modules + find /sys/ -name modalias -print0 | \ + xargs -0 sort -u | \ + tr '\n' '\0' | \ + xargs -0 modprobe -abq +} + +stop() { + echo -n "Stopping $DAEMON... " + start-stop-daemon -K -p $PIDFILE + [ $? -eq 0 ] && echo "OK" || echo "ERROR" +} + +restart() { + stop + start +} + +case "$1" in + start|stop|restart) + "$1" + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? --2.29.2
Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
Quoted 68 lines · Khem Raj
Quoted 66 lines · Andre McCurdy
Quoted 49 lines · Khem Raj
When busybox is used for device management, kernel needs to support older/obsolete mechanism via
CONFIG_UEVENT_HELPERandCONFIG_UEVENT_HELPER_PATHto enable/proc/sys/kernel/hotplugbut this would require kernel defconfig change and will always be needed when mdev is used, intead run it in daemon modeUpdate mdev init script to run mdev in daemon mode
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/busybox/busybox/mdev.cfg | 2 + meta/recipes-core/busybox/files/mdev | 56 +++++++++++++++------- 2 files changed, 41 insertions(+), 17 deletions(-)meta/recipes-core/busybox/busybox/mdev.cfg +2
-0@@ -9,3 +9,5 @@ CONFIG_SETSID=y CONFIG_CTTYHACK=y CONFIG_FEATURE_SHADOWPASSWDS=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_MDEV_DAEMON=ymeta/recipes-core/busybox/files/mdev +1
-15@@ -1,21 +1,43 @@ #!/bin/sh -mount -t proc proc /proc -mount -t sysfs sysfs /sys -mount -t tmpfs tmpfs /dev -o size=64k,mode=0755 -mkdir /dev/pts /dev/shm -chmod 777 /dev/shm -mount -t devpts devpts /dev/pts -touch /dev/mdev.seq -#sysctl -w kernel.hotplug=/sbin/mdev -echo "/sbin/mdev" > /proc/sys/kernel/hotplug -mdev -s - # -# We might have mounted something over /dev, see if /dev/initctl is there. +# Run the mdev daemon # -if test ! -p /dev/initctl -then - rm -f /dev/initctlmeta/recipes-core/busybox/files/mdev line 12
Quoted 10 lines
meta/recipes-core/busybox/files/mdev +8
-2- mknod -m 600 /dev/initctl p -fi + +DAEMON="mdev" +PIDFILE="/var/run/$DAEMON.pid" + + +start() { + echo -n "Starting $DAEMON... " + start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -dfWhere do these start-stop-daemon options come from? Using -b for an application which is designed to run as a daemon (and deliberately telling that app to run in the foreground) looks odd, etc.
Quoted 4 lines
Quoted 1 line
Are there bugs or limitations in mdev which you are trying to workaround?
its using start-stop-daemon applet from busybox which does have these options implemented, its so that start-stop-daemon takes the control of the daemon
The question is not whether start-stop-daemon supports using PID files but whether the busybox mdev application supports creating them.
It looks like although most of the busybox daemons do, mdev does not:
.../busybox-1.32.0 $ grep -r write_pidfile *debianutils/start_stop_daemon.c: write_pidfile(pidfile);
include/libbb.h:void write_pidfile(const char *path) FAST_FUNC; include/libbb.h:void write_pidfile_std_path_and_ext(const char *path) FAST_FUNC; include/libbb.h:#define write_pidfile_std_path_and_ext(path) ((void)0) include/libbb.h:#define write_pidfile(path) ((void)0) libbb/pidfile.c:void FAST_FUNC write_pidfile(const char *path) libbb/pidfile.c:void FAST_FUNC write_pidfile_std_path_and_ext(const char *name)
libbb/pidfile.c: write_pidfile(buf);
miscutils/watchdog.c: write_pidfile_std_path_and_ext("watchdog");
miscutils/crond.c: write_pidfile_std_path_and_ext("crond");
networking/ifplugd.c: write_pidfile(pidfile_name);
networking/ntpd.c: write_pidfile_std_path_and_ext("ntpd");
networking/inetd.c: write_pidfile_std_path_and_ext("inetd");
networking/udhcp/dhcpc.c: write_pidfile(client_data.pidfile);
networking/udhcp/dhcpc.c: write_pidfile(client_data.pidfile);
networking/udhcp/dhcpd.c: write_pidfile(server_data.pidfile);
networking/udhcp/d6_dhcpc.c: write_pidfile(client_data.pidfile);
networking/udhcp/d6_dhcpc.c: write_pidfile(client_data.pidfile);
sysklogd/syslogd.c: write_pidfile_std_path_and_ext("syslogd");
sysklogd/klogd.c: write_pidfile_std_path_and_ext("klogd");
util-linux/acpid.c: write_pidfile(opt_pidfile);Re: [OE-core] [PATCH 3/4] busybox: Run mdev as daemon
Quoted 71 lines · Andre McCurdy
Quoted 70 lines · Khem Raj
Quoted 67 lines · Andre McCurdy
Quoted 49 lines · Khem Raj
When busybox is used for device management, kernel needs to support older/obsolete mechanism via
CONFIG_UEVENT_HELPERandCONFIG_UEVENT_HELPER_PATHto enable/proc/sys/kernel/hotplugbut this would require kernel defconfig change and will always be needed when mdev is used, intead run it in daemon modeUpdate mdev init script to run mdev in daemon mode
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/busybox/busybox/mdev.cfg | 2 + meta/recipes-core/busybox/files/mdev | 56 +++++++++++++++------- 2 files changed, 41 insertions(+), 17 deletions(-)meta/recipes-core/busybox/busybox/mdev.cfg +2
-0@@ -9,3 +9,5 @@ CONFIG_SETSID=y CONFIG_CTTYHACK=y CONFIG_FEATURE_SHADOWPASSWDS=y +CONFIG_FEATURE_XARGS_SUPPORT_ZERO_TERM=y +CONFIG_FEATURE_MDEV_DAEMON=ymeta/recipes-core/busybox/files/mdev +1
-15@@ -1,21 +1,43 @@ #!/bin/sh -mount -t proc proc /proc -mount -t sysfs sysfs /sys -mount -t tmpfs tmpfs /dev -o size=64k,mode=0755 -mkdir /dev/pts /dev/shm -chmod 777 /dev/shm -mount -t devpts devpts /dev/pts -touch /dev/mdev.seq -#sysctl -w kernel.hotplug=/sbin/mdev -echo "/sbin/mdev" > /proc/sys/kernel/hotplug -mdev -s - # -# We might have mounted something over /dev, see if /dev/initctl is there. +# Run the mdev daemon # -if test ! -p /dev/initctl -then - rm -f /dev/initctlmeta/recipes-core/busybox/files/mdev line 12
Quoted 10 lines
meta/recipes-core/busybox/files/mdev +8
-2- mknod -m 600 /dev/initctl p -fi + +DAEMON="mdev" +PIDFILE="/var/run/$DAEMON.pid" + + +start() { + echo -n "Starting $DAEMON... " + start-stop-daemon -S -b -m -p $PIDFILE -x /sbin/mdev -- -dfWhere do these start-stop-daemon options come from? Using -b for an application which is designed to run as a daemon (and deliberately telling that app to run in the foreground) looks odd, etc.
Are there bugs or limitations in mdev which you are trying to workaround?
Quoted 8 lines
Quoted 2 lines
its using start-stop-daemon applet from busybox which does have these options implemented, its so that start-stop-daemon takes the control of the daemon
The question is not whether start-stop-daemon supports using PID files but whether the busybox mdev application supports creating them.
It looks like although most of the busybox daemons do, mdev does not:
right it does not, letting start-stop-daemon works well though and is used in lot of places
Quoted 23 lines
.../busybox-1.32.0 $ grep -r
write_pidfile*debianutils/start_stop_daemon.c:write_pidfile(pidfile);
include/libbb.h:voidwrite_pidfile(const char *path)FAST_FUNC; include/libbb.h:voidwrite_pidfile_std_path_and_ext(const char *path)FAST_FUNC; include/libbb.h:#definewrite_pidfile_std_path_and_ext(path)((void)0) include/libbb.h:#definewrite_pidfile(path)((void)0) libbb/pidfile.c:voidFAST_FUNCwrite_pidfile(const char *path)libbb/pidfile.c:voidFAST_FUNCwrite_pidfile_std_path_and_ext(const char *name)libbb/pidfile.c: write_pidfile(buf); miscutils/watchdog.c: write_pidfile_std_path_and_ext("watchdog"); miscutils/crond.c: write_pidfile_std_path_and_ext("crond"); networking/ifplugd.c: write_pidfile(pidfile_name); networking/ntpd.c: write_pidfile_std_path_and_ext("ntpd"); networking/inetd.c: write_pidfile_std_path_and_ext("inetd"); networking/udhcp/dhcpc.c: write_pidfile(client_data.pidfile); networking/udhcp/dhcpc.c: write_pidfile(client_data.pidfile); networking/udhcp/dhcpd.c: write_pidfile(server_data.pidfile); networking/udhcp/d6_dhcpc.c: write_pidfile(client_data.pidfile); networking/udhcp/d6_dhcpc.c: write_pidfile(client_data.pidfile); sysklogd/syslogd.c: write_pidfile_std_path_and_ext("syslogd"); sysklogd/klogd.c: write_pidfile_std_path_and_ext("klogd"); util-linux/acpid.c: write_pidfile(opt_pidfile);
PATCH 4/4 initscripts: Use initctl on sysvinit only
In reply to Khem RajCheck if init system is sysvinit to recreate initctl, this ensures that it can be used with busybox init system as well
--- .../initscripts/initscripts-1.0/mountall.sh | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-)
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +14 -8
@@ -19,15 +19,21 @@ test "$VERBOSE" != no && echo "Mounting local filesystems..." mount -at nonfs,nosmbfs,noncpfs 2>/dev/null -# -# We might have mounted something over /dev, see if /dev/initctl is there. -# -if test ! -p /dev/initctl -then - rm -f /dev/initctl - mknod -m 600 /dev/initctl p + +# We might have mounted something over /run; see if +# /dev/initctl is present. Look for +# /sbin/init.sysvinit to verify that sysvinit (and +# not busybox or systemd) is installed as default init). +INITCTL="/dev/initctl" +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" = "/sbin/init.sysvinit" ]; then + # Create new control channel + rm -f "$INITCTL" + mknod -m 600 "$INITCTL" p + + # Reopen control channel. + PID="$(pidof -s /sbin/init || echo 1)" + [ -n "$PID" ] && kill -s USR1 "$PID" fi -kill -USR1 1 # # Execute swapon command again, in case we want to swap to
Signature · 1 line
2.29.2
Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
Quoted 1 line · Khem Raj
+if [ ! -p "$INITCTL" ] && [ "$(readlink -- "
/sbin/init")" = "/sbin/init.sysvinit" ]; then
Can this be done at build time for targets using sysvinit only?
Quoted 9 lines
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +7
-1+ # Create new control channel + rm -f "$INITCTL" + mknod -m 600 "$INITCTL" p + + # Reopen control channel. + PID="$(pidof -s /sbin/init || echo 1)" + [ -n "$PID" ] && kill -s USR1 "$PID" fi -kill -USR1 1
Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
Quoted 6 lines · Sinan Kaya
Quoted 1 line · Khem Raj
+if [ ! -p "$INITCTL" ] && [ "$(readlink -- "
/sbin/init")" ="
/sbin/init.sysvinit" ]; thenCan this be done at build time for targets using sysvinit only?
Yes however It will be lot more obscure
Hard to read and harder to maintain
Quoted 12 lines
Quoted 10 lines
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +7
-1+ # Create new control channel + rm -f "$INITCTL" + mknod -m 600 "$INITCTL" p + + # Reopen control channel. + PID="$(pidof -s /sbin/init || echo 1)" + [ -n "$PID" ] && kill -s USR1 "$PID" fi -kill -USR1 1
Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
Quoted 7 lines · Khem Raj
On Fri, Dec 18, 2020 at 10:29 AM Sinan Kaya <[email protected] <mailto:[email protected]>> wrote:
On 12/17/2020 5:54 PM, Khem Raj wrote:
> +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" = "/sbin/init.sysvinit" ]; then
Quoted 5 lines
Can this be done at build time for targets using sysvinit only?
Yes however It will be lot more obscure
Hard to read and harder to maintain
I see your point. I think having a flag in the /etc/default/rcS file and using that for comparison seems more plausible here as opposed to init.sysvinit check. (this looked very fragile to me for some reason)
Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
Quoted 12 lines · Sinan Kaya
Quoted 10 lines · Khem Raj
On Fri, Dec 18, 2020 at 10:29 AM Sinan Kaya <[email protected] <mailto:[email protected]>> wrote:
On 12/17/2020 5:54 PM, Khem Raj wrote:
> +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" = "/sbin/init.sysvinit" ]; thenCan this be done at build time for targets using sysvinit only?
Quoted 6 lines
Quoted 2 lines
Yes however It will be lot more obscure
Hard to read and harder to maintainI see your point. I think having a flag in the
/etc/default/rcSfile and using that for comparison seems more plausible here as opposed to init.sysvinit check. (this looked very fragile to me for some reason)
that sounds reasonable I will send a revised patch for this
Re: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit only
In reply to Khem RajQuoted 35 lines
-----Original Message-----
From: [email protected] <openembedded- [email protected]> On Behalf Of Khem Raj
Sent: den 17 december 2020 23:55
To: [email protected]
Cc: Khem Raj <[email protected]>
Subject: [OE-core] [PATCH 4/4] initscripts: Use initctl on sysvinit onlyCheck if init system is sysvinit to recreate initctl, this ensures that it can be used with busybox init system as well
Signed-off-by Khem Raj <[email protected]>--- .../initscripts/initscripts-1.0/mountall.sh | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-)meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +4
-7@@ -19,15 +19,21 @@ test "$VERBOSE" != no && echo "Mounting local filesystems..." mount -at nonfs,nosmbfs,noncpfs 2>/dev/null -# -# We might have mounted something over /dev, see if /dev/initctl is there. -# -if test ! -p /dev/initctl -then - rm -f /dev/initctl - mknod -m 600 /dev/initctl p + +# We might have mounted something over /run; see if +# /dev/initctl is present. Look for +# /sbin/init.sysvinit to verify that sysvinit (and
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh line 35
Quoted 10 lines
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +10
-0+# not busybox or systemd) is installed as default init). +INITCTL="/dev/initctl" +if [ ! -p "$INITCTL" ] && [ "$(readlink -- "/sbin/init")" = "/sbin/init.sysvinit" ]; then + # Create new control channel + rm -f "$INITCTL" + mknod -m 600 "$INITCTL" p + + # Reopen control channel. + PID="$(pidof -s /sbin/init || echo 1)" + [ -n "$PID" ] && kill -s USR1 "$PID"
Change all references for "/sbin" to "${base_sbindir}" to make it correct if usrmerge is used.
Quoted 7 lines
meta/recipes-core/initscripts/initscripts-1.0/mountall.sh +0
-2fi -kill -USR1 1 # # Execute swapon command again, in case we want to swap to --2.29.2
//Peter
Quoted 2 lines · Khem Raj
Helps to execute it with busybox shell
How does it help? Adding quotes would help if $rootcheck is an empty string, but that's not specific to busybox.
Quoted 10 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +0
-0
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh test "$VERBOSE" != no && echo "Activating swap" · line 79
Quoted 7 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +1
-1@@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap" # # Check the root filesystem. # -if test -f /fastboot || test $rootcheck = no +if test -f /fastboot || test "$rootcheck" = "no" then test $rootcheck = yes && echo "Fast boot, no filesystem check"
Doesn't this instance need to be quoted too?
Quoted 7 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +0
-1else --2.29.2
Quoted 13 lines · Andre McCurdy
Quoted 2 lines · Khem Raj
Helps to execute it with busybox shell
How does it help? Adding quotes would help if $rootcheck is an empty string, but that's not specific to busybox.
Quoted 5 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh test "$VERBOSE" != no && echo "Activating swap" · line 79
Quoted 12 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +1
-1@@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap" # # Check the root filesystem. # -if test -f /fastboot || test $rootcheck = no +if test -f /fastboot || test "$rootcheck" = "no" then test $rootcheck = yes && echo "Fast boot, no filesystem check"Doesn't this instance need to be quoted too?
yes infact there are more cleanup to follow, this series just fixed default boot errors on reference images.
Quoted 8 lines
Quoted 8 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +0
-1else --2.29.2
Quoted 30 lines · Khem Raj
Quoted 13 lines · Andre McCurdy
Quoted 2 lines · Khem Raj
Helps to execute it with busybox shell
How does it help? Adding quotes would help if $rootcheck is an empty string, but that's not specific to busybox.
Quoted 5 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Quoted 14 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh test "$VERBOSE" != no && echo "Activating swap" · line 79
Quoted 12 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +1
-1@@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap" # # Check the root filesystem. # -if test -f /fastboot || test $rootcheck = no +if test -f /fastboot || test "$rootcheck" = "no" then test $rootcheck = yes && echo "Fast boot, no filesystem check"Doesn't this instance need to be quoted too?
Quoted 2 lines
yes infact there are more cleanup to follow, this series just fixed default boot errors on reference images.
Adding quotes around a variable should probably be done consistently, so maybe it makes sense to hold off on this one until you've finished the cleanup?
Quoted 32 lines · Andre McCurdy
Quoted 30 lines · Khem Raj
Quoted 27 lines · Andre McCurdy
Quoted 2 lines · Khem Raj
Helps to execute it with busybox shell
How does it help? Adding quotes would help if $rootcheck is an empty string, but that's not specific to busybox.
Quoted 10 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +0
-0meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh test "$VERBOSE" != no && echo "Activating swap" · line 79
Quoted 7 lines
meta/recipes-core/initscripts/initscripts-1.0/checkroot.sh +1
-1@@ -74,7 +74,7 @@ test "$VERBOSE" != no && echo "Activating swap" # # Check the root filesystem. # -if test -f /fastboot || test $rootcheck = no +if test -f /fastboot || test "$rootcheck" = "no" then test $rootcheck = yes && echo "Fast boot, no filesystem check"Doesn't this instance need to be quoted too?
Quoted 6 lines
Quoted 2 lines
yes infact there are more cleanup to follow, this series just fixed default boot errors on reference images.
Adding quotes around a variable should probably be done consistently, so maybe it makes sense to hold off on this one until you've finished the cleanup?
it doesn't matter, I would be creating per package patches.