1 <?xml version=
"1.0" encoding=
"ISO-8859-1"?>
2 <rss version='
2.0' xmlns:lj='http://www.livejournal.org/rss/lj/
1.0/'
>
4 <title>Petter Reinholdtsen - Entries from November
2013</title>
5 <description>Entries from November
2013</description>
6 <link>http://people.skolelinux.org/pere/blog/
</link>
10 <title>Debian init.d boot script example for rsyslog
</title>
11 <link>http://people.skolelinux.org/pere/blog/Debian_init_d_boot_script_example_for_rsyslog.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Debian_init_d_boot_script_example_for_rsyslog.html
</guid>
13 <pubDate>Sat,
2 Nov
2013 22:
40:
00 +
0100</pubDate>
14 <description><p
>If one of the points of switching to a new init system in Debian is
15 <a href=
"http://thomas.goirand.fr/blog/?p=
147">to get rid of huge
16 init.d scripts
</a
>, I doubt we need to switch away from sysvinit and
17 init.d scripts at all. Here is an example init.d script, ie a rewrite
18 of /etc/init.d/rsyslog:
</p
>
21 #!/lib/init/init-d-script
24 # Required-Start: $remote_fs $time
25 # Required-Stop: umountnfs $time
26 # X-Stop-After: sendsigs
27 # Default-Start:
2 3 4 5
29 # Short-Description: enhanced syslogd
30 # Description: Rsyslog is an enhanced multi-threaded syslogd.
31 # It is quite compatible to stock sysklogd and can be
32 # used as a drop-in replacement.
34 DESC=
"enhanced syslogd
"
35 DAEMON=/usr/sbin/rsyslogd
36 </pre
></p
>
38 <p
>Pretty minimalistic to me... For the record, the original sysv-rc
39 script was
137 lines, and the above is just
15 lines, most of the meta
40 info/comments.
</p
>
42 <p
>How to do this, you ask? Well, one create a new script
43 /lib/init/init-d-script looking something like this:
48 # Define LSB log_* functions.
49 # Depend on lsb-base (
>=
3.2-
14) to ensure that this file is present
50 # and status_of_proc is working.
51 . /lib/lsb/init-functions
54 # Function that starts the daemon/service
60 #
0 if daemon has been started
61 #
1 if daemon was already running
62 #
2 if daemon could not be started
63 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test
> /dev/null \
65 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
68 # Add code here, if necessary, that waits for the process to be ready
69 # to handle requests from services started subsequently which depend
70 # on this one. As a last resort, sleep for some time.
74 # Function that stops the daemon/service
79 #
0 if daemon has been stopped
80 #
1 if daemon was already stopped
81 #
2 if daemon could not be stopped
82 # other if a failure occurred
83 start-stop-daemon --stop --quiet --retry=TERM/
30/KILL/
5 --pidfile $PIDFILE --name $NAME
85 [
"$RETVAL
" =
2 ]
&& return
2
86 # Wait for children to finish too if this is a daemon that forks
87 # and if the daemon is only ever run from this initscript.
88 # If the above conditions are not satisfied then add some other code
89 # that waits for the process to drop all resources that could be
90 # needed by services started subsequently. A last resort is to
91 # sleep for some time.
92 start-stop-daemon --stop --quiet --oknodo --retry=
0/
30/KILL/
5 --exec $DAEMON
93 [
"$?
" =
2 ]
&& return
2
94 # Many daemons don
't delete their pidfiles when they exit.
96 return
"$RETVAL
"
100 # Function that sends a SIGHUP to the daemon/service
104 # If the daemon can reload its configuration without
105 # restarting (for example, when it is sent a SIGHUP),
106 # then implement that here.
108 start-stop-daemon --stop --signal
1 --quiet --pidfile $PIDFILE --name $NAME
113 scriptbasename=
"$(basename $
1)
"
114 echo
"SN: $scriptbasename
"
115 if [
"$scriptbasename
" !=
"init-d-library
" ] ; then
116 script=
"$
1"
123 NAME=$(basename $DAEMON)
124 PIDFILE=/var/run/$NAME.pid
126 # Exit if the package is not installed
127 #[ -x
"$DAEMON
" ] || exit
0
129 # Read configuration variable file if it is present
130 [ -r /etc/default/$NAME ]
&& . /etc/default/$NAME
132 # Load the VERBOSE setting and other rcS variables
135 case
"$
1" in
137 [
"$VERBOSE
" != no ]
&& log_daemon_msg
"Starting $DESC
" "$NAME
"
139 case
"$?
" in
140 0|
1) [
"$VERBOSE
" != no ]
&& log_end_msg
0 ;;
141 2) [
"$VERBOSE
" != no ]
&& log_end_msg
1 ;;
145 [
"$VERBOSE
" != no ]
&& log_daemon_msg
"Stopping $DESC
" "$NAME
"
147 case
"$?
" in
148 0|
1) [
"$VERBOSE
" != no ]
&& log_end_msg
0 ;;
149 2) [
"$VERBOSE
" != no ]
&& log_end_msg
1 ;;
153 status_of_proc
"$DAEMON
" "$NAME
" && exit
0 || exit $?
155 #reload|force-reload)
157 # If do_reload() is not implemented then leave this commented out
158 # and leave
'force-reload
' as an alias for
'restart
'.
160 #log_daemon_msg
"Reloading $DESC
" "$NAME
"
164 restart|force-reload)
166 # If the
"reload
" option is implemented then remove the
167 #
'force-reload
' alias
169 log_daemon_msg
"Restarting $DESC
" "$NAME
"
171 case
"$?
" in
174 case
"$?
" in
176 1) log_end_msg
1 ;; # Old process is still running
177 *) log_end_msg
1 ;; # Failed to start
187 echo
"Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}
" >&2
193 </pre
></p
>
195 <p
>It is based on /etc/init.d/skeleton, and could be improved quite a
196 lot. I did not really polish the approach, so it might not always
197 work out of the box, but you get the idea. I did not try very hard to
198 optimize it nor make it more robust either.
</p
>
200 <p
>A better argument for switching init system in Debian than reducing
201 the size of init scripts (which is a good thing to do anyway), is to
202 get boot system that is able to handle the kernel events sensibly and
203 robustly, and do not depend on the boot to run sequentially. The boot
204 and the kernel have not behaved sequentially in year.
</p
>
209 <title>Browser plugin for SPICE (spice-xpi) uploaded to Debian
</title>
210 <link>http://people.skolelinux.org/pere/blog/Browser_plugin_for_SPICE__spice_xpi__uploaded_to_Debian.html
</link>
211 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Browser_plugin_for_SPICE__spice_xpi__uploaded_to_Debian.html
</guid>
212 <pubDate>Fri,
1 Nov
2013 11:
00:
00 +
0100</pubDate>
213 <description><p
><a href=
"http://www.spice-space.org/
">The SPICE protocol
</a
> for
214 remote display access is the preferred solution with oVirt and RedHat
215 Enterprise Virtualization, and I was sad to discover the other day
216 that the browser plugin needed to use these systems seamlessly was
217 missing in Debian. The
<a href=
"http://bugs.debian.org/
668284">request
218 for a package
</a
> was from
2012-
04-
10 with no progress since
219 2013-
04-
01, so I decided to wrap up a package based on the great work
220 from Cajus Pollmeier and put it in a collab-maint maintained git
221 repository to get a package I could use. I would very much like
222 others to help me maintain the package (or just take over, I do not
223 mind), but as no-one had volunteered so far, I just uploaded it to
224 NEW. I hope it will be available in Debian in a few days.
</p
>
226 <p
>The source is now available from
227 <a href=
"http://anonscm.debian.org/gitweb/?p=collab-maint/spice-xpi.git;a=summary
">http://anonscm.debian.org/gitweb/?p=collab-maint/spice-xpi.git;a=summary
</a
>.
</p
>