Skip to contentSkip to conversation

sysklogd: sync the initscript to latest oe-core version

PATCH New Yi Zhao 1 participant 3 messages Apr 4, 2020

lore
Share & tools
lore

Yi Zhao

author
#0 lore raw

PATCH 1/3 sysklogd: sync the initscript to latest oe-core version

The sysklogd has been updated to 2.1.1 in oe-core and the klogd was removed from this version since syslogd performs logging of kernel messages. So we update the initscript to adapt it.

---
 recipes-extended/sysklogd/files/sysklogd | 47 +++++++++++++++---------
 1 file changed, 29 insertions(+), 18 deletions(-)
 mode change 100755 => 100644 recipes-extended/sysklogd/files/sysklogd
recipes-extended/sysklogd/files/sysklogd +29 -18
old mode 100755
new mode 100644
index 8c6eeb5..e49c2da
@@ -12,12 +12,13 @@
 # Short-Description:    System logger
 ### END INIT INFO
 
+# Source function library.
+. /etc/init.d/functions
+
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
 pidfile_syslogd=/var/run/syslogd.pid
-pidfile_klogd=/var/run/klogd.pid
-binpath_syslogd=/sbin/syslogd
-binpath_klogd=/sbin/klogd
+binpath_syslogd=/usr/sbin/syslogd
 
 test -x $binpath || exit 0
 
@@ -87,6 +88,22 @@ running()
     return 0
 }
 
+waitpid ()
+{
+  pid=$1
+  # Give pid a chance to exit before we restart with a 5s timeout in 1s intervals
+  if [ -z "$pid" ]; then
+    return
+  fi
+  timeout=5;
+  while [ $timeout -gt 0 ]
+  do
+    timeout=$(( $timeout-1 ))
+    kill -0 $pid 2> /dev/null || break
+    sleep 1
+  done
+}
+
 case "$1" in
   start)
     log_begin_msg "Starting system log daemon..."
@@ -94,36 +111,24 @@ case "$1" in
     start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD
     test ! -x /sbin/restorecon || /sbin/restorecon -RF /dev/log /var/log/
     log_end_msg $?
-    log_begin_msg "Starting kernel log daemon..."
-    start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD
-    log_end_msg $?
     ;;
   stop)
     log_begin_msg "Stopping system log daemon..."
     start-stop-daemon --stop --quiet --pidfile $pidfile_syslogd --name syslogd
     log_end_msg $?
-    log_begin_msg "Stopping kernel log daemon..."
-    start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd
-    log_end_msg $?
     ;;
   reload|force-reload)
     log_begin_msg "Reloading system log daemon..."
     start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile_syslogd --name syslogd
     log_end_msg $?
-    log_begin_msg "Reloading kernel log daemon..."
-    start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd
-    start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD
-    log_end_msg $?
     ;;
   restart)
     log_begin_msg "Restarting system log daemon..."
+    pid=`cat $pidfile_syslogd 2> /dev/null`
     start-stop-daemon --stop --retry 5 --quiet --pidfile $pidfile_syslogd --name syslogd
+    waitpid $pid
     start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD
     log_end_msg $?
-    log_begin_msg "Reloading kernel log daemon..."
-    start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd
-    start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD
-    log_end_msg $?
     ;;
   reload-or-restart)
     if running
@@ -133,8 +138,14 @@ case "$1" in
 	$0 start
     fi
     ;;
+  status)
+    status syslogd
+    RETVAL=$?
+    [ $RETVAL -eq 0 ] && exit $rval
+    exit $RETVAL
+    ;;
   *)
-    log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}"
+    log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart|status}"
     exit 1
 esac
 
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/3 eudev: remove udev-cache and sync the initscript to latest oe-core version

The udev-cache has been remove in oe-core commit 048f4149b8438c521e8b65a3c96d850a9b4a3e5b. So we can also remove it.

Also sync the initscript to latest oe-core version.

---
 recipes-core/eudev/files/init       | 66 +++++------------------------
 recipes-core/eudev/files/udev-cache | 32 --------------
 2 files changed, 11 insertions(+), 87 deletions(-)
 delete mode 100644 recipes-core/eudev/files/udev-cache
recipes-core/eudev/files/init +11 -55
index ee64f86..daa4079 100644
@@ -3,7 +3,7 @@
 ### BEGIN INIT INFO
 # Provides:          udev
 # Required-Start:    mountvirtfs
-# Required-Stop:
+# Required-Stop:     
 # Default-Start:     S
 # Default-Stop:
 # Short-Description: Start udevd, populate /dev and load drivers.
@@ -14,23 +14,10 @@ export TZ=/etc/localtime
 [ -d /sys/class ] || exit 1
 [ -r /proc/mounts ] || exit 1
 [ -x @UDEVD@ ] || exit 1
-if [ "$use_udev_cache" != "" ]; then
-	[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
-fi
+
 [ -f /etc/udev/udev.conf ] && . /etc/udev/udev.conf
 [ -f /etc/default/rcS ] && . /etc/default/rcS
 
-readfiles () {
-   READDATA=""
-   for filename in $@; do
-	   if [ -r $filename ]; then
-		   while read line; do
-			   READDATA="$READDATA$line"
-		   done < $filename
-	   fi
-   done
-}
-
 kill_udevd () {
     pid=`pidof -x udevd`
     [ -n "$pid" ] && kill $pid
@@ -59,58 +46,27 @@ case "$1" in
     # the automount rule for udev needs /tmp directory available, as /tmp is a symlink
     # to /var/tmp which in turn is a symlink to /var/volatile/tmp, we need to make sure
     # /var/volatile/tmp directory to be available.
-    mkdir -p /var/volatile/tmp
+    mkdir -m 1777 -p /var/volatile/tmp
 
     # restorecon /run early to allow mdadm creating dir /run/mdadm
     test ! -x /sbin/restorecon || /sbin/restorecon -F /run
 
-    # Cache handling.
-    # A list of files which are used as a criteria to judge whether the udev cache could be reused.
-    CMP_FILE_LIST="/proc/version /proc/cmdline /proc/devices /proc/atags"
-    if [ "$use_udev_cache" != "" ]; then
-	    if [ "$DEVCACHE" != "" ]; then
-		    if [ -e $DEVCACHE ]; then
-			    readfiles $CMP_FILE_LIST
-			    NEWDATA="$READDATA"
-			    readfiles /etc/udev/cache.data
-			    OLDDATA="$READDATA"
-			    if [ "$OLDDATA" = "$NEWDATA" ]; then
-				    tar --directory=/ -xf $DEVCACHE > /dev/null 2>&1
-				    not_first_boot=1
-				    [ "$VERBOSE" != "no" ] && echo "udev: using cache file $DEVCACHE"
-				    [ -e /dev/shm/udev.cache ] && rm -f /dev/shm/udev.cache
-			    else
-				    # Output detailed reason why the cached /dev is not used
-				    if [ "$VERBOSE" != "no" ]; then
-					    echo "udev: udev cache not used"
-					    echo "udev: we use $CMP_FILE_LIST as criteria to judge whether the cache /dev could be resued"
-					    echo "udev: olddata: $OLDDATA"
-					    echo "udev: newdata: $NEWDATA"
-				    fi
-				    echo "$NEWDATA" > /dev/shm/udev.cache
-			    fi
-		    else
-			    if [ "$ROOTFS_READ_ONLY" != "yes" ]; then
-				    # If rootfs is not read-only, it's possible that a new udev cache would be generated;
-				    # otherwise, we do not bother to read files.
-				    readfiles $CMP_FILE_LIST
-				    echo "$READDATA" > /dev/shm/udev.cache
-			    fi
-		    fi
-	    fi
-    fi
-
     # make_extra_nodes
     kill_udevd > "/dev/null" 2>&1
 
     # trigger the sorted events
-    echo -e '\000\000\000\000' > /proc/sys/kernel/hotplug
+    [ -e /proc/sys/kernel/hotplug ] && echo -e '\000' >/proc/sys/kernel/hotplug
     @UDEVD@ -d
 
     udevadm control --env=STARTUP=1
     if [ "$not_first_boot" != "" ];then
-            udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus  --subsystem-nomatch=graphics	 --subsystem-nomatch=backlight --subsystem-nomatch=video4linux	--subsystem-nomatch=platform
-            (udevadm settle --timeout=10; udevadm control --env=STARTUP=)&
+            if [ "$PROBE_PLATFORM_BUS" != "yes" ]; then
+                PLATFORM_BUS_NOMATCH="--subsystem-nomatch=platform"
+            else
+                PLATFORM_BUS_NOMATCH=""
+            fi
+            udevadm trigger --action=add --subsystem-nomatch=tty --subsystem-nomatch=mem --subsystem-nomatch=vc --subsystem-nomatch=vtconsole --subsystem-nomatch=misc --subsystem-nomatch=dcon --subsystem-nomatch=pci_bus --subsystem-nomatch=graphics --subsystem-nomatch=backlight --subsystem-nomatch=video4linux $PLATFORM_BUS_NOMATCH
+            (udevadm settle --timeout=3; udevadm control --env=STARTUP=)&
     else
             udevadm trigger --action=add
             udevadm settle
recipes-core/eudev/files/udev-cache deleted +0 -32
deleted file mode 100644
index 6898577..0000000
@@ -1,32 +0,0 @@
-#!/bin/sh -e
-
-### BEGIN INIT INFO
-# Provides:          udev-cache
-# Required-Start:    mountall
-# Required-Stop:
-# Default-Start:     S
-# Default-Stop:
-# Short-Description: cache /dev to speedup the udev next boot
-### END INIT INFO
-
-export TZ=/etc/localtime
-
-[ -r /proc/mounts ] || exit 1
-[ -x @UDEVD@ ] || exit 1
-[ -d /sys/class ] || exit 1
-
-[ -f /etc/default/rcS ] && . /etc/default/rcS
-[ -f /etc/default/udev-cache ] && . /etc/default/udev-cache
-
-if [ "$ROOTFS_READ_ONLY" = "yes" ]; then
-    [ "$VERBOSE" != "no" ] && echo "udev-cache: read-only rootfs, skip generating udev-cache"
-    exit 0
-fi
-
-if [ "$DEVCACHE" != "" -a -e /dev/shm/udev.cache ]; then
-	echo "Populating dev cache"
-	tar --directory=/ --selinux --xattrs -cf "$DEVCACHE" dev
-	mv /dev/shm/udev.cache /etc/udev/cache.data
-fi
-
-exit 0
Signature · 1 line
2.17.1
author
#2 lore raw

PATCH 3/3 bind: install volatiles file with correct name

In reply to Yi Zhao

Install volatiles file as 04_bind rather than volatiles.04_bind.

---
 recipes-connectivity/bind/bind_selinux.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-connectivity/bind/bind_selinux.inc +1 -1
index 1dfef8a..1be9260 100644
@@ -4,7 +4,7 @@ SRC_URI += "file://volatiles.04_bind"
 
 do_install_append() {
 	install -d ${D}${sysconfdir}/default/volatiles
-	install -m 0644 ${WORKDIR}/volatiles.04_bind ${D}${sysconfdir}/default/volatiles/volatiles.04_bind
+	install -m 0644 ${WORKDIR}/volatiles.04_bind ${D}${sysconfdir}/default/volatiles/04_bind
 
 	sed -i '/^\s*\/usr\/sbin\/rndc-confgen/a\
 	    [ -x /sbin/restorecon ] && /sbin/restorecon -F /etc/bind/rndc.key' ${D}${sysconfdir}/init.d/bind
Signature · 1 line
2.17.1