diff options
author | Yu Ke <ke.yu@intel.com> | 2010-08-27 10:10:52 +0800 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-09-02 09:50:48 +0100 |
commit | df894c658d9df87b0b04fbb494d46d8eff0fd497 (patch) | |
tree | 716c831f92e4ac7f27d5d19c49ff928933760e56 | |
parent | 8cbf96aeaf10182e97f5180d22eaf969f968202e (diff) | |
download | poky-df894c658d9df87b0b04fbb494d46d8eff0fd497.tar.gz |
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>
-rw-r--r-- | meta/recipes-extended/sysklogd/files/no-strip-install.patch | 15 | ||||
-rwxr-xr-x | meta/recipes-extended/sysklogd/files/sysklogd | 140 | ||||
-rw-r--r-- | meta/recipes-extended/sysklogd/sysklogd.inc | 89 | ||||
-rw-r--r-- | meta/recipes-extended/sysklogd/sysklogd_1.5.bb | 2 |
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 @@ | |||
1 | Index: sysklogd-1.5/Makefile | ||
2 | =================================================================== | ||
3 | --- sysklogd-1.5.orig/Makefile 2009-06-09 13:02:41.000000000 +0200 | ||
4 | +++ sysklogd-1.5/Makefile 2009-06-09 13:03:06.000000000 +0200 | ||
5 | @@ -127,8 +127,8 @@ | ||
6 | rm -f syslogd klogd ksym syslog_tst oops_test TAGS tsyslogd tklogd | ||
7 | |||
8 | install_exec: syslogd klogd | ||
9 | - ${INSTALL} -m 500 -s syslogd ${BINDIR}/syslogd | ||
10 | - ${INSTALL} -m 500 -s klogd ${BINDIR}/klogd | ||
11 | + ${INSTALL} -m 500 syslogd ${BINDIR}/syslogd | ||
12 | + ${INSTALL} -m 500 klogd ${BINDIR}/klogd | ||
13 | |||
14 | install_man: | ||
15 | ${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 @@ | |||
1 | #! /bin/sh | ||
2 | # /etc/init.d/sysklogd: start the system log daemon. | ||
3 | |||
4 | ### BEGIN INIT INFO | ||
5 | # Provides: sysklogd | ||
6 | # Required-Start: $remote_fs $time | ||
7 | # Required-Stop: $remote_fs $time | ||
8 | # Should-Start: $network | ||
9 | # Should-Stop: $network | ||
10 | # Default-Start: 2 3 4 5 | ||
11 | # Default-Stop: 0 1 6 | ||
12 | # Short-Description: System logger | ||
13 | ### END INIT INFO | ||
14 | |||
15 | PATH=/bin:/usr/bin:/sbin:/usr/sbin | ||
16 | |||
17 | pidfile_syslogd=/var/run/syslogd.pid | ||
18 | pidfile_klogd=/var/run/syslogd.pid | ||
19 | binpath_syslogd=/sbin/syslogd | ||
20 | binpath_klogd=/sbin/klogd | ||
21 | |||
22 | test -x $binpath || exit 0 | ||
23 | |||
24 | test ! -r /etc/default/syslogd || . /etc/default/syslogd | ||
25 | |||
26 | create_xconsole() | ||
27 | { | ||
28 | # Only proceed if /dev/xconsole is used at all | ||
29 | if ! grep -q '^[^#].*/dev/xconsole' /etc/syslog.conf | ||
30 | then | ||
31 | return | ||
32 | fi | ||
33 | |||
34 | if [ ! -e /dev/xconsole ]; then | ||
35 | mknod -m 640 /dev/xconsole p | ||
36 | else | ||
37 | chmod 0640 /dev/xconsole | ||
38 | fi | ||
39 | chown root:adm /dev/xconsole | ||
40 | test ! -x /sbin/restorecon || /sbin/restorecon /dev/xconsole | ||
41 | } | ||
42 | |||
43 | log_begin_msg () { | ||
44 | echo -n $1 | ||
45 | } | ||
46 | |||
47 | log_end_msg () { | ||
48 | echo $1 | ||
49 | } | ||
50 | |||
51 | log_success_msg () { | ||
52 | echo $1 | ||
53 | } | ||
54 | |||
55 | running() | ||
56 | { | ||
57 | # No pidfile, probably no daemon present | ||
58 | # | ||
59 | if [ ! -f $pidfile ] | ||
60 | then | ||
61 | return 1 | ||
62 | fi | ||
63 | |||
64 | pid=`cat $pidfile_syslogd` | ||
65 | |||
66 | # No pid, probably no daemon present | ||
67 | # | ||
68 | if [ -z "$pid" ] | ||
69 | then | ||
70 | return 1 | ||
71 | fi | ||
72 | |||
73 | if [ ! -d /proc/$pid ] | ||
74 | then | ||
75 | return 1 | ||
76 | fi | ||
77 | |||
78 | cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1` | ||
79 | |||
80 | # No syslogd? | ||
81 | # | ||
82 | if [ "$cmd" != "$binpath" ] | ||
83 | then | ||
84 | return 1 | ||
85 | fi | ||
86 | |||
87 | return 0 | ||
88 | } | ||
89 | |||
90 | case "$1" in | ||
91 | start) | ||
92 | log_begin_msg "Starting system log daemon..." | ||
93 | create_xconsole | ||
94 | start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD | ||
95 | log_end_msg $? | ||
96 | log_begin_msg "Starting kernel log daemon..." | ||
97 | start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD | ||
98 | log_end_msg $? | ||
99 | ;; | ||
100 | stop) | ||
101 | log_begin_msg "Stopping system log daemon..." | ||
102 | start-stop-daemon --stop --quiet --pidfile $pidfile_syslogd --name syslogd | ||
103 | log_end_msg $? | ||
104 | log_begin_msg "Stopping kernel log daemon..." | ||
105 | start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd | ||
106 | log_end_msg $? | ||
107 | ;; | ||
108 | reload|force-reload) | ||
109 | log_begin_msg "Reloading system log daemon..." | ||
110 | start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile_syslogd --name syslogd | ||
111 | log_end_msg $? | ||
112 | log_begin_msg "Reloading kernel log daemon..." | ||
113 | start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd | ||
114 | start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD | ||
115 | log_end_msg $? | ||
116 | ;; | ||
117 | restart) | ||
118 | log_begin_msg "Restarting system log daemon..." | ||
119 | start-stop-daemon --stop --retry 5 --quiet --pidfile $pidfile_syslogd --name syslogd | ||
120 | start-stop-daemon --start --quiet --pidfile $pidfile_syslogd --name syslogd --startas $binpath_syslogd -- $SYSLOGD | ||
121 | log_end_msg $? | ||
122 | log_begin_msg "Reloading kernel log daemon..." | ||
123 | start-stop-daemon --stop --quiet --retry 3 --exec $binpath_klogd --pidfile $pidfile_klogd | ||
124 | start-stop-daemon --start --quiet --pidfile $pidfile_klogd --name klogd --startas $binpath_klogd -- $KLOGD | ||
125 | log_end_msg $? | ||
126 | ;; | ||
127 | reload-or-restart) | ||
128 | if running | ||
129 | then | ||
130 | $0 reload | ||
131 | else | ||
132 | $0 start | ||
133 | fi | ||
134 | ;; | ||
135 | *) | ||
136 | log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}" | ||
137 | exit 1 | ||
138 | esac | ||
139 | |||
140 | 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 @@ | |||
1 | DESCRIPTION = "The sysklogd package implements two system log daemons: syslogd, klogd" | ||
2 | HOMEPAGE = "http://www.infodrom.org/projects/sysklogd/" | ||
3 | SECTION = "base" | ||
4 | |||
5 | LICENSE = "GPLv2+ & BSD" | ||
6 | LICENSE_syslogd = "BSD" | ||
7 | LICENSE_klogd = "GPLv2+" | ||
8 | LIC_FILES_CHKSUM = "file://COPYING;md5=8ca43cbc842c2336e835926c2166c28b \ | ||
9 | file://syslogd.c;beginline=2;endline=15;md5=77ffb2fec48c46d7ca0abb2d5813e7fd \ | ||
10 | file://klogd.c;beginline=2;endline=19;md5=7e87ed0ae6142de079bce738c10c899d \ | ||
11 | " | ||
12 | |||
13 | # syslog initscript is handled explicitly because order of | ||
14 | # update-rc.d and update-alternatives is important (see below) | ||
15 | DEPENDS_append = " update-rc.d update-rc.d-native" | ||
16 | RDEPENDS_${PN}_append = " ${@base_conditional("ONLINE_PACKAGE_MANAGEMENT", "none", "", "update-rc.d", d)}" | ||
17 | |||
18 | SRC_URI = "http://www.infodrom.org/projects/sysklogd/download/sysklogd-${PV}.tar.gz \ | ||
19 | file://no-strip-install.patch \ | ||
20 | file://sysklogd \ | ||
21 | " | ||
22 | |||
23 | INITSCRIPT_NAME = "syslog" | ||
24 | |||
25 | CFLAGS_append = " -DSYSV" | ||
26 | |||
27 | do_install () { | ||
28 | install -d ${D}${mandir}/man8 \ | ||
29 | ${D}${mandir}/man5 \ | ||
30 | ${D}${base_sbindir} | ||
31 | oe_runmake 'BINDIR=${D}${base_sbindir}' \ | ||
32 | 'MANDIR=${D}${mandir}' install | ||
33 | mv ${D}${base_sbindir}/syslogd ${D}${base_sbindir}/syslogd.${PN} | ||
34 | mv ${D}${base_sbindir}/klogd ${D}${base_sbindir}/klogd.${PN} | ||
35 | install -d ${D}${sysconfdir} | ||
36 | install -m 644 ${S}/syslog.conf ${D}${sysconfdir}/syslog.conf | ||
37 | install -d ${D}${sysconfdir}/init.d | ||
38 | install -m 755 ${WORKDIR}/sysklogd ${D}${sysconfdir}/init.d/syslog.${PN} | ||
39 | } | ||
40 | |||
41 | pkg_preinst_${PN} () { | ||
42 | # all this is needed to avoid sysmlink errors, | ||
43 | # because update-rc.d runs before pkg_postinst | ||
44 | if [ -e ${sysconfdir}/init.d/syslog -a ! -L ${sysconfdir}/init.d/syslog ]; then | ||
45 | echo "WARNING:" "non symlink ${sysconfdir}/init.d/syslog exist -> backup to ${sysconfdir}/init.d/syslog.old" | ||
46 | mv ${sysconfdir}/init.d/syslog ${sysconfdir}/init.d/syslog.old | ||
47 | fi | ||
48 | if [ ! -e ${sysconfdir}/init.d/syslog ]; then | ||
49 | ln -s dummy ${sysconfdir}/init.d/syslog | ||
50 | fi | ||
51 | } | ||
52 | |||
53 | pkg_postinst_${PN} () { | ||
54 | update-alternatives --install ${base_sbindir}/syslogd syslogd syslogd.${PN} 100 | ||
55 | update-alternatives --install ${base_sbindir}/klogd klogd klogd.${PN} 100 | ||
56 | update-alternatives --install ${sysconfdir}/init.d/syslog syslog-init syslog.${PN} 100 | ||
57 | |||
58 | if test "x$D" != "x"; then | ||
59 | OPT="-r $D" | ||
60 | else | ||
61 | OPT="-s" | ||
62 | fi | ||
63 | update-rc.d $OPT syslog defaults | ||
64 | } | ||
65 | |||
66 | pkg_prerm_${PN} () { | ||
67 | update-alternatives --remove syslogd syslogd.${PN} | ||
68 | update-alternatives --remove klogd klogd.${PN} | ||
69 | |||
70 | if test "x$D" = "x"; then | ||
71 | if test "$1" = "upgrade" -o "$1" = "remove"; then | ||
72 | /etc/init.d/syslog stop | ||
73 | fi | ||
74 | fi | ||
75 | update-alternatives --remove syslog-init syslog.${PN} | ||
76 | } | ||
77 | |||
78 | pkg_postrm_${PN} () { | ||
79 | if test "x$D" != "x"; then | ||
80 | OPT="-r $D" | ||
81 | else | ||
82 | OPT="" | ||
83 | fi | ||
84 | if test "$1" = "remove" -o "$1" = "purge"; then | ||
85 | if ! test -e "/etc/init.d/syslog"; then | ||
86 | update-rc.d $OPT syslog remove | ||
87 | fi | ||
88 | fi | ||
89 | } | ||
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 @@ | |||
1 | require sysklogd.inc | ||
2 | PR = "r0" | ||