Patchwork [2/3] sysklogd: various fixes so it starts/stops cleanly

login
register
mail settings
Submitter Joshua Lock
Date Feb. 1, 2012, 12:58 a.m.
Message ID <e2b46859bfa16f03f06e0368857740a549a1c33c.1328057677.git.josh@linux.intel.com>
Download mbox | patch
Permalink /patch/20463/
State New
Headers show

Comments

Joshua Lock - Feb. 1, 2012, 12:58 a.m.
This patch fixes several issues with the sysklogd recipe:
o Errors at start due to non-existent /var/log/news/ - every other log
  file is created in /var/log, not a sub-directory. Do the same for news
  logs.
o klogd would not be stopped due to pidfile recycling, give klogd its own
  pidfile
o preinstalls failed at rootfs creation time by trying to access the host
  root filesystem rather than a path relative to $D. Update the preinst to
  test for $D and do the right thing.

Signed-off-by: Joshua Lock <josh@linux.intel.com>
---
 meta/recipes-extended/sysklogd/files/sysklogd    |    2 +-
 meta/recipes-extended/sysklogd/files/syslog.conf |    6 +++---
 meta/recipes-extended/sysklogd/sysklogd.inc      |   14 ++++++++++----
 meta/recipes-extended/sysklogd/sysklogd_1.5.bb   |    2 +-
 4 files changed, 15 insertions(+), 9 deletions(-)
Otavio Salvador - Feb. 1, 2012, 2:06 a.m.
On Tue, Jan 31, 2012 at 22:58, Joshua Lock <josh@linux.intel.com> wrote:

> @@ -46,12 +46,18 @@ do_install () {
>  pkg_preinst_${PN} () {
>        # all this is needed to avoid sysmlink errors,
>        # because update-rc.d runs before pkg_postinst
> -       if [ -e ${sysconfdir}/init.d/syslog -a ! -L
> ${sysconfdir}/init.d/syslog ]; then
> +       if test "x$D" != "x"; then
> +               ETC=$D/${sysconfdir}
> +       else
> +               ETC=${sysconfdir}
> +       fi
>

You might use

ETC=$D${sysconfdir}

and avoid the if block as a whole.
Joshua Lock - Feb. 1, 2012, 6:45 a.m.
On 31/01/12 18:06, Otavio Salvador wrote:
> On Tue, Jan 31, 2012 at 22:58, Joshua Lock <josh@linux.intel.com
> <mailto:josh@linux.intel.com>> wrote:
>
>     @@ -46,12 +46,18 @@ do_install () {
>       pkg_preinst_${PN} () {
>             # all this is needed to avoid sysmlink errors,
>             # because update-rc.d runs before pkg_postinst
>     -       if [ -e ${sysconfdir}/init.d/syslog -a ! -L
>     ${sysconfdir}/init.d/syslog ]; then
>     +       if test "x$D" != "x"; then
>     +               ETC=$D/${sysconfdir}
>     +       else
>     +               ETC=${sysconfdir}
>     +       fi
>
>
> You might use
>
> ETC=$D${sysconfdir}
>
> and avoid the if block as a whole.

Quite right. That is cleaner, updated commit pushed to the same branch:
http://git.openembedded.org/openembedded-core-contrib/commit/?h=josh/fixes&id=937acf5b59e5a1de2cc334b069390b3ccdb055a0

Thanks for the review.

Cheers,
Joshua

Patch

diff --git a/meta/recipes-extended/sysklogd/files/sysklogd b/meta/recipes-extended/sysklogd/files/sysklogd
index e0fa7a8..dcbc81e 100755
--- a/meta/recipes-extended/sysklogd/files/sysklogd
+++ b/meta/recipes-extended/sysklogd/files/sysklogd
@@ -15,7 +15,7 @@ 
 PATH=/bin:/usr/bin:/sbin:/usr/sbin
 
 pidfile_syslogd=/var/run/syslogd.pid
-pidfile_klogd=/var/run/syslogd.pid
+pidfile_klogd=/var/run/klogd.pid
 binpath_syslogd=/sbin/syslogd
 binpath_klogd=/sbin/klogd
 
diff --git a/meta/recipes-extended/sysklogd/files/syslog.conf b/meta/recipes-extended/sysklogd/files/syslog.conf
index 795d735..7d1858c 100644
--- a/meta/recipes-extended/sysklogd/files/syslog.conf
+++ b/meta/recipes-extended/sysklogd/files/syslog.conf
@@ -26,9 +26,9 @@  mail.err			/var/log/mail.err
 
 # Logging for INN news system
 #
-news.crit			/var/log/news/news.crit
-news.err			/var/log/news/news.err
-news.notice			-/var/log/news/news.notice
+news.crit			/var/log/news.crit
+news.err			/var/log/news.err
+news.notice			-/var/log/news.notice
 
 #
 # Some `catch-all' logfiles.
diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc b/meta/recipes-extended/sysklogd/sysklogd.inc
index 0b84dac..d4eea41 100644
--- a/meta/recipes-extended/sysklogd/sysklogd.inc
+++ b/meta/recipes-extended/sysklogd/sysklogd.inc
@@ -46,12 +46,18 @@  do_install () {
 pkg_preinst_${PN} () {
 	# all this is needed to avoid sysmlink errors,
 	# because update-rc.d runs before pkg_postinst
-	if [ -e ${sysconfdir}/init.d/syslog -a ! -L ${sysconfdir}/init.d/syslog ]; then
+	if test "x$D" != "x"; then
+		ETC=$D/${sysconfdir}
+	else
+		ETC=${sysconfdir}
+	fi
+
+	if [ -e $ETC/init.d/syslog -a ! -L $ETC/init.d/syslog ]; then
 		echo "WARNING:" "non symlink ${sysconfdir}/init.d/syslog exist -> backup to ${sysconfdir}/init.d/syslog.old"
-		mv ${sysconfdir}/init.d/syslog ${sysconfdir}/init.d/syslog.old
+		mv $ETC/init.d/syslog $ETC/init.d/syslog.old
 	fi
-	if [ ! -e ${sysconfdir}/init.d/syslog ]; then
-		ln -s dummy ${sysconfdir}/init.d/syslog
+	if [ ! -e $ETC/init.d/syslog ]; then
+		ln -s dummy $ETC/init.d/syslog
 	fi
 }
 
diff --git a/meta/recipes-extended/sysklogd/sysklogd_1.5.bb b/meta/recipes-extended/sysklogd/sysklogd_1.5.bb
index 187c9f4..b58094e 100644
--- a/meta/recipes-extended/sysklogd/sysklogd_1.5.bb
+++ b/meta/recipes-extended/sysklogd/sysklogd_1.5.bb
@@ -1,5 +1,5 @@ 
 require sysklogd.inc
-PR = "r4"
+PR = "r5"
 
 SRC_URI[md5sum] = "e053094e8103165f98ddafe828f6ae4b"
 SRC_URI[sha256sum] = "6169b8e91d29288e90404f01462b69e7f2afb1161aa419826fe4736c7f9eb773"