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 /meta/recipes-extended/sysklogd/files | |
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>
Diffstat (limited to 'meta/recipes-extended/sysklogd/files')
-rw-r--r-- | meta/recipes-extended/sysklogd/files/no-strip-install.patch | 15 | ||||
-rwxr-xr-x | meta/recipes-extended/sysklogd/files/sysklogd | 140 |
2 files changed, 155 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 | ||