summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/sysklogd
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2010-08-27 10:10:52 +0800
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-02 09:50:48 +0100
commitdf894c658d9df87b0b04fbb494d46d8eff0fd497 (patch)
tree716c831f92e4ac7f27d5d19c49ff928933760e56 /meta/recipes-extended/sysklogd
parent8cbf96aeaf10182e97f5180d22eaf969f968202e (diff)
downloadopenembedded-core-df894c658d9df87b0b04fbb494d46d8eff0fd497.tar.gz
openembedded-core-df894c658d9df87b0b04fbb494d46d8eff0fd497.tar.bz2
openembedded-core-df894c658d9df87b0b04fbb494d46d8eff0fd497.zip
sysklogd: add sysklogd 1.5
sysklogd implements two system log daemons: syslogd, klogd. this commit adds sysklogd 1.5. it is ported from OE with some cleanup. sysklogd: move to recipes-extended Signed-off-by: Yu Ke <ke.yu@intel.com> Signed-off-by: Saul Wold <Saul.Wold@intel.com>
Diffstat (limited to 'meta/recipes-extended/sysklogd')
-rw-r--r--meta/recipes-extended/sysklogd/files/no-strip-install.patch15
-rwxr-xr-xmeta/recipes-extended/sysklogd/files/sysklogd140
-rw-r--r--meta/recipes-extended/sysklogd/sysklogd.inc89
-rw-r--r--meta/recipes-extended/sysklogd/sysklogd_1.5.bb2
4 files changed, 246 insertions, 0 deletions
diff --git a/meta/recipes-extended/sysklogd/files/no-strip-install.patch b/meta/recipes-extended/sysklogd/files/no-strip-install.patch
new file mode 100644
index 0000000000..5a78f01738
--- /dev/null
+++ b/meta/recipes-extended/sysklogd/files/no-strip-install.patch
@@ -0,0 +1,15 @@
+Index: sysklogd-1.5/Makefile
+===================================================================
+--- sysklogd-1.5.orig/Makefile 2009-06-09 13:02:41.000000000 +0200
++++ sysklogd-1.5/Makefile 2009-06-09 13:03:06.000000000 +0200
+@@ -127,8 +127,8 @@
+ rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd
+
+ install_exec: syslogd klogd
+- ${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd
+- ${INSTALL} -m 500 -s klogd ${BINDIR}/klogd
++ ${INSTALL} -m 500 syslogd ${BINDIR}/syslogd
++ ${INSTALL} -m 500 klogd ${BINDIR}/klogd
+
+ install_man:
+ ${INSTALL} -m ${MAN_PERMS} sysklogd.8 ${MANDIR}/man8/sysklogd.8
diff --git a/meta/recipes-extended/sysklogd/files/sysklogd b/meta/recipes-extended/sysklogd/files/sysklogd
new file mode 100755
index 0000000000..e0fa7a8e1e
--- /dev/null
+++ b/meta/recipes-extended/sysklogd/files/sysklogd
@@ -0,0 +1,140 @@
+#! /bin/sh
+# /etc/init.d/sysklogd: start the system log daemon.
+
+### BEGIN INIT INFO
+# Provides: sysklogd
+# Required-Start: $remote_fs $time
+# Required-Stop: $remote_fs $time
+# Should-Start: $network
+# Should-Stop: $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: System logger
+### END INIT INFO
+
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+pidfile_syslogd=/var/run/syslogd.pid
+pidfile_klogd=/var/run/syslogd.pid
+binpath_syslogd=/sbin/syslogd
+binpath_klogd=/sbin/klogd
+
+test -x $binpath || exit 0
+
+test ! -r /etc/default/syslogd || . /etc/default/syslogd
+
+create_xconsole()
+{
+ # Only proceed if /dev/xconsole is used at all
+ if ! grep -q '^[^#].*/dev/xconsole' /etc/syslog.conf
+ then
+ return
+ fi
+
+ if [ ! -e /dev/xconsole ]; then
+ mknod -m 640 /dev/xconsole p
+ else
+ chmod 0640 /dev/xconsole
+ fi
+ chown root:adm /dev/xconsole
+ test ! -x /sbin/restorecon || /sbin/restorecon /dev/xconsole
+}
+
+log_begin_msg () {
+ echo -n $1
+}
+
+log_end_msg () {
+ echo $1
+}
+
+log_success_msg () {
+ echo $1
+}
+
+running()
+{
+ # No pidfile, probably no daemon present
+ #
+ if [ ! -f $pidfile ]
+ then
+ return 1
+ fi
+
+ pid=`cat $pidfile_syslogd`
+
+ # No pid, probably no daemon present
+ #
+ if [ -z "$pid" ]
+ then
+ return 1
+ fi
+
+ if [ ! -d /proc/$pid ]
+ then
+ return 1
+ fi
+
+ cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1`
+
+ # No syslogd?
+ #
+ if [ "$cmd" != "$binpath" ]
+ then
+ return 1
+ fi
+
+ return 0
+}
+
+case "$1" in
+ start)
+ log_begin_msg "Starting system log daemon..."
+ create_xconsole
+ start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD
+ 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..."
+ start-stop-daemon --stop --retry 5 --quiet --pidfile $pidfile_syslogd --name syslogd
+ 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
+ then
+ $0 reload
+ else
+ $0 start
+ fi
+ ;;
+ *)
+ log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}"
+ exit 1
+esac
+
+exit 0
diff --git a/meta/recipes-extended/sysklogd/sysklogd.inc b/meta/recipes-extended/sysklogd/sysklogd.inc
new file mode 100644
index 0000000000..76ab707b21
--- /dev/null
+++ b/meta/recipes-extended/sysklogd/sysklogd.inc
@@ -0,0 +1,89 @@
+DESCRIPTION = "The sysklogd package implements two system log daemons: syslogd, klogd"
+HOMEPAGE = "http://www.infodrom.org/projects/sysklogd/"
+SECTION = "base"
+
+LICENSE = "GPLv2+ & BSD"
+LICENSE_syslogd = "BSD"
+LICENSE_klogd = "GPLv2+"
+LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \
+ file://syslogd.c;beginline=2;endline=15;md5=77ffb2fec48c46d7ca0abb2d5813e7fd \
+ file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \
+ "
+
+# syslog initscript is handled explicitly because order of
+# update-rc.d and update-alternatives is important (see below)
+DEPENDS_append = " update-rc.d update-rc.d-native"
+RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}"
+
+SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \
+ file://no-strip-install.patch \
+ file://sysklogd \
+ "
+
+INITSCRIPT_NAME = "syslog"
+
+CFLAGS_append = " -DSYSV"
+
+do_install () {
+ install -d ${D}${mandir}/man8 \
+ ${D}${mandir}/man5 \
+ ${D}${base_sbindir}
+ oe_runmake 'BINDIR=${D}${base_sbindir}' \
+ 'MANDIR=${D}${mandir}' install
+ mv ${D}${base_sbindir}/syslogd ${D}${base_sbindir}/syslogd.${PN}
+ mv ${D}${base_sbindir}/klogd ${D}${base_sbindir}/klogd.${PN}
+ install -d ${D}${sysconfdir}
+ install -m 644 ${S}/syslog.conf ${D}${sysconfdir}/syslog.conf
+ install -d ${D}${sysconfdir}/init.d
+ install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog.${PN}
+}
+
+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
+ 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
+ fi
+ if [ ! -e ${sysconfdir}/init.d/syslog ]; then
+ ln -s dummy ${sysconfdir}/init.d/syslog
+ fi
+}
+
+pkg_postinst_${PN} () {
+ update-alternatives --install ${base_sbindir}/syslogd syslogd syslogd.${PN} 100
+ update-alternatives --install ${base_sbindir}/klogd klogd klogd.${PN} 100
+ update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 100
+
+ if test "x$D" != "x"; then
+ OPT="-r $D"
+ else
+ OPT="-s"
+ fi
+ update-rc.d $OPT syslog defaults
+}
+
+pkg_prerm_${PN} () {
+ update-alternatives --remove syslogd syslogd.${PN}
+ update-alternatives --remove klogd klogd.${PN}
+
+ if test "x$D" = "x"; then
+ if test "$1" = "upgrade" -o "$1" = "remove"; then
+ /etc/init.d/syslog stop
+ fi
+ fi
+ update-alternatives --remove syslog-init syslog.${PN}
+}
+
+pkg_postrm_${PN} () {
+ if test "x$D" != "x"; then
+ OPT="-r $D"
+ else
+ OPT=""
+ fi
+ if test "$1" = "remove" -o "$1" = "purge"; then
+ if ! test -e "/etc/init.d/syslog"; then
+ update-rc.d $OPT syslog remove
+ fi
+ fi
+}
diff --git a/meta/recipes-extended/sysklogd/sysklogd_1.5.bb b/meta/recipes-extended/sysklogd/sysklogd_1.5.bb
new file mode 100644
index 0000000000..8344e272c4
--- /dev/null
+++ b/meta/recipes-extended/sysklogd/sysklogd_1.5.bb
@@ -0,0 +1,2 @@
+require sysklogd.inc
+PR = "r0"