]> arthur.barton.de Git - bup.git/blob - testfile1
Name temp files from 'make test' as *.tmp to make them easier to clean.
[bup.git] / testfile1
1 #! /bin/sh -e
2
3 # Check for daemon presence
4 test -x /usr/sbin/acpid || exit 0
5
6 # Check for ACPI support on kernel side
7 [ -d /proc/acpi ] || exit 0
8
9 # Include acpid defaults if available
10 OPTIONS=""
11 if [ -f /etc/default/acpid ] ; then
12         . /etc/default/acpid
13 fi
14
15 # Get lsb functions
16 . /lib/lsb/init-functions
17 . /etc/default/rcS
18
19 if [ "x$VERBOSE" = "xno" ]; then
20         MODPROBE_OPTIONS="$MODPROBE_OPTIONS -Q"
21         export MODPROBE_OPTIONS
22 fi
23
24 # As the name says. If the kernel supports modules, it'll try to load
25 # the ones listed in "MODULES".
26 load_modules() {
27         PRINTK=`cat /proc/sys/kernel/printk`
28         [ "$VERBOSE" = no ] && echo "0 0 0 0" > /proc/sys/kernel/printk
29         
30         LIST=`/sbin/lsmod|awk '!/Module/ {print $1}'`
31
32         # Get list of available modules
33         LOC="/lib/modules/`uname -r`/kernel/drivers/acpi"
34         LOC2="/lib/modules/`uname -r`/kernel/ubuntu/acpi"
35         if [ -d $LOC ]; then
36           MODAVAIL=`( find $LOC -type f -name "*.o" -printf "basename %f .o\n"; \
37                 find $LOC -type f -name "*.ko" -printf "basename %f .ko\n" ) | /bin/sh`
38         else
39           MODAVAIL=""
40         fi
41
42         if [ -d $LOC2 ]; then
43           MODAVAIL="$MODAVAIL `( find $LOC2 -type f -name "*.o" -printf "basename %f .o\n"; \
44                 find $LOC2 -type f -name "*.ko" -printf "basename %f .ko\n" ) | /bin/sh`"
45         fi
46
47         if [ "$MODULES" = "all" ]; then
48                 MODULES="$MODAVAIL"
49         fi
50
51         if [ -n "$MODULES" ]; then
52                 log_begin_msg "Loading ACPI modules..."
53                 STATUS=0
54                 for mod in $MODULES; do
55                         echo $MODAVAIL | grep -q -w "$mod" || continue
56                         if echo $LIST | grep -q -w "$mod"; then
57                                 [ "$VERBOSE" != no ] && log_success_msg "Module already loaded: $mod"
58                         else
59                                 if modprobe -b $mod 2>/dev/null; then
60                                         [ "$VERBOSE" != no ] && log_success_msg "Loaded module: $mod"
61                                 else
62                                         if [ "$VERBOSE" != no ]; then
63                                                 log_warning_msg "Unable to load module: $mod"
64                                         fi
65                                 fi
66                         fi              
67                 done
68                 log_end_msg $STATUS
69         fi
70         echo "$PRINTK" > /proc/sys/kernel/printk
71 }
72
73 case "$1" in
74   start)
75     [ -f /proc/modules ] && load_modules
76     log_begin_msg "Starting ACPI services..."
77     start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/acpid -- -c /etc/acpi/events $OPTIONS
78     log_end_msg $?
79     ;;
80   stop)
81     log_begin_msg "Stopping ACPI services..."
82     start-stop-daemon --stop --quiet --oknodo --retry 2 --exec /usr/sbin/acpid
83     log_end_msg $?
84     ;;
85   restart)
86     $0 stop
87     sleep 1
88     $0 start
89     ;;
90   reload|force-reload) 
91     log_begin_msg "Reloading ACPI services..."
92     start-stop-daemon --stop --signal 1 --exec /usr/sbin/acpid
93     log_end_msg $?
94     ;;
95   *)
96     log_success_msg "Usage: /etc/init.d/acpid {start|stop|restart|reload|force-reload}"
97     exit 1
98 esac
99
100 exit 0
101 #!/bin/bash
102 # INIT script to check whether we're on batteries, and so start with laptop 
103 # mode etc enabled.
104
105 # BUGS: unless we start *really* late, we have no way of throttling 
106 # xscreensaver, since it won't be there to command.
107 . /usr/share/acpi-support/power-funcs
108
109 test -f /lib/lsb/init-functions || exit 1
110 . /lib/lsb/init-functions
111
112 test -d /var/lib/acpi-support || exit 0
113
114 shopt -s nullglob
115
116 case "$1" in
117   start)
118     log_begin_msg "Checking battery state..."
119     /etc/acpi/power.sh
120     # Source everything in /etc/acpi/start.d/
121     for SCRIPT in /etc/acpi/start.d/*.sh; do
122         . $SCRIPT
123     done
124     log_end_msg 0
125     ;;
126   stop)
127     log_begin_msg "Disabling power management..."
128     /etc/acpi/power.sh stop
129     log_end_msg 0
130     ;;
131   *)
132   ;;
133 esac
134         
135
136 #!/bin/sh
137 #
138 # alsa-utils initscript
139 #
140 ### BEGIN INIT INFO
141 # Provides:          alsa-utils
142 # Required-Start:    $remote_fs
143 # Required-Stop:     $remote_fs
144 # Default-Start:     S
145 # Default-Stop:      0 6
146 # Short-Description: Restore and store ALSA driver settings
147 # Description:       This script stores and restores mixer levels on
148 #                    shutdown and bootup.On sysv-rc systems: to
149 #                    disable storing of mixer levels on shutdown,
150 #                    remove /etc/rc[06].d/K50alsa-utils.  To disable
151 #                    restoring of mixer levels on bootup, rename the
152 #                    "S50alsa-utils" symbolic link in /etc/rcS.d/ to
153 #                    "K50alsa-utils".
154 ### END INIT INFO
155
156 # Don't use set -e; check exit status instead
157
158 # Exit silently if package is no longer installed
159 [ -x /sbin/alsactl ] || exit 0
160
161 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
162 MYNAME=/etc/init.d/alsa-utils
163
164 . /lib/lsb/init-functions
165
166 # $1 EXITSTATUS
167 # [$2 MESSAGE]
168 log_action_end_msg_and_exit()
169 {
170         log_action_end_msg "$1" ${2:+"$2"}
171         exit $1
172 }
173
174 # $1 PROGRAM
175 executable()
176 {
177         # If which is not available then we must be running before
178         # /usr is mounted on a system that has which in /usr/bin/.
179         # Conclude that $1 is not executable.
180         [ -x /bin/which ] || [ -x /usr/bin/which ] || return 1
181         which "$1" >/dev/null 2>&1
182 }
183
184 # Wait for filesystems to show up
185 while [ ! -d /usr/bin -o ! -d /var/lib/alsa ]; do
186         sleep 0.2
187 done
188
189 executable amixer || { echo "${MYNAME}: Error: No amixer program available." >&2 ; exit 1 ; }
190
191 bugout() { echo "${MYNAME}: Programming error" >&2 ; exit 123 ; }
192
193 # $1 <card ID> | "all"
194 restore_levels()
195 {
196         [ -f /var/lib/alsa/asound.state ] || return 1
197         CARD="$1"
198         [ "$1" = all ] && CARD=""
199         # Assume that if alsactl prints a message on stderr
200         # then it failed somehow.  This works around the fact
201         # that alsactl doesn't return nonzero status when it
202         # can't restore settings for the card
203         if MSG="$(alsactl restore $CARD 2>&1 >/dev/null)" && [ ! "$MSG" ] ; then
204                 return 0
205         else
206                 # Retry with the "force" option.  This restores more levels
207                 # but it results in much longer error messages.
208                 alsactl -F restore $CARD >/dev/null 2>&1
209                 [ -z "$CARD" ] && log_action_cont_msg "warning: 'alsactl restore' failed with error message '$MSG'"
210                 return 1
211         fi
212 }
213
214 # $1 <card ID> | "all"
215 store_levels()
216 {
217         CARD="$1"
218         [ "$1" = all ] && CARD=""
219         if MSG="$(alsactl store $CARD 2>&1)" ; then
220                 sleep 1
221                 return 0
222         else
223                 [ -z "$CARD" ] && log_action_cont_msg "warning: 'alsactl store' failed with error message '$MSG'"
224                 return 1
225         fi
226 }
227
228 echo_card_indices()
229 {
230         if [ -f /proc/asound/cards ] ; then
231                 sed -n -e's/^[[:space:]]*\([0-7]\)[[:space:]].*/\1/p' /proc/asound/cards
232         fi
233 }
234
235 filter_amixer_output()
236 {
237         sed \
238                 -e '/Unable to find simple control/d' \
239                 -e '/Unknown playback setup/d' \
240                 -e '/^$/d'
241 }
242
243 # The following functions try to set many controls.
244 # No card has all the controls and so some of the attempts are bound to fail.
245 # Because of this, the functions can't return useful status values.
246
247 # $1 <control>
248 # $2 <level>
249 # $CARDOPT
250 unmute_and_set_level()
251 {
252         { [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
253         amixer $CARDOPT -q set "$1" "$2" unmute 2>&1 | filter_amixer_output || :
254         return 0
255 }
256
257 # $1 <control>
258 # $CARDOPT
259 mute_and_zero_level()
260 {
261         { [ "$1" ] && [ "$CARDOPT" ] ; } || bugout
262         amixer $CARDOPT -q set "$1" "0%" mute 2>&1 | filter_amixer_output || :
263         return 0
264 }
265
266 # $1 <control>
267 # $2 "on" | "off"
268 # $CARDOPT
269 switch_control()
270 {
271         { [ "$2" ] && [ "$CARDOPT" ] ; } || bugout
272         amixer $CARDOPT -q set "$1" "$2" 2>&1 | filter_amixer_output || :
273         return 0
274 }
275
276 # $1 <card ID>
277 sanify_levels_on_card()
278 {
279         CARDOPT="-c $1"
280
281         unmute_and_set_level "Front" "80%"
282         unmute_and_set_level "Master" "80%"
283         unmute_and_set_level "Master Mono" "80%"   # See Bug#406047
284         unmute_and_set_level "Master Digital" "80%"   # E.g., cs4237B
285         unmute_and_set_level "Playback" "80%"
286         unmute_and_set_level "Headphone" "70%"
287         unmute_and_set_level "PCM" "80%"
288         unmute_and_set_level "PCM,1" "80%"   # E.g., ess1969
289         unmute_and_set_level "DAC" "80%"     # E.g., envy24, cs46xx
290         unmute_and_set_level "DAC,0" "80%"   # E.g., envy24
291         unmute_and_set_level "DAC,1" "80%"   # E.g., envy24
292         unmute_and_set_level "Synth" "80%"
293         unmute_and_set_level "CD" "80%"
294
295         mute_and_zero_level "Mic"
296         mute_and_zero_level "IEC958"         # Ubuntu #19648
297
298         # Intel P4P800-MX  (Ubuntu bug #5813)
299         switch_control "Master Playback Switch" on
300         switch_control "Master Surround" on
301
302         # Trident/YMFPCI/emu10k1:
303         unmute_and_set_level "Wave" "80%"
304         unmute_and_set_level "Music" "80%"
305         unmute_and_set_level "AC97" "80%"
306
307         # DRC:
308         unmute_and_set_level "Dynamic Range Compression" "80%"
309
310         # Required for HDA Intel (hda-intel):
311         unmute_and_set_level "Front" "80%"
312
313         # Required for SB Live 7.1/24-bit (ca0106):
314         unmute_and_set_level "Analog Front" "80%"
315
316         # Required at least for Via 823x hardware on DFI K8M800-MLVF Motherboard with kernels 2.6.10-3/4 (see ubuntu #7286):
317         switch_control "IEC958 Capture Monitor" off
318
319         # Required for hardware allowing toggles for AC97 through IEC958,
320         #  valid values are 0, 1, 2, 3. Needs to be set to 0 for PCM1.
321         unmute_and_set_level "IEC958 Playback AC97-SPSA" "0"
322
323         # Required for newer Via hardware (see Ubuntu #31784)
324         unmute_and_set_level "VIA DXS,0" "80%"
325         unmute_and_set_level "VIA DXS,1" "80%"
326         unmute_and_set_level "VIA DXS,2" "80%"
327         unmute_and_set_level "VIA DXS,3" "80%"
328
329         # Required on some notebooks with ICH4:
330         switch_control "Headphone Jack Sense" off
331         switch_control "Line Jack Sense" off
332
333         # Some machines need one or more of these to be on;
334         # others need one or more of these to be off:
335         #
336         # switch_control "External Amplifier" on
337         switch_control "Audigy Analog/Digital Output Jack" on
338         switch_control "SB Live Analog/Digital Output Jack" on
339         
340         # D1984 -- Thinkpad T61/X61
341         switch_control "Speaker" on
342         switch_control "Headphone" on
343
344         # HDA-Intel w/ "Digital" capture mixer (See Ubuntu #193823)
345         unmute_and_set_level "Digital" "80%"
346
347         return 0
348 }
349
350 # $1 <card ID> | "all"
351 sanify_levels()
352 {
353         TTSDML_RETURNSTATUS=0
354         case "$1" in
355           all)
356                 for CARD in $(echo_card_indices) ; do
357                         sanify_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
358                 done
359                 ;;
360           *)
361                 sanify_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
362                 ;;
363         esac
364         return $TTSDML_RETURNSTATUS
365 }
366
367 # $1 <card ID>
368 preinit_levels_on_card()
369 {
370         CARDOPT="-c $1"
371
372         # Silly dance to activate internal speakers by default on PowerMac
373         # Snapper and Tumbler
374         id=`cat /proc/asound/card$1/id 2>/dev/null`
375         if [ "$id" = "Snapper" -o "$id" = "Tumbler" ]; then
376                 switch_control "Auto Mute" off
377                 switch_control "PC Speaker" off
378                 switch_control "Auto Mute" on
379         fi
380 }
381
382 # $1 <card ID> | "all"
383 preinit_levels()
384 {
385         TTSDML_RETURNSTATUS=0
386         case "$1" in
387           all)
388                 for CARD in $(echo_card_indices) ; do
389                         preinit_levels_on_card "$CARD" || TTSDML_RETURNSTATUS=1
390                 done
391                 ;;
392           *)
393                 preinit_levels_on_card "$1" || TTSDML_RETURNSTATUS=1
394                 ;;
395         esac
396         return $TTSDML_RETURNSTATUS
397 }
398
399 # $1 <card ID>
400 mute_and_zero_levels_on_card()
401 {
402         CARDOPT="-c $1"
403         for CTL in \
404                 Master \
405                 PCM \
406                 Synth \
407                 CD \
408                 Line \
409                 Mic \
410                 "PCM,1" \
411                 Wave \
412                 Music \
413                 AC97 \
414                 "Master Digital" \
415                 DAC \
416                 "DAC,0" \
417                 "DAC,1" \
418                 Headphone \
419                 Playback \
420                 Speaker
421         do
422                 mute_and_zero_level "$CTL"
423         done
424 #       for CTL in \
425 #               "Audigy Analog/Digital Output Jack" \
426 #               "SB Live Analog/Digital Output Jack"
427 #       do
428 #               switch_control "$CTL" off
429 #       done
430         return 0
431 }
432
433 # $1 <card ID> | "all"
434 mute_and_zero_levels()
435 {
436         TTZML_RETURNSTATUS=0
437         case "$1" in
438           all)
439                 for CARD in $(echo_card_indices) ; do
440                         mute_and_zero_levels_on_card "$CARD" || TTZML_RETURNSTATUS=1
441                 done
442                 ;;
443           *)
444                 mute_and_zero_levels_on_card "$1" || TTZML_RETURNSTATUS=1
445                 ;;
446         esac
447         return $TTZML_RETURNSTATUS
448 }
449
450
451 # $1 <card ID> | "all"
452 card_OK()
453 {
454         [ "$1" ] || bugout
455         if [ "$1" = all ] ; then
456                 [ -d /proc/asound ]
457                 return $?
458         else
459                 [ -d "/proc/asound/card$1" ] || [ -d "/proc/asound/$1" ]
460                 return $?
461         fi
462 }
463
464 # If a card identifier is provided in $2 then regard it as an error
465 # if that card is not present; otherwise don't regard it as an error.
466
467 case "$1" in
468   start)
469         EXITSTATUS=0
470         TARGET_CARD="$2"
471         case "$TARGET_CARD" in
472           ""|all) TARGET_CARD=all ; log_action_begin_msg "Setting up ALSA" ;;
473         esac
474         if ! card_OK "$TARGET_CARD"; then
475                 [ "$TARGET_CARD" = "all" ] && log_action_end_msg "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
476                 exit $?
477         fi
478         preinit_levels "$TARGET_CARD" || EXITSTATUS=1
479         if ! restore_levels "$TARGET_CARD" ; then
480                 sanify_levels "$TARGET_CARD" || EXITSTATUS=1
481                 restore_levels "$TARGET_CARD" >/dev/null 2>&1 || :
482         fi
483         [ "$TARGET_CARD" = "all" ] && log_action_end_msg_and_exit "$EXITSTATUS"
484         exit $EXITSTATUS
485         ;;
486   stop)
487         EXITSTATUS=0
488         TARGET_CARD="$2"
489         case "$TARGET_CARD" in
490           ""|all) TARGET_CARD=all ; log_action_begin_msg "Shutting down ALSA" ;;
491           *) log_action_begin_msg "Shutting down ALSA card ${TARGET_CARD}" ;;
492         esac
493         card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
494         store_levels "$TARGET_CARD" || EXITSTATUS=1
495         mute_and_zero_levels "$TARGET_CARD" || EXITSTATUS=1
496         log_action_end_msg_and_exit "$EXITSTATUS"
497         ;;
498   restart|force-reload)
499         EXITSTATUS=0
500         $0 stop || EXITSTATUS=1
501         $0 start || EXITSTATUS=1
502         exit $EXITSTATUS
503         ;;
504   reset)
505         TARGET_CARD="$2"
506         case "$TARGET_CARD" in
507           ""|all) TARGET_CARD=all ; log_action_begin_msg "Resetting ALSA" ;;
508           *) log_action_begin_msg "Resetting ALSA card ${TARGET_CARD}" ;;
509         esac
510         card_OK "$TARGET_CARD" || log_action_end_msg_and_exit "$( [ ! "$2" ] ; echo $? ; )" "none loaded"
511         preinit_levels "$TARGET_CARD"
512         sanify_levels "$TARGET_CARD"
513         log_action_end_msg_and_exit "$?"
514         ;;
515   *)
516         echo "Usage: $MYNAME {start [CARD]|stop [CARD]|restart [CARD]|reset [CARD]}" >&2
517         exit 3
518         ;;
519 esac
520
521 #!/bin/bash -e
522 #
523 # apache2               This init.d script is used to start apache2.
524 #                       It basically just calls apache2ctl.
525
526 ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
527
528 #edit /etc/default/apache2 to change this.
529 NO_START=0
530
531 set -e
532 if [ -x /usr/sbin/apache2 ] ; then
533         HAVE_APACHE2=1
534 else
535         exit 0
536 fi
537
538 . /lib/lsb/init-functions
539
540 test -f /etc/default/rcS && . /etc/default/rcS
541 test -f /etc/default/apache2 && . /etc/default/apache2
542 if [ "$NO_START" != "0" -a "$1" != "stop" ]; then 
543         [ "$VERBOSE" != "no" ] && log_warning_msg "Not starting apache2 - edit /etc/default/apache2 and change NO_START to be 0.";
544         exit 0;
545 fi
546
547 APACHE2="$ENV /usr/sbin/apache2"
548 APACHE2CTL="$ENV /usr/sbin/apache2ctl"
549
550 apache_stop() {
551         PID=""
552         PIDFILE=""
553         AP_CONF=/etc/apache2/apache2.conf
554
555         # apache2 allows more than PidFile entry in the config but only the
556         # last found in the config is used; we attempt to follow includes
557         # here, but only first-level includes are supported, not nested ones
558
559         for i in $AP_CONF `awk '$1 ~ /^\s*[Ii]nclude$/ && $2 ~ /^\// {print $2}' $AP_CONF`; do
560                 PIDFILE=`grep -i ^PidFile $i | tail -n 1 | awk '{print $2}'`
561                 if [ -e "$PIDFILE" ]; then
562                         PID=`cat $PIDFILE`
563                 fi
564         done
565         
566         errors=`$APACHE2 -t 2>&1`
567         if [ $? = 0 ]; then
568                 # if the config is ok than we just stop normaly
569
570                 if [ -n "$PID" ]
571                 then
572                         $APACHE2CTL stop
573
574                         CNT=0
575                         while [ 1 ]
576                         do
577                                 CNT=$(expr $CNT + 1)
578                 
579                                 [ ! -d /proc/$PID ] && break
580
581                                 if [ $CNT -gt 60 ]
582                                 then
583                                         if [ "$VERBOSE" != "no" ]; then
584                                                 echo " ... failed!"
585                                                 echo "Apache2 failed to honor the stop command, please investigate the situation by hand."
586                                         fi
587                                         return 1
588                                 fi
589
590                                 sleep 1
591                         done
592                 else
593                         if [ "$VERBOSE" != "no" ]; then
594                                 echo -n " ... no pidfile found! not running?"
595                         fi
596                 fi
597
598         else
599                 [ "$VERBOSE" != "no" ] && echo "$errors"
600
601                 # if we are here something is broken and we need to try
602                 # to exit as nice and clean as possible
603
604                 # if pidof is null for some reasons the script exits automagically
605                 # classified as good/unknown feature
606                 PIDS=`pidof apache2` || true
607
608                 REALPID=0
609                 # if there is a pid we need to verify that belongs to apache2
610                 # for real
611                 for i in $PIDS; do
612                         if [ "$i" = "$PID" ]; then
613                                 # in this case the pid stored in the
614                                 # pidfile matches one of the pidof apache
615                                 # so a simple kill will make it
616                                 REALPID=1
617                         fi
618                 done
619
620                 if [ $REALPID = 1 ]; then
621                         # in this case everything is nice and dandy
622                         # and we kill apache2
623                         kill $PID
624                 else
625                         # this is the worst situation... just kill all of them
626                         #for i in $PIDS; do
627                         #       kill $i
628                         #done
629                         # Except, we can't do that, because it's very, very bad
630                         if [ "$PIDS" ] && [ "$VERBOSE" != "no" ]; then
631                                 echo " ... failed!"
632                                 echo "You may still have some apache2 processes running.  There are"
633                                 echo "processes named 'apache2' which do not match your pid file,"
634                                 echo "and in the name of safety, we've left them alone.  Please review"
635                                 echo "the situation by hand."
636                         fi
637                         return 1
638                 fi
639         fi
640 }
641
642 # Stupid hack to keep lintian happy. (Warrk! Stupidhack!).
643 case $1 in
644         start)
645                 [ -f /etc/apache2/httpd.conf ] || touch /etc/apache2/httpd.conf
646                 # ssl_scache shouldn't be here if we're just starting up.
647                 [ -f /var/run/apache2/ssl_scache ] && rm -f /var/run/apache2/*ssl_scache*
648                 # /var/run and /var/lock could be on a tmpfs
649                 [ ! -d /var/run/apache2 ] && mkdir /var/run/apache2
650                 [ ! -d /var/lock/apache2 ] && mkdir /var/lock/apache2
651                 # Make sure /var/lock/apache2 has the correct permissions
652                 chown www-data /var/lock/apache2
653
654                 log_begin_msg "Starting apache 2.0 web server..."
655                 if $APACHE2CTL startssl; then
656                         log_end_msg 0
657                 else
658                         log_end_msg 1
659                 fi
660         ;;
661         stop)
662                 log_begin_msg "Stopping apache 2.0 web server..."
663                 if apache_stop; then
664                         log_end_msg 0
665                 else
666                         log_end_msg 1
667                 fi
668         ;;
669         reload)
670                 log_begin_msg "Reloading apache 2.0 configuration..."
671                 if $APACHE2CTL graceful $2 ; then
672                         log_end_msg 0
673                 else
674                         log_end_msg 1
675                 fi
676         ;;
677         restart | force-reload)
678                 log_begin_msg "Forcing reload of apache 2.0 web server..."
679                 if ! apache_stop; then
680                         log_end_msg 1
681                 fi
682                 if $APACHE2CTL startssl; then
683                         log_end_msg 0
684                 else
685                         log_end_msg 1
686                 fi
687         ;;
688         status)
689                 exit 4
690         ;;
691         *)
692                 echo "Usage: /etc/init.d/apache2 start|stop|restart|reload|force-reload" >&2
693                 exit 2
694         ;;
695 esac
696 #! /bin/sh -e
697 #### BEGIN INIT INFO
698 # Provides:          atd
699 # Required-Start:    $syslog $time $local_fs $remote_fs
700 # Required-Stop:     $syslog $time $local_fs $remote_fs
701 # Default-Start:     2 3 4 5
702 # Default-Stop:      S 0 1 6
703 # Short-Description: Deferred execution scheduler
704 # Description:       Debian init script for the atd deferred executions
705 #                    scheduler
706 ### END INIT INFO
707 #
708 # Author:       Ryan Murray <rmurray@debian.org>
709 #
710 set -e
711
712 PATH=/bin:/usr/bin:/sbin:/usr/sbin
713 DAEMON=/usr/sbin/atd
714
715 test -x $DAEMON || exit 0
716
717 . /lib/lsb/init-functions
718
719 case "$1" in
720     start)
721         log_daemon_msg "Starting deferred execution scheduler" "atd"
722         start_daemon $DAEMON
723         log_end_msg $?
724     ;;
725   stop)
726         log_daemon_msg "Stopping deferred execution scheduler" "atd"
727         killproc $DAEMON
728         log_end_msg $?
729     ;;
730   force-reload|restart)
731     $0 stop
732     $0 start
733     ;;
734   *)
735     echo "Usage: /etc/init.d/atd {start|stop|restart|force-reload}"
736     exit 1
737     ;;
738 esac
739
740 exit 0
741 #! /bin/sh
742 ### BEGIN INIT INFO
743 # Provides:          binfmt-support
744 # Required-Start:    $local_fs $remote_fs
745 # Required-Stop:     $local_fs $remote_fs
746 # Default-Start:     2 3 4 5
747 # Default-Stop:      0 1 6
748 # Short-Description: Support for extra binary formats
749 # Description:       Enable support for extra binary formats using the Linux
750 #                    kernel's binfmt_misc facility.
751 ### END INIT INFO
752
753 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
754 NAME=binfmt-support
755 DESC="additional executable binary formats"
756
757 test -x /usr/sbin/update-binfmts || exit 0
758
759 . /lib/lsb/init-functions
760 . /etc/default/rcS
761
762 set -e
763 CODE=0
764
765 case "$1" in
766   start)
767     log_daemon_msg "Enabling $DESC" "$NAME"
768     update-binfmts --enable || CODE=$?
769     log_end_msg $CODE
770     exit $CODE
771     ;;
772
773   stop)
774     log_daemon_msg "Disabling $DESC" "$NAME"
775     update-binfmts --disable || CODE=$?
776     log_end_msg $CODE
777     exit $CODE
778     ;;
779
780   restart|force-reload)
781     $0 stop
782     $0 start
783     ;;
784
785   *)
786     N=/etc/init.d/$NAME
787     echo "Usage: $N {start|stop|restart|force-reload}" >&2
788     exit 1
789     ;;
790 esac
791
792 exit 0
793 #!/bin/sh
794 #
795 # bootclean
796 #
797 # Clean /tmp
798 #
799 # DO NOT RUN AFTER S:55bootmisc.sh and do not run this script directly
800 # in runlevel S. Instead write an initscript to call it.
801 #
802
803 . /lib/init/vars.sh
804
805 . /lib/lsb/init-functions
806
807 # Should be called outside verbose message block
808 mkflagfile()
809 {
810         # Prevent symlink attack  (See #264234.)
811         [ -L "$1" ] && log_warning_msg "bootclean: Deleting symbolic link '$1'."
812         rm -f "$1" || { log_failure_msg "bootclean: Failure deleting '$1'." ; return 1 ; }
813         # No user processes should be running, so no one should be able to introduce
814         # a symlink here.  As an extra precaution, set noclobber.
815         set -o noclobber
816         :> "$1" || { log_failure_msg "bootclean: Failure creating '$1'." ; return 1 ; }
817         return 0
818 }
819
820 clean_tmp() {
821         cd /tmp || { log_failure_msg "bootclean: Could not cd to /tmp." ; return 1 ; }
822
823         #
824         # Only clean out /tmp if it is world-writable. This ensures
825         # it really is a/the temp directory we're cleaning.
826         #
827         [ "$(find . -maxdepth 0 -perm -002)" = "." ] || return 0
828
829         if [ ! "$TMPTIME" ]
830         then
831                 log_warning_msg "Using default TMPTIME 0."
832                 TMPTIME=0
833         fi
834
835         [ "$VERBOSE" = no ] || log_action_begin_msg "Cleaning /tmp"
836
837         #
838         # Remove regardless of TMPTIME setting
839         #
840         rm -f .X*-lock
841
842         #
843         # Don't clean remaining files if TMPTIME is negative or 'infinite'
844         #
845         case "$TMPTIME" in
846           -*|infinite|infinity)
847                 [ "$VERBOSE" = no ] || log_action_end_msg 0 "skipped"
848                 return 0
849                 ;;
850         esac
851
852         #
853         # Wipe /tmp, excluding system files, but including lost+found
854         #
855         # If TMPTIME is set to 0, we do not use any ctime expression
856         # at all, so we can also delete files with timestamps
857         # in the future!
858         #
859         if [ "$TMPTIME" = 0 ] 
860         then
861                 TEXPR=""
862                 DEXPR=""
863         else
864                 TEXPR="-mtime +$TMPTIME -ctime +$TMPTIME -atime +$TMPTIME"
865                 DEXPR="-mtime +$TMPTIME -ctime +$TMPTIME"
866         fi
867
868         EXCEPT='! -name .
869                 ! ( -path ./lost+found -uid 0 )
870                 ! ( -path ./quota.user -uid 0 )
871                 ! ( -path ./aquota.user -uid 0 )
872                 ! ( -path ./quota.group -uid 0 )
873                 ! ( -path ./aquota.group -uid 0 )
874                 ! ( -path ./.journal -uid 0 )
875                 ! ( -path ./.clean -uid 0 )
876                 ! ( -path './...security*' -uid 0 )'
877
878         mkflagfile /tmp/.clean || return 1
879
880         report_err()
881         {
882                 if [ "$VERBOSE" = no ]
883                 then
884                         log_failure_msg "bootclean: Failure cleaning /tmp."
885                 else
886                         log_action_end_msg 1 "bootclean: Failure cleaning /tmp"
887                 fi
888         }
889
890         #
891         # First remove all old files...
892         # (Use xargs here so that only one additional process gets created)
893         #
894         find . -depth -xdev $TEXPR $EXCEPT ! -type d \
895                 -print0 | xargs -0r rm -f -- \
896                 || { report_err ; return 1 ; }
897
898         #
899         # ...and then all empty directories
900         # (Don't use xargs here because dirs must be removed one by one from
901         # the bottom up)
902         #
903         find . -depth -xdev $DEXPR $EXCEPT -type d -empty \
904                 -exec rmdir \{\} \; \
905                 || { report_err ; return 1 ; }
906
907         [ "$VERBOSE" = no ] || log_action_end_msg 0
908         return 0
909 }
910
911 which find >/dev/null 2>&1 || exit 1
912 which xargs >/dev/null 2>&1 || exit 1
913
914 # If there are flag files that have not been created by root
915 # then remove them
916 for D in /tmp
917 do
918         if [ -f $D/.clean ]
919         then
920                 which stat >/dev/null 2>&1 && cleanuid="$(stat -c %u $D/.clean)"
921                 # Poor's man stat %u, since stat (and /usr) might not be
922                 # available in some bootup stages
923                 [ "$cleanuid" ] || cleanuid="$(find $D/.clean -printf %U)"
924                 [ "$cleanuid" ] || { log_failure_msg "bootclean: Could not stat '$D/.clean'." ; exit 1 ; }
925                 if [ "$cleanuid" -ne 0 ]
926                 then
927                         rm -f $D/.clean || { log_failure_msg "bootclean: Could not delete '$D/.clean'." ; exit 1 ; }
928                 fi
929         fi
930 done
931
932 [ -f /tmp/.clean ] && exit 0
933
934 ES=0
935 [ -d /tmp ] && ! [ -f /tmp/.clean ] && { clean_tmp || ES=1 ; }
936 exit $ES
937
938 #! /bin/sh
939 ### BEGIN INIT INFO
940 # Provides:          bootlogd
941 # Required-Start:    mountdevsubfs
942 # Required-Stop:
943 # Default-Start:     S
944 # Default-Stop:
945 # Short-Description: Start or stop bootlogd.
946 # Description:       Starts or stops the bootlogd log program
947 #                    which logs boot messages.
948 ### END INIT INFO
949
950 PATH=/sbin:/bin
951 DAEMON=/sbin/bootlogd
952 [ -x "$DAEMON" ] || exit 0
953 NAME=bootlogd
954 DESC="boot logger"
955 BOOTLOGD_OPTS="-r -c"
956 [ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
957 . /lib/init/vars.sh
958
959 . /lib/lsb/init-functions
960
961 # Because bootlogd is broken on some systems, we take the special measure
962 # of requiring it to be enabled by setting an environment variable.
963 case "$BOOTLOGD_ENABLE" in
964   [Nn]*)
965         exit 0
966         ;;
967 esac
968
969 # Previously this script was symlinked as "stop-bootlogd" which, when run
970 # with the "start" argument, should stop bootlogd.  Now stop-bootlogd is
971 # a distinct script, but for backward compatibility this script continues
972 # to implement the old behavior.
973 SCRIPTNAME=${0##*/}
974 SCRIPTNAME=${SCRIPTNAME#[SK]??}
975 ACTION="$1"
976 case "$0" in
977   *stop-bootlog*)
978         [ "$ACTION" = start ] && ACTION=stop
979         ;;
980 esac
981
982 case "$ACTION" in
983   start)
984         # PATH is set above
985         log_daemon_msg "Starting $DESC" "$NAME"
986         if [ -d /proc/1/. ]
987         then
988                 umask 027
989                 start-stop-daemon --start --quiet --exec $DAEMON -- \
990                         $BOOTLOGD_OPTS
991                 ES=$?
992         else
993                 $DAEMON $BOOTLOGD_OPTS
994                 ES=$?
995         fi
996         log_end_msg $ES
997         ;;
998   stop)
999         PATH=/sbin:/bin:/usr/sbin:/usr/bin
1000         log_daemon_msg "Stopping $DESC" "$NAME"
1001         start-stop-daemon --stop --quiet --exec $DAEMON
1002         ES=$?
1003         sleep 1
1004         log_end_msg $ES
1005         if [ -f /var/log/boot ] && [ -f /var/log/boot~ ]
1006         then
1007                 [ "$VERBOSE" = no ] || log_action_begin_msg "Moving boot log file"
1008                 # bootlogd writes to boot, making backup at boot~
1009                 cd /var/log && {
1010                         chgrp adm boot || :
1011                         savelog -q -p -c 5 boot \
1012                         && mv boot.0 boot \
1013                         && mv boot~ boot.0
1014                 }
1015                 ES=$?
1016                 [ "$VERBOSE" = no ] || log_action_end_msg $ES
1017         fi
1018         ;;
1019   restart|force-reload)
1020         /etc/init.d/bootlogd stop
1021         /etc/init.d/bootlogd start
1022         ;;
1023   *)
1024         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
1025         exit 3
1026         ;;
1027 esac
1028
1029 :
1030 #!/bin/sh
1031 ### BEGIN INIT INFO
1032 # Provides:          bootmisc
1033 # Required-Start:    $local_fs hostname $remote_fs
1034 # Required-Stop:     $local_fs
1035 # Default-Start:     S
1036 # Default-Stop:
1037 # Short-Description: Miscellaneous things to be done during bootup.
1038 # Description:
1039 ### END INIT INFO
1040
1041 PATH=/usr/sbin:/usr/bin:/sbin:/bin
1042 [ "$DELAYLOGIN" ] || DELAYLOGIN=yes
1043 . /lib/init/vars.sh
1044
1045 do_start () {
1046         #
1047         # If login delaying is enabled then create the flag file
1048         # which prevents logins before startup is complete
1049         #
1050         case "$DELAYLOGIN" in
1051           Y*|y*)
1052                 echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin
1053                 ;;
1054         esac
1055
1056         # Create /var/run/utmp so we can login.
1057         : > /var/run/utmp
1058         if grep -q ^utmp: /etc/group
1059         then
1060                 chmod 664 /var/run/utmp
1061                 chgrp utmp /var/run/utmp
1062         fi
1063
1064         # Set pseudo-terminal access permissions.
1065         if [ ! -e /dev/.devfsd ] && [ -c /dev/ttyp0 ]
1066         then
1067                 chmod -f 666 /dev/tty[p-za-e][0-9a-f]
1068                 chown -f root:tty /dev/tty[p-za-e][0-9a-f]
1069         fi
1070
1071         # Update motd
1072         uname -snrvm > /var/run/motd
1073         [ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd
1074
1075         # Save kernel messages in /var/log/dmesg
1076         if which dmesg >/dev/null 2>&1
1077         then
1078                 savelog -q -p -c 5 /var/log/dmesg
1079                 dmesg -s 524288 > /var/log/dmesg
1080                 chgrp adm /var/log/dmesg || :
1081         elif [ -c /dev/klog ]
1082         then
1083                 savelog -q -p -c 5 /var/log/dmesg
1084                 dd if=/dev/klog of=/var/log/dmesg &
1085                 sleep 1
1086                 kill $!
1087                 [ -f /var/log/dmesg ] && { chgrp adm /var/log/dmesg || : ; }
1088         fi
1089
1090         # Remove bootclean's flag files.
1091         # Don't run bootclean again after this!
1092         rm -f /tmp/.clean
1093 }
1094
1095 case "$1" in
1096   start|"")
1097         do_start
1098         ;;
1099   restart|reload|force-reload)
1100         echo "Error: argument '$1' not supported" >&2
1101         exit 3
1102         ;;
1103   stop)
1104         # No-op
1105         ;;
1106   *)
1107         echo "Usage: bootmisc.sh [start|stop]" >&2
1108         exit 3
1109         ;;
1110 esac
1111
1112 :
1113 #! /bin/sh
1114 ### BEGIN INIT INFO
1115 # Provides:          checkfs
1116 # Required-Start:    modutils checkroot
1117 # Required-Stop:
1118 # Should-Start:      lvm cryptdisks
1119 # Should-Stop:
1120 # Default-Start:     S
1121 # Default-Stop:
1122 # Short-Description: Check all filesystems.
1123 ### END INIT INFO
1124
1125 PATH=/sbin:/bin
1126 FSCK_LOGFILE=/var/log/fsck/checkfs
1127 [ "$FSCKFIX" ] || FSCKFIX=no
1128 . /lib/init/vars.sh
1129 . /lib/init/usplash-fsck-functions.sh
1130
1131 . /lib/lsb/init-functions
1132
1133 # Always output fsck progress
1134 stdin=`readlink /proc/self/fd/0`
1135 if [ "${stdin#/dev/null}" != "$stdin" ]; then
1136     exec </dev/console >/dev/console 2>&1
1137 fi
1138
1139 do_start () {
1140         # See if we're on AC Power
1141         # If not, we're not gonna run our check
1142         if which on_ac_power >/dev/null 2>&1
1143         then
1144                 on_ac_power >/dev/null 2>&1
1145                 if [ $? -eq 1 ]
1146                 then
1147                         [ "$VERBOSE" = no ] || log_success_msg "Running on battery power, so skipping file system check."
1148                         BAT=yes
1149                 fi
1150         fi
1151
1152         #
1153         # Check the rest of the file systems.
1154         #
1155         if [ ! -f /fastboot ] && [ ! "$BAT" ] && [ "$FSCKTYPES" != "none" ]
1156         then
1157                 if [ -f /forcefsck ]
1158                 then
1159                         force="-f"
1160                 else
1161                         force=""
1162                 fi
1163                 if [ "$FSCKFIX" = yes ]
1164                 then
1165                         fix="-y"
1166                 else
1167                         fix="-a"
1168                 fi
1169                 spinner="-C"
1170                 case "$TERM" in
1171                   dumb|network|unknown|"")
1172                         spinner=""
1173                         ;;
1174                 esac
1175                 [ "$(uname -m)" = s390 ] && spinner=""  # This should go away
1176                 FSCKTYPES_OPT=""
1177                 [ "$FSCKTYPES" ] && FSCKTYPES_OPT="-t $FSCKTYPES"
1178                 handle_failed_fsck() {
1179                         log_failure_msg "File system check failed. 
1180 A log is being saved in ${FSCK_LOGFILE} if that location is writable. 
1181 Please repair the file system manually."
1182                         log_warning_msg "A maintenance shell will now be started. 
1183 CONTROL-D will terminate this shell and resume system boot."
1184                         # Start a single user shell on the console
1185                         if ! sulogin $CONSOLE
1186                         then
1187                                 log_failure_msg "Attempt to start maintenance shell failed. 
1188 Continuing with system boot in 5 seconds."
1189                                 sleep 5
1190                         fi
1191                 }
1192                 if [ "$VERBOSE" = no ]
1193                 then
1194                         log_action_begin_msg "Checking file systems"
1195                         if pidof usplash; then
1196                             PROGRESS_FILE=`mktemp` || exit 1
1197                             set -m
1198                             logsave -s $FSCK_LOGFILE fsck -C3 -R -A $fix $force $FSCKTYPES_OPT >/dev/console 2>&1 3>$PROGRESS_FILE &
1199                             set +m
1200                             usplash_progress "$PROGRESS_FILE"
1201                             rm -f $PROGRESS_FILE
1202                         else
1203                             logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT
1204                             FSCKCODE=$?
1205                         fi
1206
1207                         if [ "$FSCKCODE" -gt 1 ]
1208                         then
1209                                 log_action_end_msg 1 "code $FSCKCODE"
1210                                 handle_failed_fsck
1211                         else
1212                                 log_action_end_msg 0
1213                         fi
1214                 else
1215                         if [ "$FSCKTYPES" ]
1216                         then
1217                                 log_action_msg "Will now check all file systems of types $FSCKTYPES"
1218                         else
1219                                 log_action_msg "Will now check all file systems"
1220                         fi
1221                         logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT
1222                         FSCKCODE=$?
1223                         if [ "$FSCKCODE" -gt 1 ]
1224                         then
1225                                 handle_failed_fsck
1226                         else
1227                                 log_success_msg "Done checking file systems. 
1228 A log is being saved in ${FSCK_LOGFILE} if that location is writable."
1229                         fi
1230                 fi
1231         fi
1232         rm -f /fastboot /forcefsck
1233 }
1234
1235 case "$1" in
1236   start|"")
1237         do_start
1238         ;;
1239   restart|reload|force-reload)
1240         echo "Error: argument '$1' not supported" >&2
1241         exit 3
1242         ;;
1243   stop)
1244         # No-op
1245         ;;
1246   *)
1247         echo "Usage: checkfs.sh [start|stop]" >&2
1248         exit 3
1249         ;;
1250 esac
1251
1252 :
1253 #! /bin/sh
1254 ### BEGIN INIT INFO
1255 # Provides:          checkroot
1256 # Required-Start:    mountdevsubfs
1257 # Required-Stop:     
1258 # Should-Start:      keymap hwclockfirst
1259 # Should-stop:
1260 # Default-Start:     S
1261 # Default-Stop:
1262 # Short-Description: Check to root file system.
1263 ### END INIT INFO
1264
1265 PATH=/lib/init:/sbin:/bin
1266 FSCK_LOGFILE=/var/log/fsck/checkroot
1267 [ "$FSCKFIX" ] || FSCKFIX=no
1268 [ "$SULOGIN" ] || SULOGIN=no
1269 . /lib/init/vars.sh
1270 . /lib/init/usplash-fsck-functions.sh
1271
1272 . /lib/lsb/init-functions
1273
1274 # Always output fsck progress
1275 stdin=`readlink /proc/self/fd/0`
1276 if [ "${stdin#/dev/null}" != "$stdin" ]; then
1277     exec </dev/console >/dev/console 2>&1
1278 fi
1279
1280 do_start () {
1281         #
1282         # Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to
1283         # be spawned from this script *before anything else* with a timeout,
1284         # like sysv does.
1285         #
1286         [ "$SULOGIN" = yes ] && sulogin -t 30 $CONSOLE
1287
1288         KERNEL="$(uname -s)"
1289         MACHINE="$(uname -m)"
1290
1291         #
1292         # Read /etc/fstab, looking for:
1293         # 1) The root filesystem, resolving LABEL=*|UUID=* entries to the
1294         #       device node,
1295         # 2) Swap that is on a md device or a file that may be on a md 
1296         #       device,
1297         # 3) The mount parameters for a devfs filesystem.
1298         #
1299
1300         exec 9<&0 </etc/fstab
1301
1302         fstabroot=/dev/root
1303         rootdev=none
1304         roottype=none
1305         rootopts=defaults
1306         rootmode=rw
1307         rootcheck=no
1308         swap_on_lv=no
1309         swap_on_file=no
1310         devfs=
1311
1312         while read DEV MTPT FSTYPE OPTS DUMP PASS JUNK
1313         do
1314                 case "$DEV" in
1315                   ""|\#*)
1316                         continue;
1317                         ;;
1318                   /dev/mapper/*)
1319                         [ "$FSTYPE" = "swap" ] && swap_on_lv=yes
1320                         ;;
1321                   /dev/*)
1322                         ;;
1323                   LABEL=*|UUID=*)
1324                         if [ "$MTPT" = "/" ] && which findfs >/dev/null 2>&1
1325                         then
1326                                 DEV="$(findfs "$DEV")"
1327                         fi
1328                         ;;
1329                   /*)
1330                         [ "$FSTYPE" = "swap" ] && swap_on_file=yes
1331                         ;;
1332                   *)
1333                         # Devfs definition ?
1334                         if [ "$FSTYPE" = "devfs" ] && [ "$MTPT" = "/dev" ] && mountpoint -q /dev
1335                         then
1336                                 devfs="-t $FSTYPE $DEV $MTPT"
1337                         fi
1338                         ;;
1339                 esac
1340                 [ "$MTPT" != "/" ] && continue
1341                 rootdev="$DEV"
1342                 fstabroot="$DEV"
1343                 rootopts="$OPTS"
1344                 roottype="$FSTYPE"
1345                 ( [ "$PASS" != 0 ] && [ "$PASS" != "" ]   ) && rootcheck=yes
1346                 ( [ "$FSTYPE" = "nfs" ] || [ "$FSTYPE" = "nfs4" ] ) && rootcheck=no
1347                 case "$OPTS" in
1348                   ro|ro,*|*,ro|*,ro,*)
1349                         rootmode=ro
1350                         ;;
1351                 esac
1352         done
1353
1354         exec 0<&9 9<&-
1355
1356         #
1357         # Activate the swap device(s) in /etc/fstab. This needs to be done
1358         # before fsck, since fsck can be quite memory-hungry.
1359         #
1360         ENABLE_SWAP=no
1361         case "$KERNEL" in
1362           Linux)
1363                 if [ "$swap_on_lv" = yes ]
1364                 then
1365                         [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on logical volume."
1366                 elif [ "$swap_on_file" = yes ]
1367                 then
1368                         [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on swapfile."
1369                 else
1370                         ENABLE_SWAP=yes
1371                 fi
1372                 ;;
1373           *)
1374                 ENABLE_SWAP=yes
1375                 ;;
1376         esac
1377         if [ "$ENABLE_SWAP" = yes ]
1378         then
1379                 if [ "$VERBOSE" = no ]
1380                 then
1381                         log_action_begin_msg "Activating swap"
1382                         swapon -a -e >/dev/null 2>&1
1383                         log_action_end_msg $?
1384                 else
1385                         log_action_msg "Will now activate swap"
1386                         swapon -a -v
1387                         ES=$?
1388                         if [ "$ES" = 0 ]
1389                         then
1390                                 log_success_msg "Done activating swap."
1391                         else
1392                                 log_failure_msg "Swap activation failed with error code ${ES}."
1393                         fi
1394                 fi
1395         fi
1396
1397         #
1398         # Does the root device in /etc/fstab match with the actual device ?
1399         # If not we try to use the /dev/root alias device, and if that
1400         # fails we create a temporary node in /dev/shm.
1401         #
1402         if [ "$rootcheck" = yes ]
1403         then
1404                 ddev="$(mountpoint -qx $rootdev)"
1405                 rdev="$(mountpoint -d /)"
1406                 if [ "$ddev" != "$rdev" ] && [ "$ddev" != "4:0" ]
1407                 then
1408                         if [ "$(mountpoint -qx /dev/root)" = "4:0" ]
1409                         then
1410                                 rootdev=/dev/root
1411                         else
1412                                 if \
1413                                         rm -f /dev/shm/root \
1414                                         && mknod -m 600 /dev/shm/root b ${rdev%:*} ${rdev#*:} \
1415                                         && [ -e /dev/shm/root ]
1416                                 then
1417                                         rootdev=/dev/shm/root
1418                                 else
1419                                         rootfatal=yes
1420                                 fi
1421                         fi
1422                 fi
1423         fi
1424
1425         #
1426         # Bother, said Pooh.
1427         #
1428         if [ "$rootfatal" = yes ]
1429         then
1430                 log_failure_msg "The device node $rootdev for the root filesystem is missing or incorrect 
1431 or there is no entry for the root filesystem listed in /etc/fstab. 
1432 The system is also unable to create a temporary node in /dev/shm. 
1433 This means you have to fix the problem manually."
1434                 log_warning_msg "A maintenance shell will now be started. 
1435 CONTROL-D will terminate this shell and restart the system."
1436                 # Start a single user shell on the console
1437                 if ! sulogin $CONSOLE
1438                 then
1439                         log_failure_msg "Attempt to start maintenance shell failed. 
1440 Will restart in 5 seconds."
1441                         sleep 5
1442                 fi
1443                 [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
1444                 reboot -f
1445         fi
1446
1447         # See if we're on AC Power
1448         # If not, we're not gonna run our check
1449         if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
1450         then
1451                 if [ -d /proc/acpi ]; then
1452                         modprobe ac >/dev/null 2>&1
1453                 fi
1454                 on_ac_power >/dev/null 2>&1
1455                 if [ "$?" -eq 1 ]
1456                 then
1457                         log_warning_msg "On battery power, so skipping file system check."
1458                         rootcheck=no
1459                 fi
1460         fi
1461
1462         #
1463         # See if we want to check the root file system.
1464         #
1465         FSCKCODE=0
1466         if [ -f /fastboot ]
1467         then
1468                 [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check."
1469                 rootcheck=no
1470         fi
1471
1472         if [ "$rootcheck" = yes ]
1473         then
1474                 #
1475                 # Ensure that root is quiescent and read-only before fsck'ing.
1476                 #
1477                 # mount -n -o remount,ro / would be the correct syntax but
1478                 # mount can get confused when there is a "bind" mount defined
1479                 # in fstab that bind-mounts "/" somewhere else.
1480                 #
1481                 # So we use mount -n -o remount,ro $rootdev / but that can
1482                 # fail on older kernels on sparc64/alpha architectures due
1483                 # to a bug in sys_mount().
1484                 #
1485                 # As a compromise we try both.
1486                 #
1487                 if \
1488                         ! mount    -n -o remount,ro              $rootdev /              \
1489                         && ! mount -n -o remount,ro -t dummytype $rootdev /  2>/dev/null \
1490                         && ! mount -n -o remount,ro                       /  2>/dev/null
1491                 then
1492                         log_failure_msg "Cannot check root file system because it is not mounted read-only."
1493                         rootcheck=no
1494                 fi
1495         fi
1496
1497         #
1498         # The actual checking is done here.
1499         #
1500         if [ "$rootcheck" = yes ]
1501         then
1502                 if [ -f /forcefsck ]
1503                 then
1504                         force="-f"
1505                 else
1506                         force=""
1507                 fi
1508
1509                 if [ "$FSCKFIX" = yes ]
1510                 then
1511                         fix="-y"
1512                 else
1513                         fix="-a"
1514                 fi
1515
1516                 spinner="-C"
1517                 case "$TERM" in
1518                   dumb|network|unknown|"")
1519                         spinner="" ;;
1520                 esac
1521                 # This Linux/s390 special case should go away.
1522                 if [ "${KERNEL}:${MACHINE}" = Linux:s390 ]
1523                 then
1524                         spinner=""
1525                 fi
1526                 
1527                 if [ "$VERBOSE" = no ]
1528                 then
1529                         log_action_begin_msg "Checking root file system"
1530                         if [ "$roottype" = "ext2" -o "$roottype" = "ext3" ] && pidof usplash; then
1531                             PROGRESS_FILE=`mktemp -p /var/run` || PROGRESS_FILE=/var/run/checkroot_fsck
1532                             set -m
1533                             logsave -s $FSCK_LOGFILE fsck -C3 $force $fix -t $roottype $rootdev >/dev/console 2>&1 3>$PROGRESS_FILE &
1534                             set +m
1535                             usplash_progress "$PROGRESS_FILE"
1536                             rm -f $PROGRESS_FILE
1537                         else
1538                             logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
1539                             FSCKCODE=$?
1540                         fi
1541                         if [ "$FSCKCODE" = 0 ]
1542                         then
1543                                 log_action_end_msg 0
1544                         else
1545                                 log_action_end_msg 1 "code $FSCKCODE"
1546                         fi
1547                 else
1548                         log_action_msg "Will now check root file system"
1549                         logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
1550                         FSCKCODE=$?
1551                         if [ "$FSCKCODE" = 0 ]
1552                         then
1553                                 log_success_msg "Done checking root file system. 
1554 A log will be saved in ${FSCK_LOGFILE} if that location is writable."
1555                         else
1556                                 log_failure_msg "Root file system check failed with error code ${FSCKCODE}. 
1557 A log is being saved in ${FSCK_LOGFILE} if that location is writable."
1558                         fi
1559                 fi
1560         fi
1561
1562         #
1563         # If there was a failure, drop into single-user mode.
1564         #
1565         # NOTE: "failure" is defined as exiting with a return code of
1566         # 4 or larger. A return code of 1 indicates that file system
1567         # errors were corrected but that the boot may proceed. A return
1568         # code of 2 or 3 indicates that the system should immediately reboot.
1569         #
1570         if [ "$FSCKCODE" -gt 3 ]
1571         then
1572                 # Surprise! Re-directing from a HERE document (as in "cat << EOF")
1573                 # does not work because the root is currently read-only.
1574                 log_failure_msg "An automatic file system check (fsck) of the root filesystem failed. 
1575 A manual fsck must be performed, then the system restarted. 
1576 The fsck should be performed in maintenance mode with the 
1577 root filesystem mounted in read-only mode."
1578                 log_warning_msg "The root filesystem is currently mounted in read-only mode. 
1579 A maintenance shell will now be started. 
1580 After performing system maintenance, press CONTROL-D 
1581 to terminate the maintenance shell and restart the system."
1582                 # Start a single user shell on the console
1583                 if ! sulogin $CONSOLE
1584                 then
1585                         log_failure_msg "Attempt to start maintenance shell failed. 
1586 Will restart in 5 seconds."
1587                         sleep 5
1588                 fi
1589                 [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
1590                 reboot -f
1591         elif [ "$FSCKCODE" -gt 1 ]
1592         then
1593                 log_failure_msg "The file system check corrected errors on the root partition 
1594 but requested that the system be restarted."
1595                 log_warning_msg "The system will be restarted in 5 seconds."
1596                 sleep 5
1597                 [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
1598                 reboot -f
1599         fi
1600
1601         #
1602         # Remount root to final mode (rw or ro).
1603         #
1604         # See the comments above at the previous "mount -o remount"
1605         # for an explanation why we try this twice.
1606         #
1607         if ! mount -n -o remount,$rootopts,$rootmode $fstabroot / 2>/dev/null
1608         then
1609                 mount -n -o remount,$rootopts,$rootmode /
1610         fi
1611
1612         #
1613         # We only create/modify /etc/mtab if the location where it is
1614         # stored is writable. If /etc/mtab is a symlink into /proc/
1615         # then it is not writable.
1616         #
1617         INIT_MTAB_FILE=no
1618         MTAB_PATH="$(readlink -f /etc/mtab || :)"
1619         case "$MTAB_PATH" in
1620           /proc/*)
1621                 ;;
1622           /*)
1623                 if touch "$MTAB_PATH" >/dev/null 2>&1
1624                 then
1625                         :> "$MTAB_PATH"
1626                         rm -f ${MTAB_PATH}~
1627                         INIT_MTAB_FILE=yes
1628                 fi
1629                 ;;
1630           "")
1631                 [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
1632                 if [ "$MTAB_PATH" ]
1633                 then
1634                         log_failure_msg "Cannot initialize ${MTAB_PATH}."
1635                 else
1636                         log_failure_msg "Cannot initialize /etc/mtab."
1637                 fi
1638                 ;;
1639           *)
1640                 log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
1641                 ;;
1642         esac
1643
1644         if [ "$INIT_MTAB_FILE" = yes ]
1645         then
1646                 [ "$roottype" != none ] &&
1647                         mount -f -o $rootopts -t $roottype $fstabroot /
1648                 [ "$devfs" ] && mount -f $devfs
1649         fi
1650
1651         #
1652         # Remove /dev/shm/root if we created it.
1653         #
1654         rm -f /dev/shm/root
1655 }
1656
1657 case "$1" in
1658   start|"")
1659         do_start
1660         ;;
1661   restart|reload|force-reload)
1662         echo "Error: argument '$1' not supported" >&2
1663         exit 3
1664         ;;
1665   stop)
1666         # No-op
1667         ;;
1668   *)
1669         echo "Usage: checkroot.sh [start|stop]" >&2
1670         exit 3
1671         ;;
1672 esac
1673
1674 :
1675 #! /bin/sh
1676 #
1677 # This file was automatically customized by debmake on Fri,  6 Nov 1998 23:00:08 -0600
1678 #
1679 # Written by Miquel van Smoorenburg <miquels@drinkel.ow.org>.
1680 # Modified for Debian GNU/Linux by Ian Murdock <imurdock@gnu.ai.mit.edu>.
1681 # Modified for Debian by Christoph Lameter <clameter@debian.org>
1682 # Modified for chrony by John Hasler <jhasler@debian.org> 10 Nov 1998
1683
1684 PATH=/bin:/usr/bin:/sbin:/usr/sbin
1685 DAEMON=/usr/sbin/chronyd
1686 FLAGS="defaults"
1687 NAME="chronyd"
1688 DESC="time daemon"
1689
1690 test -f $DAEMON || exit 0
1691
1692 case "$1" in
1693   start)
1694     start-stop-daemon --start --verbose --exec $DAEMON
1695     ;;
1696   stop)
1697     start-stop-daemon --stop --verbose --oknodo --exec $DAEMON
1698     ;;
1699   restart|force-reload)
1700         #
1701         #       If the "reload" option is implemented, move the "force-reload"
1702         #       option to the "reload" entry above. If not, "force-reload" is
1703         #       just the same as "restart".
1704         #                                                                                   
1705         echo -n "Restarting $DESC: "
1706         start-stop-daemon --stop --quiet --exec $DAEMON
1707         sleep 1
1708         start-stop-daemon --start --quiet --exec $DAEMON -- -r
1709         echo "$NAME."
1710         ;;
1711   *)
1712     echo "Usage: /etc/init.d/chrony {start|stop|restart|force-reload}"
1713     exit 1
1714     ;;
1715 esac
1716
1717 exit 0
1718 #!/bin/sh
1719 ### BEGIN INIT INFO
1720 # Provides:          console-screen
1721 # Required-Start:    $local_fs $remote_fs
1722 # Required-Stop:     $local_fs $remote_fs
1723 # Default-Start:     S 2 3 4 5
1724 # Default-Stop:      0 1 6
1725 # Should-Start:      $syslog
1726 # Should-Stop:  
1727 # Description: Set console screen modes and fonts
1728 # Short-Description:    Prepare console
1729 ### END INIT INFO
1730
1731 #
1732 # This is the boot script for the `console-tools' package.
1733 #
1734 # It loads parameters from /etc/console-tools/config, maybe loads
1735 # default screen-font, screen font-map, and application charset-map,
1736 # and maybe start "vcstime"
1737 #
1738 # (c) 1997 Yann Dirson
1739
1740 # If setupcon is present, then we've been superseded by console-setup.
1741 if type setupcon >/dev/null 2>&1; then
1742     exit 0
1743 fi
1744
1745 # check if usplash is runing and skip this, we'll get run again later
1746 if pidof usplash > /dev/null; then
1747     exit 0
1748 fi
1749
1750 if [ -r /etc/console-tools/config ] ; then
1751     . /etc/console-tools/config
1752 fi
1753
1754 if [ -d /etc/console-tools/config.d ]; then
1755     for i in `run-parts --list /etc/console-tools/config.d `; do
1756        . $i
1757     done
1758 fi
1759
1760 . /lib/lsb/init-functions
1761
1762 PATH=/sbin:/bin:/usr/sbin:/usr/bin
1763 SETFONT="/usr/bin/consolechars"
1764 SETFONT_OPT=""
1765 CHARSET="/usr/bin/charset"
1766 VCSTIME="/usr/sbin/vcstime"
1767
1768 # Different device name for 2.6 kernels and devfs
1769 if [ `uname -r | cut -f 2 -d .` = 6 ] && [ -e /dev/.devfsd ]; then
1770     VCSTIME_OPT="-2 /dev/vcsa0"
1771 else
1772     VCSTIME_OPT=""
1773 fi
1774
1775
1776
1777 # set DEVICE_PREFIX depending on devfs/udev
1778 if [ -d /dev/vc ]; then
1779     DEVICE_PREFIX="/dev/vc/"
1780 else
1781     DEVICE_PREFIX="/dev/tty"
1782 fi
1783
1784 reset_vga_palette ()
1785 {
1786         if [ -f /proc/fb ]; then
1787            # They have a framebuffer device.
1788            # That means we have work to do...
1789             echo -n "\e]R"
1790         fi
1791 }
1792
1793 setup ()
1794 {
1795     # be sure the main program is installed
1796     [ -x "${SETFONT}" ] || return 0
1797
1798     VT="no"
1799     # If we can't access the console, quit
1800     CONSOLE_TYPE=`fgconsole 2>/dev/null` || return 0
1801
1802     if [ ! $CONSOLE_TYPE = "serial" ]  ; then
1803         readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console
1804         if [ $? -eq 0 ] ; then
1805             VT="yes"
1806             reset_vga_palette
1807         fi
1808     fi
1809
1810     [ $VT = "no" ] && return 0
1811
1812     # start vcstime
1813     if [ "${DO_VCSTIME}" = "yes" -a -x ${VCSTIME} ] ; then
1814         [ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console"
1815         ${VCSTIME} ${VCSTIME_OPT} &
1816         [ "$VERBOSE" != "no" ] && log_action_end_msg 0
1817     fi
1818
1819
1820     # Global default font+sfm
1821     if [ "${SCREEN_FONT}" ]
1822         then
1823         [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font"
1824         SCREEN_FONT="-f ${SCREEN_FONT}"
1825
1826         # maybe use an external SFM
1827         [ "${SCREEN_FONT_MAP}" ] && SCREEN_FONT_MAP="-u ${SCREEN_FONT_MAP}"
1828
1829         # Try to be cleverer and run for all consoles, but this is run
1830         # _before_ getty and so only one console running. So,
1831         # Set for the first 6 VCs (as they are allocated in /etc/inittab)
1832         NUM_CONSOLES=`fgconsole --next-available`
1833         NUM_CONSOLES=$(($NUM_CONSOLES - 1))
1834         [ ${NUM_CONSOLES} -eq 1 ] && NUM_CONSOLES=6
1835         i=1
1836         while [ $i -le $NUM_CONSOLES ]
1837             do
1838             if ! ${SETFONT} --tty=${DEVICE_PREFIX}$i ${SETFONT_OPT} ${SCREEN_FONT} ${SCREEN_FONT_MAP} ; then
1839               [ "$VERBOSE" != "no" ] && log_action_end_msg 1
1840               break
1841             elif [ "$i" -eq "$NUM_CONSOLES" ]; then
1842               [ "$VERBOSE" != "no" ] && log_action_end_msg 0
1843             fi
1844             i=$(($i + 1))
1845         done
1846     fi
1847
1848
1849     # Per-VC font+sfm
1850     VCS="`set | grep '^SCREEN_FONT_vc[0-9]*=' | sed -e 's/^SCREEN_FONT_vc//' -e 's/=.*//'`"
1851     if [ "${VCS}" ]
1852         then
1853         [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC fonts"
1854         for vc in ${VCS}
1855           do
1856             # extract FONTNAME info from variable setting
1857           eval font=\$SCREEN_FONT_vc$vc
1858           # eventually find an associated SFM
1859           eval sfm=\${SCREEN_FONT_MAP_vc${vc}}
1860           [ "$sfm" ] && sfm="-u $sfm"
1861
1862           ${SETFONT} --tty=${DEVICE_PREFIX}$vc ${SETFONT_OPT} -f $font $sfm
1863         done
1864         [ "$VERBOSE" != "no" ] && log_action_end_msg 0
1865     fi
1866
1867
1868     # Global ACM
1869     [ "${APP_CHARSET_MAP}" ] && ${CHARSET} G0 ${APP_CHARSET_MAP}
1870
1871
1872     # Per-VC ACMs
1873     VCS="`set | grep '^APP_CHARSET_MAP_vc[0-9]*=' | sed -e 's/^APP_CHARSET_MAP_vc//' -e 's/=.*//'`"
1874     if [ "${VCS}" ]
1875         then
1876         [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACM\'s"
1877         for vc in ${VCS}
1878           do
1879             # extract FONTNAME info from variable setting
1880           eval acm=\$APP_CHARSET_MAP_vc$vc
1881           ${CHARSET} --tty="${DEVICE_PREFIX}$vc" G0 "$acm"
1882         done
1883         [ "$VERBOSE" != "no" ] && log_action_end_msg 0
1884     fi
1885
1886
1887     # Go to UTF-8 mode as necessary
1888     # 
1889     ENV_FILE=''
1890     [ -r /etc/environment ] && ENV_FILE="/etc/environment"
1891     [ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale"
1892     [ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap)
1893     if test "$CHARMAP" = "UTF-8" 
1894     then
1895         unicode_start 2> /dev/null || true
1896     else
1897         unicode_stop 2> /dev/null|| true
1898     fi
1899
1900     # screensaver stuff
1901     setterm_args=""
1902     if [ "$BLANK_TIME" ]; then
1903         setterm_args="$setterm_args -blank $BLANK_TIME"
1904     fi
1905     if [ "$BLANK_DPMS" ]; then
1906         setterm_args="$setterm_args -powersave $BLANK_DPMS"
1907     fi
1908     if [ "$POWERDOWN_TIME" ]; then
1909         setterm_args="$setterm_args -powerdown $POWERDOWN_TIME"
1910     fi
1911     if [ "$setterm_args" ]; then
1912         setterm $setterm_args 
1913     fi
1914
1915     # Keyboard rate and delay
1916     KBDRATE_ARGS=""
1917     if [ -n "$KEYBOARD_RATE" ]; then
1918         KBDRATE_ARGS="-r $KEYBOARD_RATE"
1919     fi
1920     if [ -n "$KEYBOARD_DELAY" ]; then
1921         KBDRATE_ARGS="$KBDRATE_ARGS -d $KEYBOARD_DELAY"
1922     fi
1923     if [ -n "$KBDRATE_ARGS" ]; then
1924         [ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting keyboard rate and delay"
1925         kbdrate -s $KBDRATE_ARGS
1926         [ "$VERBOSE" != "no" ] && log_action_end_msg 0
1927     fi
1928
1929     # Inform gpm if present, of potential changes.
1930     if [ -f /var/run/gpm.pid ]; then
1931         kill -WINCH `cat /var/run/gpm.pid` 2> /dev/null
1932     fi
1933
1934     # Allow user to remap keys on the console
1935     if [ -r /etc/console-tools/remap ]
1936         then
1937         dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/console-tools/remap | loadkeys --quiet
1938     fi
1939     # Set LEDS here
1940     if [ "$LEDS" != "" ]
1941         then
1942         i=1
1943         while [ $i -le $NUM_CONSOLES ]
1944           do
1945           setleds -D $LEDS < $DEVICE_PREFIX$i
1946           i=$(($i + 1))
1947         done
1948     fi
1949 }
1950
1951 case "$1" in
1952     start|reload|restart|force-reload)
1953         log_action_msg "Setting console screen modes and fonts"
1954         setup
1955         ;;
1956     stop)
1957         ;;
1958     *)
1959         setup
1960         ;;
1961 esac
1962 #!/bin/sh
1963 # Start/stop the cron daemon.
1964 #
1965 ### BEGIN INIT INFO
1966 # Provides:          cron
1967 # Required-Start:    $syslog $time
1968 # Required-Stop:     $syslog $time
1969 # Default-Start:     2 3 4 5
1970 # Default-Stop:      0 1 6
1971 # Short-Description: Regular background program processing daemon
1972 # Description:       cron is a standard UNIX program that runs user-specified 
1973 #                    programs at periodic scheduled times. vixie cron adds a 
1974 #                    number of features to the basic UNIX cron, including better
1975 #                    security and more powerful configuration options.
1976 ### END INIT INFO
1977
1978
1979 test -f /usr/sbin/cron || exit 0
1980
1981 #LSBNAMES='-l'  # Uncomment for LSB name support in /etc/cron.d/
1982
1983 . /lib/lsb/init-functions
1984
1985 case "$1" in
1986 start)  log_daemon_msg "Starting periodic command scheduler" "crond"
1987         start-stop-daemon --start --quiet --pidfile /var/run/crond.pid --name cron --startas /usr/sbin/cron -- $LSBNAMES
1988         log_end_msg $?
1989         ;;
1990 stop)   log_daemon_msg "Stopping periodic command scheduler" "crond"
1991         start-stop-daemon --stop --quiet --pidfile /var/run/crond.pid --name cron
1992         log_end_msg $?
1993         ;;
1994 restart) log_daemon_msg "Restarting periodic command scheduler" "crond" 
1995         start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/crond.pid --name cron
1996         start-stop-daemon --start --quiet --pidfile /var/run/crond.pid --name cron --startas /usr/sbin/cron -- $LSBNAMES
1997         log_end_msg $?
1998         ;;
1999 reload|force-reload) log_daemon_msg "Reloading configuration files for periodic command scheduler" "crond"
2000         # cron reloads automatically
2001         log_end_msg 0
2002         ;;
2003 *)      log_action_msg "Usage: /etc/init.d/cron {start|stop|restart|reload|force-reload}"
2004         exit 2
2005         ;;
2006 esac
2007 exit 0
2008 #!/bin/sh
2009 ### BEGIN INIT INFO
2010 # Provides:          dbus
2011 # Required-Start:    $remote_fs $syslog
2012 # Required-Stop:     $remote_fs $syslog
2013 # Default-Start:     2 3 4 5
2014 # Default-Stop:      1
2015 # Short-Description: D-Bus systemwide message bus
2016 # Description:       D-Bus is a simple interprocess messaging system, used
2017 #                    for sending messages between applications.
2018 ### END INIT INFO
2019 # -*- coding: utf-8 -*-
2020 # Debian init.d script for D-BUS
2021 # Copyright Â© 2003 Colin Walters <walters@debian.org>
2022 # Copyright Â© 2005 Sjoerd Simons <sjoerd@debian.org>
2023
2024 set -e
2025
2026 DAEMON=/usr/bin/dbus-daemon
2027 UUIDGEN=/usr/bin/dbus-uuidgen
2028 UUIDGEN_OPTS=--ensure
2029 NAME=dbus
2030 DAEMONUSER=messagebus
2031 PIDDIR=/var/run/dbus
2032 PIDFILE=$PIDDIR/pid
2033 DESC="system message bus"
2034 EVENTDIR=/etc/dbus-1/event.d
2035
2036 test -x $DAEMON || exit 0
2037
2038 . /lib/lsb/init-functions
2039
2040 # Source defaults file; edit that file to configure this script.
2041 PARAMS=""
2042 if [ -e /etc/default/dbus ]; then
2043   . /etc/default/dbus
2044 fi
2045
2046 if [ -n "$ENABLED" ]; then
2047     log_warning_msg "The ENABLED option in /etc/default/$NAME has been deprecated."
2048     log_warning_msg "Please remove this setting from the configuration file."
2049     log_warning_msg "To disable the service use a runlevel editor like sysv-rc-conf or bum instead."
2050 fi
2051
2052 create_machineid() {
2053   # Create machine-id file
2054   if [ -x $UUIDGEN ]; then
2055     $UUIDGEN $UUIDGEN_OPTS
2056   fi
2057 }
2058
2059 dependent_services()
2060 {
2061   # Do nothing if we are called by init
2062   [ ! -z $runlevel ] && return 
2063
2064   # Determine current runlevel
2065   r=$(/sbin/runlevel) || true
2066   r=${r#*\ }
2067
2068   # Do nothing if we can't determine the runlevel (e.g. inside chroots)
2069   [ "$r" = "unknown" ] && return
2070
2071   if [ "$1" = "stop" ] ; then
2072     param="--reverse"
2073     action="stop"
2074   else
2075     param=""
2076     action="start"
2077   fi
2078
2079   # Get the list of services active in this runlevel
2080   if [ -d /etc/rc${r}.d/ ] ; then # sysv-rc
2081     services=$(grep -s -l "^# Required-Start:.*dbus" /etc/rc${r}.d/S??* | sort $param)
2082   elif [ -f /etc/runlevel.conf ] ; then # file-rc
2083     list=$(grep -s -l "^# Required-Start:.*dbus" /etc/init.d/* || true)
2084     services=$( for i in $list ; do
2085       grep -E "^[[:digit:]]{2}[[:space:]]+([0-9,S]+|[-])[[:space:]]+.*$r.*[[:space:]]+$i$" /etc/runlevel.conf
2086     done  | sort $param | awk '{print $4}' )
2087   else
2088     services=""
2089     log_warning_msg "Unable to determine dependent services: unknown init system"
2090   fi
2091
2092   # Start the services in the correct order
2093   for i in $services ; do
2094     service=$(basename $i)
2095     service=${service#S??}
2096     invoke-rc.d $service $action || true
2097   done
2098
2099 }
2100
2101
2102 start_it_up()
2103 {
2104   if [ ! -d $PIDDIR ]; then
2105     mkdir -p $PIDDIR
2106     chown $DAEMONUSER $PIDDIR
2107     chgrp $DAEMONUSER $PIDDIR
2108   fi
2109
2110   if ! mountpoint -q /proc/ ; then
2111     log_failure_msg "Can't start $DESC - /proc is not mounted"
2112     return
2113   fi
2114
2115   if [ -e $PIDFILE ]; then
2116     PIDDIR=/proc/$(cat $PIDFILE)
2117     if [ -d ${PIDDIR} -a  "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then 
2118       log_success_msg "$DESC already started; not starting."
2119       return
2120     else
2121       log_success_msg "Removing stale PID file $PIDFILE."
2122       rm -f $PIDFILE
2123     fi
2124   fi
2125
2126   create_machineid
2127
2128   log_daemon_msg "Starting $DESC" "$NAME"
2129   start-stop-daemon --start --quiet --pidfile $PIDFILE \
2130     --user $DAEMONUSER --exec $DAEMON -- --system $PARAMS
2131   log_end_msg $?
2132   if [ -d $EVENTDIR ]; then
2133       run-parts --arg=start $EVENTDIR || true
2134   fi
2135   dependent_services start
2136 }
2137
2138 shut_it_down()
2139 {
2140   dependent_services stop
2141   if [ -d $EVENTDIR ]; then
2142       run-parts --reverse --arg=stop $EVENTDIR || true
2143   fi
2144   log_daemon_msg "Stopping $DESC" "$NAME"
2145   start-stop-daemon --stop --retry 5 --quiet --oknodo --pidfile $PIDFILE \
2146     --user $DAEMONUSER
2147   # We no longer include these arguments so that start-stop-daemon
2148   # can do its job even given that we may have been upgraded.
2149   # We rely on the pidfile being sanely managed
2150   # --exec $DAEMON -- --system $PARAMS
2151   log_end_msg $?
2152   rm -f $PIDFILE
2153 }
2154
2155 reload_it()
2156 {
2157   create_machineid
2158   log_action_begin_msg "Reloading $DESC config"
2159   dbus-send --print-reply --system --type=method_call \
2160             --dest=org.freedesktop.DBus \
2161             / org.freedesktop.DBus.ReloadConfig > /dev/null
2162   # hopefully this is enough time for dbus to reload it's config file.
2163   log_action_end_msg $?
2164 }
2165
2166 case "$1" in
2167   start)
2168     start_it_up
2169   ;;
2170   stop)
2171     shut_it_down
2172   ;;
2173   reload|force-reload)
2174     reload_it
2175   ;;
2176   restart)
2177     shut_it_down
2178     start_it_up
2179   ;;
2180   *)
2181     echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload}" >&2
2182     exit 2
2183   ;;
2184 esac
2185
2186 #! /bin/sh
2187
2188 # $Id: dns-clean,v 1.1.1.1 2004/05/07 03:12:59 john Exp $
2189
2190 # dns-clean by John Hasler 1999-2003
2191 # Any possessor of a copy of this program may treat it as if it
2192 # were in the public domain.  I waive all rights.
2193
2194 # This script should be run at bootup to clean up any mess left by 0dns-up.
2195 # It should be run before ppp is started.
2196 # It should never be run while ppp is up.
2197
2198 ### BEGIN INIT INFO
2199 # Provides:          dns-clean
2200 # Required-Start:    $local_fs
2201 # Required-Stop:     $local_fs
2202 # Default-Start:     S
2203 # Default-Stop:
2204 # Short-Description: Cleans up any mess left by 0dns-up
2205 # Description: 0dns-up often leaves behind some cruft. This Script is meant
2206 #              to clean up any such mess.
2207 ### END INIT INFO
2208
2209 PATH=/sbin:/bin:/usr/sbin:/usr/bin
2210
2211 test -f /usr/sbin/pppconfig || exit 0
2212 # We might have a tmpfs /var/run.
2213 mkdir /var/run/pppconfig >/dev/null 2>&1 || true
2214 test -f /etc/ppp/ip-down.d/0dns-down || exit 0
2215
2216 . /lib/lsb/init-functions
2217 . /etc/default/rcS
2218
2219 case "$1" in
2220   start)
2221         [ "$VERBOSE" != no ] && log_begin_msg "Restoring resolver state..."
2222         /etc/ppp/ip-down.d/0dns-down "0dns-clean"
2223         [ "$VERBOSE" != no ] && log_end_msg $?
2224         ;;
2225   stop|restart|force-reload)
2226         ;;
2227   *)
2228         ;;
2229 esac
2230
2231 exit 0
2232
2233
2234
2235 #! /bin/sh
2236 #
2237 # evms          Enterprise Volume Management System
2238 #
2239 #               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
2240 #               Modified for Debian GNU/Linux
2241 #               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
2242 #               Modified for evms package
2243 #               by Matt Zimmerman <mdz@debian.org>
2244 #
2245
2246 ### BEGIN INIT INFO
2247 # Provides:          evms
2248 # Default-Start:     2 3 4 5
2249 # Default-Stop:      0 1 6
2250 # Required-Start:    
2251 # Required-Stop:     
2252 # Short-Description: Activates EVMS volumes
2253 # Description:       Activates any EVMS volumes that are left unactivated
2254 #                    by the initramfs for some reason (or if the user does
2255 #                    not use initramfs). This possibly includes setting up
2256 #                    RAID, LVM, snapshots, BBR etc., but does not start a
2257 #                    service.
2258 ### END INIT INFO
2259
2260 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
2261 NAME=evms
2262 DESC="Enterprise Volume Management System"
2263
2264 test -x /sbin/evms_activate || exit 0
2265
2266 . /lib/lsb/init-functions
2267 . /etc/default/rcS
2268
2269 set -e
2270
2271 case "$1" in
2272   start|reload|restart|force-reload)
2273         log_begin_msg "Starting $DESC..."
2274         status=0
2275         if [ "$VERBOSE" != no ]; then
2276                 evms_activate || status=$?
2277         else
2278                 # Messages are still written to the log
2279                 evms_activate >/dev/null 2>&1 || status=$?
2280         fi
2281         log_end_msg $status
2282         ;;
2283   stop)
2284         ;;
2285   status)
2286         echo "no daemons started by this script"
2287         log_end_msg 0
2288         ;;
2289   *)
2290         N=/etc/init.d/$NAME
2291         log_success_msg "Usage: $N {start|stop|restart|reload|force-reload|status}"
2292         exit 1
2293         ;;
2294 esac
2295
2296 exit 0
2297 #! /bin/sh
2298 #
2299 # Originally based on:
2300 # Version:      @(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
2301 #
2302 # Modified for gdm, Steve Haslam <steve@arise.dmeon.co.uk> 14mar99
2303 # modified to remove --exec, as it does not work on upgrades. 18jan2000
2304 # modified to use --name, to detect stale PID files 18mar2000
2305 # sleep until gdm dies, then restart it 16jul2000
2306 # get along with other display managers (Branden Robinson, Ryan Murray) 05sep2001
2307
2308 set -e
2309
2310 # To start gdm even if it is not the default display manager, change
2311 # HEED_DEFAULT_DISPLAY_MANAGER to "false."
2312 HEED_DEFAULT_DISPLAY_MANAGER=true
2313 DEFAULT_DISPLAY_MANAGER_FILE=/etc/X11/default-display-manager
2314 PATH=/sbin:/bin:/usr/sbin:/usr/bin
2315 DAEMON=/usr/sbin/gdm
2316 PIDFILE=/var/run/gdm.pid
2317 UPGRADEFILE=/var/run/gdm.upgrade
2318
2319 if [ -e $UPGRADEFILE -a "$1" != "restart" -a "$1" != "force-reload" ]; then
2320         SSD_ARG="--startas $DAEMON"
2321         rm -f $UPGRADEFILE
2322 else
2323         SSD_ARG="--exec $DAEMON"
2324 fi
2325
2326 # Allow cdd to override the config
2327 if [ -f /etc/gdm/gdm-cdd.conf ]; then
2328         CONFIG_FILE="--config=/etc/gdm/gdm-cdd.conf"
2329 fi
2330
2331 test -x $DAEMON || exit 0
2332
2333 if [ -r /etc/environment ]; then
2334   if LANG=$(pam_getenv -l LANG); then
2335     export LANG
2336   fi
2337   if LANGUAGE=$(pam_getenv -l LANGUAGE); then
2338     export LANGUAGE
2339   fi
2340
2341 fi
2342
2343 . /lib/lsb/init-functions
2344
2345 case "$1" in
2346   start)
2347         if [ -e "$DEFAULT_DISPLAY_MANAGER_FILE" -a "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" -a "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2>/dev/null)" != "$DAEMON" ]; then
2348                 log_warning_msg "Not starting GNOME Display Manager (gdm); it is not the default display manager."
2349         else
2350                 # if usplash is runing, make sure to stop it now, yes "start" kills it.
2351                 if pidof usplash > /dev/null; then
2352                         /etc/init.d/usplash start
2353                 fi
2354                 log_begin_msg "Starting GNOME Display Manager..."
2355                 start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --name gdm $SSD_ARG -- $CONFIG_FILE >/dev/null 2>&1 || log_end_msg 1
2356                 log_end_msg 0
2357         fi
2358   ;;
2359   stop)
2360         log_begin_msg "Stopping GNOME Display Manager..."
2361         start-stop-daemon --stop  --quiet --oknodo --pidfile $PIDFILE --name gdm $SSD_ARG --retry 30 >/dev/null 2>&1
2362         log_end_msg 0
2363   ;;
2364   reload)
2365         log_begin_msg "Reloading GNOME Display Manager configuration..."
2366         log_warning_msg "Changes will take effect when all current X sessions have ended."
2367         start-stop-daemon --stop --signal USR1 --quiet --pidfile \
2368                 $PIDFILE --name gdm $SSD_ARG >/dev/null 2>&1
2369         log_end_msg 0
2370   ;;
2371   restart|force-reload)
2372         $0 stop || true
2373         $0 start
2374   ;;
2375   *)
2376         log_success_msg "Usage: /etc/init.d/gdm {start|stop|restart|reload|force-reload}"
2377         exit 1
2378   ;;
2379 esac
2380
2381 exit 0
2382 #! /bin/sh -e
2383 #
2384 ### BEGIN INIT INFO
2385 # Provides:          glibc
2386 # Required-Start:
2387 # Required-Stop:
2388 # Default-Start:     S
2389 # Default-Stop:
2390 ### END INIT INFO
2391 #
2392
2393 # This script detects deprecated kernel versions incompatible with
2394 # the current version of the glibc
2395
2396 # glibc kernel version check: KERNEL_VERSION_CHECK
2397 linux_compare_versions () {
2398     verA=$(($(echo "$1" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
2399     verB=$(($(echo "$3" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \* 10000 + \2 \* 100 + \3/')))
2400
2401     test $verA -$2 $verB
2402 }
2403
2404 kfreebsd_compare_versions () {
2405     verA=$(($(echo "$1" | sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \* 100 + \2/')))
2406     verB=$(($(echo "$3" | sed 's/\([0-9]*\)\.\([0-9]*\).*/\1 \* 100 + \2/')))
2407
2408     test $verA -$2 $verB
2409 }
2410
2411 kernel26_help() {
2412     echo ""
2413     echo "The installation of a 2.6 kernel _could_ ask you to install a new libc"
2414     echo "first, this is NOT a bug, and should *NOT* be reported. In that case,"
2415     echo "please add etch sources to your /etc/apt/sources.list and run:"
2416     echo "  apt-get install -t etch linux-image-2.6"
2417     echo "Then reboot into this new kernel, and proceed with your upgrade"
2418 }
2419
2420 exit_check () {
2421     sleep 5
2422     exit 1
2423 }
2424
2425     system=`uname -s`
2426     if [ "$system" = "Linux" ]
2427     then
2428         # Test to make sure z < 255, in x.y.z-n form of kernel version
2429         # Also make sure we don't trip on x.y.zFOO-n form
2430         #kernel_rev=$(uname -r | tr -- - . | cut -d. -f3 | tr -d '[:alpha:]')
2431         kernel_rev=$(uname -r | sed 's/\([0-9]*\.[0-9]*\.\)\([0-9]*\)\(.*\)/\2/')
2432         if [ "$kernel_rev" -ge 255 ]
2433         then
2434             echo "WARNING: Your kernel version indicates a revision number"
2435             echo "of 255 or greater.  Glibc has a number of built in"
2436             echo "assumptions that this revision number is less than 255."
2437             echo "If you\'ve built your own kernel, please make sure that any"
2438             echo "custom version numbers are appended to the upstream"
2439             echo "kernel number with a dash or some other delimiter."
2440
2441             exit_check
2442         fi
2443
2444         # sanity checking for the appropriate kernel on each architecture.
2445         realarch=`uname -m`
2446         kernel_ver=`uname -r`
2447
2448         # convert "armv4l" and similar to just "arm", and "mips64" and similar
2449         # to just "mips"
2450         case $realarch in
2451           arm*) realarch="arm";;
2452           mips*) realarch="mips";;
2453         esac
2454
2455
2456         # From glibc 2.3.5-7 real-i386 is dropped.
2457         if [ "$realarch" = i386 ]
2458         then
2459             echo "WARNING: This machine has real i386 class processor."
2460             echo "Debian etch and later does not support such old hardware"
2461             echo "any longer."
2462             echo "The reason is that \"bswap\" instruction is not supported"
2463             echo "on i386 class processors, and some core libraries have"
2464             echo "such instruction.  You\'ll see illegal instruction error"
2465             echo "when you upgrade your Debian system."
2466             exit_check
2467         fi
2468
2469         # arm boxes require __ARM_NR_set_tls in the kernel to function properly.
2470         if [ "$realarch" = arm ]
2471         then
2472             if linux_compare_versions "$kernel_ver" lt 2.6.12
2473             then
2474                 echo WARNING: This version of glibc requires that you be running
2475                 echo kernel version 2.6.12 or later.  Earlier kernels contained
2476                 echo bugs that may render the system unusable if a modern version
2477                 echo of glibc is installed.
2478                 kernel26_help
2479                 exit_check
2480             fi  
2481         fi
2482
2483         # Alpha and HPPA boxes require latest fixes in the kernel to function properly.
2484         if [ "$realarch" = parisc -o "$realarch" = alpha ]
2485         then
2486             if linux_compare_versions "$kernel_ver" lt 2.6.9
2487             then
2488                 echo WARNING: This version of glibc requires that you be running
2489                 echo kernel version 2.6.9 or later.  Earlier kernels contained
2490                 echo bugs that may render the system unusable if a modern version
2491                 echo of glibc is installed.
2492                 kernel26_help
2493                 exit_check
2494             fi
2495         fi
2496
2497         # sh4 boxes require kernel version 2.6.11 minimum
2498         if [ "$realarch" = sh4 ]
2499         then
2500             if linux_compare_versions "$kernel_ver" lt 2.6.11
2501             then
2502                 echo WARNING: This version of glibc requires that you be running
2503                 echo kernel version 2.6.11 or later.  Earlier kernels contained
2504                 echo bugs that may render the system unusable if a modern version
2505                 echo of glibc is installed.
2506                 kernel26_help
2507                 exit_check
2508             fi  
2509         fi
2510
2511         # The GNU libc requires 2.6 kernel (except on m68k) because we drop to
2512         # support linuxthreads
2513         if [ "$realarch" != m68k ]
2514         then
2515             if linux_compare_versions "$kernel_ver" lt 2.6.8
2516             then
2517                 echo WARNING: POSIX threads library NPTL requires kernel version
2518                 echo 2.6.8 or later.  If you use a kernel 2.4, please upgrade it
2519                 echo before installing glibc.
2520                 kernel26_help
2521                 exit_check
2522             fi
2523         fi
2524
2525         # The GNU libc is now built with --with-kernel= >= 2.4.1 on m68k
2526         if [ "$realarch" = m68k ]
2527         then
2528             if linux_compare_versions "$kernel_ver" lt 2.4.1
2529             then
2530                 echo WARNING: This version of glibc requires that you be running
2531                 echo kernel version 2.4.1 or later.  Earlier kernels contained
2532                 echo bugs that may render the system unusable if a modern version
2533                 echo of glibc is installed.
2534                 kernel26_help
2535                 exit_check
2536             fi
2537         fi
2538
2539         # From glibc 2.6-3 SPARC V8 support is dropped.
2540         if [ "$realarch" = sparc ]
2541         then
2542             # The process could be run using linux32, check for /proc.
2543             if [ -f /proc/cpuinfo ]
2544             then
2545                case "$(sed '/^type/!d;s/^type.*: //g' /proc/cpuinfo)" in
2546                    sun4u)
2547                       # UltraSPARC CPU
2548                       ;;
2549                    sun4v)
2550                       # Niagara CPU
2551                       ;;
2552                    *)
2553                       echo "WARNING: This machine has a SPARC V8 or earlier class processor."
2554                       echo "Debian lenny and later does not support such old hardware"
2555                       echo "any longer."
2556                       exit_check
2557                       ;;
2558                esac
2559             fi
2560         fi
2561     elif [ $system = "GNU/kFreeBSD" ] ; then
2562         kernel_ver=`uname -r`
2563         if kfreebsd_compare_versions "$kernel_ver" lt 6.0
2564         then
2565             echo WARNING: This version of glibc uses UMTX_OP_WAIT and UMTX_OP_WAKE
2566             echo syscalls that are not present in the current running kernel. They
2567             echo have been added in kFreeBSD 6.0.  Your system should still work,
2568             echo but it is recommended to upgrade to a more recent version.
2569         fi
2570     fi
2571
2572 : exit 0
2573 #! /bin/sh
2574 ### BEGIN INIT INFO
2575 # Provides:          halt
2576 # Required-Start:    umountroot
2577 # Required-Stop:
2578 # Should-Start:      lvm raid2
2579 # Should-Stop:
2580 # Default-Start:     0
2581 # Default-Stop:
2582 # Short-Description: Execute the halt command.
2583 # Description:
2584 ### END INIT INFO
2585
2586 PATH=/usr/sbin:/usr/bin:/sbin:/bin
2587 [ -f /etc/default/halt ] && . /etc/default/halt
2588
2589 . /lib/lsb/init-functions
2590
2591 do_stop () {
2592         if [ "$INIT_HALT" = "" ]
2593         then
2594                 case "$HALT" in
2595                   [Pp]*)
2596                         INIT_HALT=POWEROFF
2597                         ;;
2598                   [Hh]*)
2599                         INIT_HALT=HALT
2600                         ;;
2601                   *)
2602                         INIT_HALT=POWEROFF
2603                         ;;
2604                 esac
2605         fi
2606
2607         # See if we need to cut the power.
2608         if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
2609         then
2610                 /etc/init.d/ups-monitor poweroff
2611         fi
2612
2613         # Don't shut down drives if we're using RAID.
2614         hddown="-h"
2615         if grep -qs '^md.*active' /proc/mdstat
2616         then
2617                 hddown=""
2618         fi
2619
2620         # If INIT_HALT=HALT don't poweroff.
2621         poweroff="-p"
2622         if [ "$INIT_HALT" = "HALT" ]
2623         then
2624                 poweroff=""
2625         fi
2626
2627         log_action_msg "Will now halt"
2628         sleep 1
2629         halt -d -f -i $poweroff $hddown
2630 }
2631
2632 case "$1" in
2633   start)
2634         # No-op
2635         ;;
2636   restart|reload|force-reload)
2637         echo "Error: argument '$1' not supported" >&2
2638         exit 3
2639         ;;
2640   stop)
2641         do_stop
2642         ;;
2643   *)
2644         echo "Usage: $0 start|stop" >&2
2645         exit 3
2646         ;;
2647 esac
2648
2649 :
2650 #! /bin/sh
2651 ### BEGIN INIT INFO
2652 # Provides:          hostname
2653 # Required-Start:
2654 # Required-Stop:
2655 # Default-Start:     S
2656 # Default-Stop:
2657 # Short-Description: Set hostname.
2658 # Description:
2659 ### END INIT INFO
2660
2661 PATH=/sbin:/bin
2662
2663 . /lib/init/vars.sh
2664 . /lib/lsb/init-functions
2665
2666 do_start () {
2667         [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
2668
2669         # Keep current name if /etc/hostname is missing.
2670         [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)"
2671
2672         # And set it to 'localhost' if no setting was found
2673         [ -z "$HOSTNAME" ] && HOSTNAME=localhost
2674
2675         [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'"
2676         hostname "$HOSTNAME"
2677         ES=$?
2678         [ "$VERBOSE" != no ] && log_action_end_msg $ES
2679 }
2680
2681 case "$1" in
2682   start|"")
2683         do_start
2684         ;;
2685   restart|reload|force-reload)
2686         echo "Error: argument '$1' not supported" >&2
2687         exit 3
2688         ;;
2689   stop)
2690         # No-op
2691         ;;
2692   *)
2693         echo "Usage: hostname.sh [start|stop]" >&2
2694         exit 3
2695         ;;
2696 esac
2697 #!/bin/sh
2698 # hwclock.sh    Set and adjust the CMOS clock, according to the UTC
2699 #               setting in /etc/default/rcS (see also rcS(5)).
2700 #
2701 # Version:      @(#)hwclock.sh  2.00  14-Dec-1998  miquels@cistron.nl
2702 #
2703 # Patches:
2704 #               2000-01-30 Henrique M. Holschuh <hmh@rcm.org.br>
2705 #                - Minor cosmetic changes in an attempt to help new
2706 #                  users notice something IS changing their clocks
2707 #                  during startup/shutdown.
2708 #                - Added comments to alert users of hwclock issues
2709 #                  and discourage tampering without proper doc reading.
2710
2711 # WARNING:      Please read /usr/share/doc/util-linux/README.Debian.hwclock
2712 #               before changing this file. You risk serious clock
2713 #               misbehaviour otherwise.
2714
2715 ### BEGIN INIT INFO
2716 # Provides:          hwclockfirst
2717 # Required-Start:    mountdevsubfs
2718 # Required-Stop:     umountroot
2719 # Default-Start:     S
2720 # Default-Stop:      0 6
2721 ### END INIT INFO
2722
2723 FIRST=yes       # debian/rules sets this to 'yes' when creating hwclockfirst.sh
2724
2725 # Set this to any options you might need to give to hwclock, such
2726 # as machine hardware clock type for Alphas.
2727 HWCLOCKPARS=
2728
2729 hwclocksh()
2730 {
2731     [ ! -x /sbin/hwclock ] && return 0
2732     . /etc/default/rcS
2733
2734     . /lib/lsb/init-functions
2735     verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
2736
2737     [ "$GMT" = "-u" ] && UTC="yes"
2738     case "$UTC" in
2739        no|"")   GMT="--localtime"
2740                 UTC=""
2741                 if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then
2742                     if [ -z "$TZ" ]; then
2743                         log_action_msg "System clock was not updated at this time"
2744                         return 1
2745                     fi
2746                 fi
2747                 ;;
2748        yes)     GMT="--utc"
2749                 UTC="--utc"
2750                 ;;
2751        *)       log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;;
2752     esac
2753
2754     case "$BADYEAR" in
2755        no|"")   BADYEAR="" ;;
2756        yes)     BADYEAR="--badyear" ;;
2757        *)       log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
2758     esac
2759
2760     case "$1" in
2761         start)
2762             if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
2763                 echo "0.0 0 0.0" > /etc/adjtime
2764             fi
2765
2766             if [ ! -w /etc/adjtime ]; then
2767                 NOADJ="--noadjfile"
2768             else
2769                 NOADJ=""
2770             fi
2771
2772             if [ "$FIRST" != yes ]; then
2773                 # Uncomment the hwclock --adjust line below if you want
2774                 # hwclock to try to correct systematic drift errors in the
2775                 # Hardware Clock.
2776                 #
2777                 # WARNING: If you uncomment this option, you must either make
2778                 # sure *nothing* changes the Hardware Clock other than
2779                 # hwclock --systohc, or you must delete /etc/adjtime
2780                 # every time someone else modifies the Hardware Clock.
2781                 #
2782                 # Common "vilains" are: ntp, MS Windows, the BIOS Setup
2783                 # program.
2784                 #
2785                 # WARNING: You must remember to invalidate (delete)
2786                 # /etc/adjtime if you ever need to set the system clock
2787                 # to a very different value and hwclock --adjust is being
2788                 # used.
2789                 #
2790                 # Please read /usr/share/doc/util-linux/README.Debian.hwclock
2791                 # before enabling hwclock --adjust.
2792
2793                 #/sbin/hwclock --adjust $GMT $BADYEAR
2794                 :
2795             fi
2796
2797             if [ "$HWCLOCKACCESS" != no ]; then
2798                 log_action_msg "Setting the system clock"
2799
2800                 # Copies Hardware Clock time to System Clock using the correct
2801                 # timezone for hardware clocks in local time, and sets kernel
2802                 # timezone. DO NOT REMOVE.
2803                 if /sbin/hwclock --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
2804                     #   Announce the local time.
2805                     verbose_log_action_msg "System Clock set to: `date $UTC`"
2806                 else
2807                     log_warning_msg "Unable to set System Clock to: `date $UTC`"
2808                 fi
2809             else
2810                 verbose_log_action_msg "Not setting System Clock"
2811             fi
2812             ;;
2813         stop|restart|reload|force-reload)
2814             #
2815             # Updates the Hardware Clock with the System Clock time.
2816             # This will *override* any changes made to the Hardware Clock.
2817             #
2818             # WARNING: If you disable this, any changes to the system
2819             #          clock will not be carried across reboots.
2820             #
2821             if [ "$HWCLOCKACCESS" != no ]; then
2822                 log_action_msg "Saving the system clock"
2823                 if [ "$GMT" = "-u" ]; then
2824                     GMT="--utc"
2825                 fi
2826                 if /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR; then
2827                     verbose_log_action_msg "Hardware Clock updated to `date`"
2828                 fi
2829             else
2830                 verbose_log_action_msg "Not saving System Clock"
2831             fi
2832             ;;
2833         show)
2834             if [ "$HWCLOCKACCESS" != no ]; then
2835                 /sbin/hwclock --show $GMT $HWCLOCKPARS $BADYEAR
2836             fi
2837             ;;
2838         *)
2839             log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}"
2840             log_success_msg "       start sets kernel (system) clock from hardware (RTC) clock"
2841             log_success_msg "       stop and reload set hardware (RTC) clock from kernel (system) clock"
2842             return 1
2843             ;;
2844     esac
2845 }
2846
2847 hwclocksh "$@"
2848 #!/bin/sh
2849 # hwclock.sh    Set and adjust the CMOS clock, according to the UTC
2850 #               setting in /etc/default/rcS (see also rcS(5)).
2851 #
2852 # Version:      @(#)hwclock.sh  2.00  14-Dec-1998  miquels@cistron.nl
2853 #
2854 # Patches:
2855 #               2000-01-30 Henrique M. Holschuh <hmh@rcm.org.br>
2856 #                - Minor cosmetic changes in an attempt to help new
2857 #                  users notice something IS changing their clocks
2858 #                  during startup/shutdown.
2859 #                - Added comments to alert users of hwclock issues
2860 #                  and discourage tampering without proper doc reading.
2861
2862 # WARNING:      Please read /usr/share/doc/util-linux/README.Debian.hwclock
2863 #               before changing this file. You risk serious clock
2864 #               misbehaviour otherwise.
2865
2866 ### BEGIN INIT INFO
2867 # Provides:          hwclock
2868 # Required-Start:    mountdevsubfs
2869 # Required-Stop:     $local_fs
2870 # Default-Start:     S
2871 # Default-Stop:      0 6
2872 ### END INIT INFO
2873
2874 FIRST=no        # debian/rules sets this to 'yes' when creating hwclockfirst.sh
2875
2876 # Set this to any options you might need to give to hwclock, such
2877 # as machine hardware clock type for Alphas.
2878 HWCLOCKPARS=
2879
2880 hwclocksh()
2881 {
2882     [ ! -x /sbin/hwclock ] && return 0
2883     . /etc/default/rcS
2884
2885     . /lib/lsb/init-functions
2886     verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
2887
2888     [ "$GMT" = "-u" ] && UTC="yes"
2889     case "$UTC" in
2890        no|"")   GMT="--localtime"
2891                 UTC=""
2892                 if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then
2893                     if [ -z "$TZ" ]; then
2894                         log_action_msg "System clock was not updated at this time"
2895                         return 1
2896                     fi
2897                 fi
2898                 ;;
2899        yes)     GMT="--utc"
2900                 UTC="--utc"
2901                 ;;
2902        *)       log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;;
2903     esac
2904
2905     case "$BADYEAR" in
2906        no|"")   BADYEAR="" ;;
2907        yes)     BADYEAR="--badyear" ;;
2908        *)       log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
2909     esac
2910
2911     case "$1" in
2912         start)
2913             if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
2914                 echo "0.0 0 0.0" > /etc/adjtime
2915             fi
2916
2917             if [ ! -w /etc/adjtime ]; then
2918                 NOADJ="--noadjfile"
2919             else
2920                 NOADJ=""
2921             fi
2922
2923             if [ "$FIRST" != yes ]; then
2924                 # Uncomment the hwclock --adjust line below if you want
2925                 # hwclock to try to correct systematic drift errors in the
2926                 # Hardware Clock.
2927                 #
2928                 # WARNING: If you uncomment this option, you must either make
2929                 # sure *nothing* changes the Hardware Clock other than
2930                 # hwclock --systohc, or you must delete /etc/adjtime
2931                 # every time someone else modifies the Hardware Clock.
2932                 #
2933                 # Common "vilains" are: ntp, MS Windows, the BIOS Setup
2934                 # program.
2935                 #
2936                 # WARNING: You must remember to invalidate (delete)
2937                 # /etc/adjtime if you ever need to set the system clock
2938                 # to a very different value and hwclock --adjust is being
2939                 # used.
2940                 #
2941                 # Please read /usr/share/doc/util-linux/README.Debian.hwclock
2942                 # before enabling hwclock --adjust.
2943
2944                 #/sbin/hwclock --adjust $GMT $BADYEAR
2945                 :
2946             fi
2947
2948             if [ "$HWCLOCKACCESS" != no ]; then
2949                 log_action_msg "Setting the system clock"
2950
2951                 # Copies Hardware Clock time to System Clock using the correct
2952                 # timezone for hardware clocks in local time, and sets kernel
2953                 # timezone. DO NOT REMOVE.
2954                 if /sbin/hwclock --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
2955                     #   Announce the local time.
2956                     verbose_log_action_msg "System Clock set to: `date $UTC`"
2957                 else
2958                     log_warning_msg "Unable to set System Clock to: `date $UTC`"
2959                 fi
2960             else
2961                 verbose_log_action_msg "Not setting System Clock"
2962             fi
2963             ;;
2964         stop|restart|reload|force-reload)
2965             #
2966             # Updates the Hardware Clock with the System Clock time.
2967             # This will *override* any changes made to the Hardware Clock.
2968             #
2969             # WARNING: If you disable this, any changes to the system
2970             #          clock will not be carried across reboots.
2971             #
2972             if [ "$HWCLOCKACCESS" != no ]; then
2973                 log_action_msg "Saving the system clock"
2974                 if [ "$GMT" = "-u" ]; then
2975                     GMT="--utc"
2976                 fi
2977                 if /sbin/hwclock --systohc $GMT $HWCLOCKPARS $BADYEAR; then
2978                     verbose_log_action_msg "Hardware Clock updated to `date`"
2979                 fi
2980             else
2981                 verbose_log_action_msg "Not saving System Clock"
2982             fi
2983             ;;
2984         show)
2985             if [ "$HWCLOCKACCESS" != no ]; then
2986                 /sbin/hwclock --show $GMT $HWCLOCKPARS $BADYEAR
2987             fi
2988             ;;
2989         *)
2990             log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}"
2991             log_success_msg "       start sets kernel (system) clock from hardware (RTC) clock"
2992             log_success_msg "       stop and reload set hardware (RTC) clock from kernel (system) clock"
2993             return 1
2994             ;;
2995     esac
2996 }
2997
2998 hwclocksh "$@"
2999 #!/bin/sh
3000 ### BEGIN INIT INFO
3001 # Provides:             keymap
3002 # Required-Start:       mountdevsubfs
3003 # Required-Stop:     
3004 # Default-Start:        S
3005 # Default-Stop:
3006 # Short-Description:    Set keymap
3007 # Description:          Set the Console keymap
3008 ### END INIT INFO
3009
3010 # If setupcon is present, then we've been superseded by console-setup.
3011 if type setupcon >/dev/null 2>&1; then
3012         exit 0
3013 fi
3014
3015 . /lib/lsb/init-functions
3016
3017 #
3018 # Load the keymaps *as soon as possible*
3019 #
3020
3021 # Don't fail on error
3022 CONSOLE_TYPE=`fgconsole 2>/dev/null` || CONSOLE_TYPE="unknown"
3023
3024 # Don't fail on serial consoles
3025
3026 QUIT=0
3027 # fail silently if loadkeys not present (yet).
3028 command -v loadkeys >/dev/null 2>&1 || QUIT=1
3029
3030 CONFDIR=/etc/console
3031 CONFFILEROOT=boottime
3032 EXT=kmap
3033 CONFFILE=${CONFDIR}/${CONFFILEROOT}.${EXT}.gz
3034
3035 reset_kernel()
3036 {
3037         # On Mac PPC machines, we may need to set kernel vars first
3038         # We need to mount /proc to do that; not optimal, as its going to 
3039         # be mounted in S10checkroot, but we need it set up before sulogin
3040         # may be run in checkroot, which will need the keyboard to log in...
3041         [ -x /sbin/sysctl ] || return
3042         [ -r /etc/sysctl.conf ] || return
3043         grep -v '^\#' /etc/sysctl.conf | grep -q keycodes 
3044         if [ "$?" = "0" ] ; then
3045             grep keycodes /etc/sysctl.conf | grep -v "^#" | while read d ; do
3046                 /sbin/sysctl -w $d 2> /dev/null || true
3047             done
3048         fi
3049 }
3050
3051 unicode_start_stop()
3052 {
3053         # Switch unicode mode by checking the locale.
3054         # This will be needed before loading the keymap.
3055         [ -x /usr/bin/unicode_start ] || [ -x /bin/unicode_start ] ||  return
3056         [ -x /usr/bin/unicode_stop ] || [ -x /bin/unicode_stop ] || return
3057
3058         ENV_FILE="none"
3059         [ -r /etc/environment ] && ENV_FILE="/etc/environment"
3060         [ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale" 
3061         [ $ENV_FILE = none ] && return
3062         
3063         for var in LANG LC_ALL LC_CTYPE; do
3064                 value=$(egrep "^[^#]*${var}=" $ENV_FILE | tail -n1 | cut -d= -f2)
3065                 eval $var=$value
3066         done
3067
3068         CHARMAP=`LANG=$LANG LC_ALL=$LC_ALL LC_CTYPE=$LC_CTYPE locale charmap`
3069         if [ "$CHARMAP" = "UTF-8" ]; then
3070                 unicode_start 2> /dev/null || true
3071         else
3072                 unicode_stop 2> /dev/null || true
3073         fi
3074 }
3075
3076 if [ ! $QUIT = '1' ] ; then
3077
3078   case "$1" in
3079       start | restart | force-reload | reload)
3080   
3081         # Set kernel variables if required
3082         reset_kernel
3083
3084         # First mount /proc if necessary...and if it is there (#392798)
3085         unmount_proc="no"
3086         if [ -d /proc ]; then
3087                 if [ ! -x /proc/$$ ]; then
3088                         unmount_proc="yes"      
3089                         mount -n /proc
3090                 fi
3091   
3092
3093                 if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ] ; then
3094                         linux_keycodes=`cat /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes`
3095                 else
3096                         linux_keycodes=1;
3097                 fi
3098         else
3099                 linux_keycodes=1;
3100         fi
3101
3102         # load new map
3103         if [ $linux_keycodes -gt 0 ] ; then 
3104           if [ -r ${CONFFILE} ] ; then
3105
3106             # Switch console mode to UTF-8 or ASCII as necessary
3107             unicode_start_stop
3108
3109             if [ $CONSOLE_TYPE = "serial" ] ; then 
3110                     loadkeys -q ${CONFFILE} 2>&1 > /dev/null
3111             else
3112                     loadkeys -q ${CONFFILE}
3113             fi
3114             if [ $? -gt 0 ]
3115                 then
3116                 # if we've a serial console, we may not have a keyboard, so don't
3117                 # complain if we fail. 
3118                    if [ ! $CONSOLE_TYPE = "serial" ]; then 
3119                         log_warning_msg "Problem when loading ${CONFDIR}/${CONFFILEROOT}.${EXT}.gz, use install-keymap"
3120                         sleep 10
3121                    fi 
3122                 fi
3123             fi
3124         fi
3125
3126         # unmount /proc if we mounted it
3127         [ "$unmount_proc" = "no" ] || umount -n /proc
3128
3129         ;;
3130
3131     stop)
3132         ;;
3133
3134     *)
3135         log_warning_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
3136         ;;
3137   esac
3138
3139 fi
3140 #! /bin/sh
3141 ### BEGIN INIT INFO
3142 # Provides:          killprocs
3143 # Required-Start:    $local_fs
3144 # Required-Stop:
3145 # Default-Start:     1
3146 # Default-Stop:
3147 # Short-Description: executed by init(8) upon entering runlevel 1 (single).
3148 ### END INIT INFO
3149
3150 PATH=/usr/sbin:/usr/bin:/sbin:/bin
3151
3152 . /lib/lsb/init-functions
3153
3154 do_start () {
3155         # Kill all processes.
3156         log_action_begin_msg "Sending all processes the TERM signal"
3157         killall5 -15
3158         log_action_end_msg 0
3159         sleep 5
3160         log_action_begin_msg "Sending all processes the KILL signal"
3161         killall5 -9
3162         log_action_end_msg 0
3163
3164         # We start update here, since we just killed it.
3165         if [ -x /sbin/update ] && [ "$(uname -s)" = Linux ]
3166         then
3167                 case "$(uname -r)" in
3168                   0.*|1.*|2.[0123].*)
3169                         /sbin/update
3170                         ;;
3171                 esac
3172         fi
3173 }
3174
3175 case "$1" in
3176   start)
3177         do_start
3178         ;;
3179   restart|reload|force-reload)
3180         echo "Error: argument '$1' not supported" >&2
3181         exit 3
3182         ;;
3183   stop)
3184         # No-op
3185         ;;
3186   *)
3187         echo "Usage: $0 start|stop" >&2
3188         exit 3
3189         ;;
3190 esac
3191 #! /bin/sh
3192 # /etc/init.d/klogd: start the kernel log daemon.
3193
3194 ### BEGIN INIT INFO
3195 # Provides:             klogd
3196 # Required-Start:       syslog
3197 # Required-Stop:        syslog
3198 # Default-Start:        S 1 2 3 4 5
3199 # Default-Stop:         0 6
3200 # Short-Description:    Kernel logger
3201 ### END INIT INFO
3202
3203 PATH=/bin:/usr/bin:/sbin:/usr/sbin
3204
3205 pidfile=/var/run/klogd/klogd.pid
3206 kmsgpipe=/var/run/klogd/kmsg
3207 kmsgpidfile=/var/run/klogd/kmsgpipe.pid
3208 binpath=/sbin/klogd
3209
3210 test -f $binpath || exit 0
3211 . /lib/lsb/init-functions
3212
3213 #  Use KLOGD="-k /boot/System.map-$(uname -r)" to specify System.map
3214 #
3215 KLOGD="-P $kmsgpipe"
3216
3217 test ! -r /etc/default/klogd || . /etc/default/klogd
3218
3219 . /lib/lsb/init-functions
3220
3221 case "$1" in
3222   start)
3223     log_begin_msg "Starting kernel log daemon..."
3224     # create klog-writeable pid and fifo directory
3225     mkdir -p /var/run/klogd
3226     chown klog:klog /var/run/klogd
3227     mkfifo -m 700 $kmsgpipe
3228     chown klog:klog $kmsgpipe
3229  
3230     # shovel /proc/kmsg to pipe readable by klogd user
3231     start-stop-daemon --start --pidfile $kmsgpidfile --exec /bin/dd -b -m -- bs=1 if=/proc/kmsg of=$kmsgpipe
3232  
3233     # start klogd as non-root with reading from kmsgpipe
3234     start-stop-daemon --start --quiet --chuid klog --exec $binpath -- $KLOGD
3235     log_end_msg $?
3236     ;;
3237   stop)
3238     log_begin_msg "Stopping kernel log daemon..."
3239     start-stop-daemon --stop --quiet --retry 3 --oknodo --exec $binpath --pidfile $pidfile
3240     # stop kmsgpipe
3241     start-stop-daemon --stop --quiet --oknodo --pidfile $kmsgpidfile
3242     rm -f $kmsgpidfile $kmsgpipe
3243     log_end_msg $?
3244     ;;
3245   restart|force-reload)
3246     $0 stop
3247     sleep 1
3248     $0 start
3249     ;;
3250   *)
3251     log_success_msg "Usage: /etc/init.d/klogd {start|stop|restart|force-reload}"
3252     exit 1
3253 esac
3254
3255 exit 0
3256 #!/bin/sh
3257 #
3258 # chkconfig: - 20 90
3259 # description: Starts and stops "laptop-mode" - tweaks system behavior
3260 #              to extend battery life.
3261 #
3262 # config:  /etc/laptop-mode/laptop-mode.conf
3263
3264 ### BEGIN INIT INFO
3265 # Provides:          laptop-mode
3266 # Should-Start:      $all
3267 # Required-Start:    $local_fs
3268 # Required-Stop:     $local_fs
3269 # Default-Start:     2 3 4 5
3270 # Default-Stop:      0 1 6
3271 # Short-Description: Enable laptop-mode-tools power management functions
3272 # Description:       Enable laptop-mode-tools power management functions
3273 ### END INIT INFO
3274
3275
3276 test -f /usr/sbin/laptop_mode || exit 0
3277
3278 . /lib/lsb/init-functions
3279 TEMPFILE=`mktemp`
3280
3281 if [ -f /etc/default/laptop-mode ]; then
3282         . /etc/default/laptop-mode;
3283 fi
3284 if [ -f /etc/default/acpi-support ]; then
3285         . /etc/default/acpi-support;
3286 fi
3287
3288 if [ x$ENABLE_LAPTOP_MODE = xfalse ]; then
3289         exit 0;
3290 fi
3291
3292 # Enable laptop mode when the system is booted when running on battery.
3293
3294 case $1 in
3295   start)
3296     log_action_begin_msg "Enabling laptop mode"
3297     mkdir -p /var/run/laptop-mode-tools
3298     touch /var/run/laptop-mode-tools/enabled
3299     /usr/sbin/laptop_mode init auto > $TEMPFILE
3300     log_action_end_msg $? "$( cat $TEMPFILE )"
3301     ;;
3302
3303   restart|reload|force-reload)
3304     # Full restart: first stop laptop mode completely (to restore default mount options etc.)
3305     log_action_begin_msg "Disabling laptop mode"
3306     mkdir -p /var/run/laptop-mode-tools
3307     rm -f /var/run/laptop-mode-tools/enabled
3308     /usr/sbin/laptop_mode init stop > $TEMPFILE
3309     log_action_end_msg $? "$( cat $TEMPFILE )"
3310
3311     # Now remove files containing stored status, re-enable, and start it up again.
3312     log_action_begin_msg "Enabling laptop mode"
3313     rm -f /var/run/laptop-mode-tools/*\r
3314     touch /var/run/laptop-mode-tools/enabled
3315     /usr/sbin/laptop_mode init auto force > $TEMPFILE
3316     log_action_end_msg $? "$( cat $TEMPFILE )"
3317     ;;
3318
3319   stop)
3320     log_action_begin_msg "Disabling laptop mode"
3321     rm -f /var/run/laptop-mode-tools/enabled
3322     /usr/sbin/laptop_mode init stop > $TEMPFILE
3323     log_action_end_msg $? "$( cat $TEMPFILE )"
3324     ;;
3325
3326   status)
3327     echo "Laptop mode status:"
3328     echo
3329     /usr/sbin/laptop_mode status
3330     ;;
3331     
3332   *)
3333     echo "Usage: $0 {stop|start|restart|reload|force-reload|status}" >&2
3334     exit 2
3335     ;;
3336 esac
3337
3338 if [ -f $TEMPFILE ] ; then
3339         rm $TEMPFILE
3340 fi
3341
3342 exit 0
3343 #!/bin/sh
3344 ### BEGIN INIT INFO
3345 # Provides:          libpam-foreground-clean
3346 # Required-Start:    $local_fs $remote_fs
3347 # Required-Stop:
3348 # Default-Start:     S
3349 # Default-Stop:
3350 # Short-Description: Clean old status files during boot.
3351 ### END INIT INFO
3352
3353 set -e
3354
3355 . /lib/lsb/init-functions
3356 PATH=/sbin:/bin
3357
3358 STATEDIR=/var/run/console
3359
3360 case "$1" in
3361   start)
3362     if [ -d $STATEDIR ]; then
3363       log_begin_msg "Cleaning up $STATEDIR/..."
3364       rm -f $STATEDIR/*
3365       log_end_msg 0
3366     fi
3367     exit 0
3368     ;;
3369
3370   stop|restart|force-reload)
3371     exit 0
3372     ;;
3373
3374   *)
3375     echo "Usage: $0 {start|stop|restart|force-reload}" >&2
3376     exit 3
3377     ;;
3378 esac
3379 #!/bin/sh -e
3380 #
3381 # loopback - brings up the loopback (127.0.0.1) network device so that
3382 #            DHCP and other such things will work
3383 #
3384
3385 # Check the package is still installed
3386 [ -x /sbin/ifup ] || exit 0
3387
3388 # Get LSB functions
3389 . /lib/lsb/init-functions
3390 . /etc/default/rcS
3391
3392 case "$1" in
3393     start)
3394         [ -d /var/run/network ] || mkdir /var/run/network
3395
3396         log_begin_msg "Starting basic networking..."
3397         if ifup --allow auto lo; then
3398             log_end_msg 0
3399         else
3400             log_end_msg $?
3401         fi
3402         ;;
3403     stop)
3404         log_begin_msg "Stopping basic networking..."
3405         if ifdown lo; then
3406             log_end_msg 0
3407         else
3408             log_end_msg $?
3409         fi
3410         ;;
3411     restart|force-reload)
3412         exit 0
3413         ;;
3414     *)
3415         echo "Usage: /etc/init.d/loopback {start|stop|restart|force-reload}"
3416         exit 1
3417         ;;
3418 esac
3419
3420 exit 0
3421 #! /bin/sh
3422
3423 N=/etc/init.d/makedev
3424 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
3425
3426 set -e
3427
3428 case "$1" in
3429   start)
3430         test -L /dev/MAKEDEV || ln -fs /sbin/MAKEDEV /dev/MAKEDEV
3431
3432         # create dvb-devices, if the dvb-directory allready exists, and 
3433         # no devfs or udev is in use (workaround for the changed major-number
3434         # of the dvb-devices, introduced in kernel 2.6.8, to be able to 
3435         # switch between kernels <= 2.6.7 and >= 2.6.8, without manual 
3436         # recreation of the devices (MAKEDEV dvb checks the kernel-version 
3437         # and uses the correct major-number))
3438         
3439         if [ ! -e /dev/.devfsd -a ! -e /dev/.udevdb ]; then
3440                 if [ -d /dev/dvb ]; then
3441                         cd /dev && ./MAKEDEV dvb
3442                 fi
3443         fi
3444         
3445         ;;
3446   stop|reload|restart|force-reload)
3447         ;;
3448   *)
3449         echo "Usage: $N {start|stop|restart|force-reload}" >&2
3450         exit 1
3451         ;;
3452 esac
3453
3454 exit 0
3455 #!/bin/sh
3456 #
3457 # Start the RAID monitor daemon for all active md arrays if desired.
3458 #
3459 # Copyright (c) 2001-2004 Mario Jou/3en <joussen@debian.org>
3460 # Distributable under the terms of the GNU GPL version 2.
3461
3462 MDADM=/sbin/mdadm
3463 DEBIANCONFIG=/etc/default/mdadm
3464 PIDFILE=/var/run/mdadm.pid
3465
3466 test -x $MDADM || exit 0
3467
3468 . /lib/lsb/init-functions
3469
3470 MAIL_TO=root
3471 START_DAEMON=true
3472 test -f $DEBIANCONFIG && . $DEBIANCONFIG
3473
3474 case "$1" in
3475     start)
3476         if [ "x$START_DAEMON" = "xtrue" ] ; then
3477             log_begin_msg "Starting RAID monitoring services..."
3478             start-stop-daemon -S -q -p $PIDFILE -x $MDADM -- -F -i $PIDFILE -m $MAIL_TO -f -s
3479             log_end_msg $?
3480         fi
3481         ;;
3482     stop)
3483         if [ -f $PIDFILE ] ; then
3484             log_begin_msg "Stopping RAID monitoring services..."
3485             start-stop-daemon -K -q -p $PIDFILE -x $MDADM
3486             log_end_msg $?
3487             rm -f $PIDFILE
3488         fi
3489         ;;
3490     restart|reload|force-reload)
3491         $0 stop
3492         $0 start
3493         ;;
3494     *)
3495         log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
3496         exit 1
3497         ;;
3498 esac
3499
3500 exit 0
3501 #!/bin/sh
3502 #
3503 # Start any arrays which are described in /etc/mdadm/mdadm.conf and which are
3504 # not running already.
3505 #
3506 # Copyright (c) 2001-2004 Mario Jou/3en <joussen@debian.org>
3507 # Distributable under the terms of the GNU GPL version 2.
3508
3509 MDADM=/sbin/mdadm
3510 MDRUN=/sbin/mdrun
3511 CONFIG=/etc/mdadm/mdadm.conf
3512 DEBIANCONFIG=/etc/default/mdadm
3513
3514 . /lib/lsb/init-functions
3515
3516 test -x $MDADM || exit 0
3517
3518 AUTOSTART=true
3519 test -f $DEBIANCONFIG && . $DEBIANCONFIG
3520
3521 case "$1" in
3522     start)
3523         if [ "x$AUTOSTART" = "xtrue" ] ; then
3524             if [ ! -f /proc/mdstat ] && [ -x /sbin/modprobe ] ; then
3525                 /sbin/modprobe -k md > /dev/null 2>&1  
3526             fi
3527             test -f /proc/mdstat || exit 0
3528             log_begin_msg "Starting RAID devices..."
3529             if [ -f $CONFIG ] && [ -x $MDADM ] ; then
3530                 $MDADM -A -s
3531             elif [ -x $MDRUN ] ; then
3532                 $MDRUN
3533             fi
3534             log_end_msg $?
3535         fi
3536         ;;
3537     stop|restart|reload|force-reload)
3538         ;;
3539     *)
3540         log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
3541         exit 1
3542         ;;
3543 esac
3544
3545 exit 0
3546 #!/bin/sh -e
3547 ### BEGIN INIT INFO
3548 # Provides:          module-init-tools
3549 # Required-Start:    
3550 # Required-Stop:     
3551 # Should-Start:      checkroot
3552 # Should-stop:
3553 # Default-Start:     S
3554 # Default-Stop:
3555 # Short-Description: Process /etc/modules.
3556 # Description:       Load the modules listed in /etc/modules.
3557 ### END INIT INFO
3558
3559 # Silently exit if the kernel does not support modules or needs modutils.
3560 [ -f /proc/modules ] || exit 0
3561 [ ! -f /proc/ksyms ] || exit 0
3562 [ -x /sbin/modprobe  ] || exit 0
3563
3564 . /etc/default/rcS
3565 . /lib/lsb/init-functions
3566
3567 PATH="/sbin:/bin"
3568
3569 KVER=$(uname -r)
3570 KMAJ=${KVER%${KVER#*.*[^.]}}
3571 KMAJ=${KMAJ%.}
3572
3573 if [ -e /etc/modules-$KVER ]; then
3574   MODULES_FILE=/etc/modules-$KVER
3575 elif [ -e /etc/modules-$KMAJ ]; then
3576   MODULES_FILE=/etc/modules-$KMAJ
3577 else
3578   MODULES_FILE=/etc/modules
3579 fi
3580
3581 load_module() {
3582   local module args
3583   module="$1"
3584   args="$2"
3585
3586   if [ "$VERBOSE" != no ]; then
3587     log_action_msg "Loading kernel module $module"
3588     modprobe $module $args || true
3589   else
3590     modprobe $module $args > /dev/null 2>&1 || true
3591   fi    
3592 }
3593
3594 if [ "$VERBOSE" = no ]; then
3595   log_action_begin_msg 'Loading kernel modules'
3596 fi
3597
3598 # Loop over every line in /etc/modules.
3599 log_begin_msg 'Loading manual drivers...'
3600 grep '^[^#]' $MODULES_FILE | \
3601 while read module args; do
3602   [ "$module" ] || continue
3603   load_module "$module" "$args"
3604 done
3605
3606 if [ "$VERBOSE" = no ]; then 
3607   log_action_end_msg 0
3608 fi
3609
3610 exit 0
3611 #! /bin/sh
3612 ### BEGIN INIT INFO
3613 # Provides:          mountall-bootclean
3614 # Required-Start:    mountall
3615 # Required-Stop:
3616 # Default-Start:     S
3617 # Default-Stop:
3618 # Short-Description: bootclean after mountall.
3619 # Description:       Clean temporary filesystems after
3620 #                    all local filesystems have been mounted.
3621 ### END INIT INFO
3622
3623 case "$1" in
3624   start|"")
3625         # Clean /tmp
3626         /etc/init.d/bootclean
3627         ;;
3628   restart|reload|force-reload)
3629         echo "Error: argument '$1' not supported" >&2
3630         exit 3
3631         ;;
3632   stop)
3633         # No-op
3634         ;;
3635   *)
3636         echo "Usage: mountall-bootclean.sh [start|stop]" >&2
3637         exit 3
3638         ;;
3639 esac
3640
3641 :
3642 #! /bin/sh
3643 ### BEGIN INIT INFO
3644 # Provides:          mountall
3645 # Required-Start:    checkfs
3646 # Required-Stop: 
3647 # Should-Start:      lvm
3648 # Should-Stop:
3649 # Default-Start:     S
3650 # Default-Stop:
3651 # Short-Description: Mount all filesystems.
3652 # Description:
3653 ### END INIT INFO
3654
3655 PATH=/sbin:/bin
3656 . /lib/init/vars.sh
3657
3658 . /lib/lsb/init-functions
3659 . /lib/init/mount-functions.sh
3660
3661 if [ -r /etc/default/locale ]; then
3662         . /etc/default/locale
3663         export LANG
3664 fi
3665
3666 do_start() {
3667         #
3668         # Mount local file systems in /etc/fstab.
3669         #
3670         pre_mountall
3671         if [ "$VERBOSE" = no ]
3672         then
3673                 log_action_begin_msg "Mounting local filesystems"
3674                 mount -a -t proc >/dev/null 2>&1  # Ignore error message due to /proc already being mounted
3675                 ES_TO_REPORT=$?
3676                 mount -a -t noproc,nfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs
3677                 ES=$?
3678                 ES_TO_REPORT=$(($ES_TO_REPORT | $ES))
3679                 if [ 0 = "$ES_TO_REPORT" ]
3680                 then
3681                         log_action_end_msg 0
3682                 else
3683                         log_action_end_msg 1 "code $ES_TO_REPORT"
3684                 fi
3685         else
3686                 log_action_msg "Will now mount local filesystems"
3687                 mount -a -t proc >/dev/null 2>&1  # Ignore error message due to /proc already being mounted
3688                 ES=$?
3689                 [ 0 = "$ES" ] || log_failure_msg "Mounting proc filesystems failed with error code ${ES}."
3690                 mount -a -v -t noproc,nfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs
3691                 ES=$?
3692                 if [ 0 = "$ES" ]
3693                 then
3694                         log_success_msg "Done mounting local filesystems."
3695                 else
3696                         log_failure_msg "Mounting local filesystems failed with error code ${ES}."
3697                 fi
3698         fi
3699
3700         post_mountall
3701
3702         case "$(uname -s)" in
3703           *FreeBSD)
3704                 INITCTL=/etc/.initctl
3705                 ;;
3706           *)
3707                 INITCTL=/dev/initctl
3708                 ;;
3709         esac
3710
3711         #
3712         # We might have mounted something over /dev, see if
3713         # /dev/initctl is there.
3714         #
3715         if [ ! -p $INITCTL ]
3716         then
3717                 rm -f $INITCTL
3718                 mknod -m 600 $INITCTL p
3719         fi
3720         kill -USR1 1
3721
3722         #
3723         # Execute swapon command again, in case we want to swap to
3724         # a file on a now mounted filesystem.
3725         #
3726         # Ignore 255 status due to swap already being enabled
3727         #
3728         if [ "$VERBOSE" = no ]
3729         then
3730                 log_action_begin_msg "Activating swapfile swap"
3731                 swapon -a -e 2>/dev/null || :  # Stifle "Device or resource busy"
3732                 log_action_end_msg 0
3733         else
3734                 log_action_msg "Will now activate swapfile swap"
3735                 swapon -a -e -v || :
3736                 log_success_msg "Done activating swapfile swap."
3737         fi
3738 }
3739
3740 case "$1" in
3741   start|"")
3742         do_start
3743         ;;
3744   restart|reload|force-reload)
3745         echo "Error: argument '$1' not supported" >&2
3746         exit 3
3747         ;;
3748   stop)
3749         # No-op
3750         ;;
3751   *)
3752         echo "Usage: mountall.sh [start|stop]" >&2
3753         exit 3
3754         ;;
3755 esac
3756
3757 :
3758 #! /bin/sh
3759 ### BEGIN INIT INFO
3760 # Provides:          mountdevsubfs mountvirtfs
3761 # Required-Start:    mountkernfs
3762 # Required-Stop:
3763 # Default-Start:     S
3764 # Default-Stop:
3765 # Short-Description: Mount special file systems under /dev.
3766 # Description:       Mount the virtual filesystems the kernel provides
3767 #                    that ordinarily live under the /dev filesystem.
3768 ### END INIT INFO
3769
3770 PATH=/lib/init:/sbin:/bin
3771 TTYGRP=5
3772 TTYMODE=620
3773 [ -f /etc/default/devpts ] && . /etc/default/devpts
3774
3775 TMPFS_SIZE=
3776 [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
3777
3778 KERNEL="$(uname -s)"
3779
3780 . /lib/lsb/init-functions
3781 . /lib/init/mount-functions.sh
3782
3783 do_start () {
3784         #
3785         # Mount a tmpfs on /dev/shm
3786         #
3787         SHM_OPT=
3788         [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT="-osize=$SHM_SIZE"
3789         domount tmpfs shmfs /dev/shm $SHM_OPT
3790
3791         #
3792         # Mount /dev/pts. Create master ptmx node if needed.
3793         #
3794         domount devpts "" /dev/pts -ogid=$TTYGRP,mode=$TTYMODE
3795
3796         #
3797         # Magic to make /proc/bus/usb work
3798         #
3799         #mkdir -p /dev/bus/usb/.usbfs
3800         #domount usbfs "" /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
3801         #ln -s .usbfs/devices /dev/bus/usb/devices
3802         #mount --rbind /dev/bus/usb /proc/bus/usb
3803 }
3804
3805 case "$1" in
3806   "")
3807         echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2
3808         do_start
3809         ;;
3810   start)
3811         do_start
3812         ;;
3813   restart|reload|force-reload)
3814         echo "Error: argument '$1' not supported" >&2
3815         exit 3
3816         ;;
3817   stop)
3818         # No-op
3819         ;;
3820   *)
3821         echo "Usage: mountdevsubfs [start|stop]" >&2
3822         exit 3
3823         ;;
3824 esac
3825 #! /bin/sh
3826 ### BEGIN INIT INFO
3827 # Provides:          mountkernfs
3828 # Required-Start:
3829 # Required-Stop:
3830 # Default-Start:     S
3831 # Default-Stop:
3832 # Short-Description: Mount kernel virtual file systems.
3833 # Description:       Mount initial set of virtual filesystems the kernel
3834 #                    provides and that are required by everything.
3835 ### END INIT INFO
3836
3837 PATH=/lib/init:/sbin:/bin
3838
3839 . /lib/lsb/init-functions
3840 . /lib/init/mount-functions.sh
3841
3842 do_start () {
3843         #
3844         # Mount proc filesystem on /proc
3845         #
3846         domount proc "" /proc -onodev,noexec,nosuid
3847
3848         #
3849         # Mount sysfs on /sys
3850         #
3851         domount sysfs "" /sys -onodev,noexec,nosuid
3852
3853         # Mount /var/run and /var/lock as tmpfs.
3854         domount tmpfs "" /var/run -omode=0755,nodev,noexec,nosuid
3855         domount tmpfs "" /var/lock -omode=1777,nodev,noexec,nosuid
3856
3857         # Mount spufs, if Cell Broadband processor is detected
3858         if mountpoint -q /proc && grep -qs '^cpu.*Cell' /proc/cpuinfo; then
3859                 mkdir -p /spu
3860                 domount spufs "" /spu -ogid=spu
3861         fi
3862
3863         # Propagate files from the initramfs to our new /var/run.
3864         for file in /dev/.initramfs/varrun/*; do
3865                 [ -e "$file" ] || continue
3866                 cp -a "$file" "/var/run/${x#/dev/.initramfs/varrun/}"
3867         done
3868
3869         if [ ! -d /var/run/sendsigs.omit.d/ ]; then
3870                 mkdir /var/run/sendsigs.omit.d/
3871         fi
3872 }
3873
3874 case "$1" in
3875   "")
3876         echo "Warning: mountvirtfs should be called with the 'start' argument." >&2
3877         do_start
3878         ;;
3879   start)
3880         do_start
3881         ;;
3882   restart|reload|force-reload)
3883         echo "Error: argument '$1' not supported" >&2
3884         exit 3
3885         ;;
3886   stop)
3887         # No-op
3888         ;;
3889   *)
3890         echo "Usage: mountvirtfs [start|stop]" >&2
3891         exit 3
3892         ;;
3893 esac
3894 #! /bin/sh
3895 ### BEGIN INIT INFO
3896 # Provides:          mountnfs-bootclean
3897 # Required-Start:    mountnfs
3898 # Required-Stop:
3899 # Default-Start:     S
3900 # Default-Stop:
3901 # Short-Description: bootclean after mountnfs.
3902 # Description:       Clean temporary filesystems after
3903 #                    network filesystems have been mounted.
3904 ### END INIT INFO
3905
3906 case "$1" in
3907   start|"")
3908         # Clean /tmp
3909         /etc/init.d/bootclean
3910         ;;
3911   restart|reload|force-reload)
3912         echo "Error: argument '$1' not supported" >&2
3913         exit 3
3914         ;;
3915   stop)
3916         # No-op
3917         ;;
3918   *)
3919         echo "Usage: mountnfs-bootclean.sh [start|stop]" >&2
3920         exit 3
3921         ;;
3922 esac
3923
3924 :
3925 #! /bin/sh
3926 ### BEGIN INIT INFO
3927 # Provides:          mountoverflowtmp
3928 # Required-Start:    mountall-bootclean
3929 # Required-Stop:
3930 # Default-Start:     S
3931 # Default-Stop:
3932 # Short-Description: mount emergency /tmp.
3933 # Description:       Mount a tmpfs on /tmp if there would
3934 #                    otherwise be too little space to log in.
3935 ### END INIT INFO
3936
3937 . /lib/lsb/init-functions
3938
3939 set -e
3940
3941 defs=/etc/default/mountoverflowtmp
3942 test ! -f "$defs" || . "$defs"
3943
3944 : ${MINTMPKB:=1024}
3945 if test "$MINTMPKB" = "0"; then exit 0; fi
3946
3947 case "$1" in
3948   start|"")
3949         log_action_begin_msg "Checking minimum space in /tmp"
3950         df="`df -kP /tmp`"
3951         avail="`printf "%s" "$df" | awk 'NR==2 { print $4 }'`"
3952         log_action_end_msg 0
3953         if test $avail -lt "$MINTMPKB"; then
3954                 log_action_begin_msg "Mounting emergency tmpfs on /tmp"
3955                 mount -t tmpfs -o size=1048576,mode=1777 overflow /tmp
3956                 log_action_end_msg 0
3957         fi
3958         ;;
3959   restart|reload|force-reload)
3960         echo "Error: argument '$1' not supported" >&2
3961         exit 3
3962         ;;
3963   stop)
3964         log_action_begin_msg "Unmounting any overflow tmpfs from /tmp"
3965         if LANG=C LC_ALL=C mount | \
3966                 grep '^overflow on /tmp type tmpfs' >/dev/null; then
3967                 umount overflow
3968         fi
3969         log_action_end_msg 0
3970         ;;
3971   *)
3972         echo "Usage: mountoverflowtmp [start|stop]" >&2
3973         exit 3
3974         ;;
3975 esac
3976
3977 :
3978 #! /bin/sh
3979 ### BEGIN INIT INFO
3980 # Provides:          mtab
3981 # Required-Start:    mountall
3982 # Required-Stop:
3983 # Default-Start:     S
3984 # Default-Stop:
3985 # Short-Description: Update mtab file.
3986 # Description:       Update the mount program's mtab file after
3987 #                    all local filesystems have been mounted.
3988 ### END INIT INFO
3989
3990 PATH=/lib/init:/sbin:/bin
3991 TTYGRP=5
3992 TTYMODE=620
3993 [ -f /etc/default/devpts ] && . /etc/default/devpts
3994
3995 TMPFS_SIZE=
3996 [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
3997
3998 KERNEL="$(uname -s)"
3999
4000 . /lib/lsb/init-functions
4001 . /lib/init/mount-functions.sh
4002
4003 domtab ()
4004 {
4005         # Directory present?
4006         if [ ! -d $2 ]
4007         then
4008                 return
4009         fi
4010
4011         # Not mounted?
4012         if ! mountpoint -q $2
4013         then
4014                 return
4015         fi
4016
4017         if [ -n "$3" ]
4018         then
4019                 NAME="$3"
4020         else
4021                 NAME="$1"
4022         fi
4023
4024         # Already recorded?
4025         if ! grep -E -sq "^([^ ]+) +$2 +" /etc/mtab
4026         then
4027                 mount -f -t $1 $OPTS $4 $NAME $2
4028         fi
4029 }
4030
4031 do_start () {
4032         DO_MTAB=""
4033         MTAB_PATH="$(readlink -f /etc/mtab || :)"
4034         case "$MTAB_PATH" in
4035           /proc/*)
4036                 # Assume that /proc/ is not writable
4037                 ;;
4038           /*)
4039                 # Only update mtab if it is known to be writable
4040                 # Note that the touch program is in /usr/bin
4041                 #if ! touch "$MTAB_PATH" >/dev/null 2>&1
4042                 #then
4043                 #       return
4044                 #fi
4045                 ;;
4046           "")
4047                 [ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
4048                 if [ "$MTAB_PATH" ]
4049                 then
4050                         log_failure_msg "Cannot initialize ${MTAB_PATH}."
4051                 else
4052                         log_failure_msg "Cannot initialize /etc/mtab."
4053                 fi
4054                 ;;
4055           *)
4056                 log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
4057                 ;;
4058         esac
4059
4060         #
4061         # Initialize mtab file if necessary
4062         #
4063         if [ ! -f /etc/mtab ]
4064         then
4065                 :> /etc/mtab
4066                 chmod 644 /etc/mtab
4067         fi
4068         if selinux_enabled && which restorecon >/dev/null 2>&1 && [ -r /etc/mtab ]
4069         then
4070                 restorecon /etc/mtab
4071         fi
4072
4073         # S01mountkernfs.sh
4074         domtab proc /proc "proc" -onodev,noexec,nosuid
4075         domtab sysfs /sys "sys" -onodev,noexec,nosuid
4076         domtab tmpfs /var/run "varrun" -omode=0755,nodev,noexec,nosuid
4077         domtab tmpfs /var/lock "varlock" -omode=1777,nodev,noexec,nosuid
4078         domtab usbfs /proc/bus/usb "procbususb"
4079
4080         # S10udev
4081         domtab tmpfs /dev "udev" -omode=0755
4082
4083         # S02mountdevsubfs
4084         SHM_OPT=
4085         [ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT="-osize=$SHM_SIZE"
4086         domtab tmpfs /dev/shm "devshm" $SHM_OPT
4087         domtab devpts /dev/pts "devpts" -ogid=$TTYGRP,mode=$TTYMODE
4088
4089         # S07linux-restricted-modules-common
4090         exec 9<&0 0</proc/mounts
4091         while read FDEV FDIR FTYPE FOPTS REST
4092         do
4093                 case "$FDIR" in
4094                         /lib/modules/*/volatile)
4095                                 domtab "$FTYPE" "$FDIR" "lrm"
4096                                 ;;
4097                 esac
4098         done
4099         exec 0<&9 9<&-
4100
4101         # /etc/network/if-up.d/mountnfs
4102         exec 9<&0 </etc/fstab
4103         while read FDEV FDIR FTYPE FOPTS REST
4104         do
4105                 case "$FDEV" in
4106                   ""|\#*)
4107                         continue
4108                         ;;
4109                 esac
4110                 case "$FOPTS" in
4111                   noauto|*,noauto|noauto,*|*,noauto,*)
4112                         continue
4113                         ;;
4114                 esac
4115                 case "$FTYPE" in
4116                   nfs|nfs4|smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs)
4117                         domtab "$FTYPE" "$FDIR" "$FDEV" "-o$FOPTS"
4118                         ;;
4119                   *)
4120                         continue
4121                         ;;
4122                 esac
4123         done
4124         exec 0<&9 9<&-
4125
4126         
4127 }
4128
4129 case "$1" in
4130   start|"")
4131         do_start
4132         ;;
4133   restart|reload|force-reload)
4134         echo "Error: argument '$1' not supported" >&2
4135         exit 3
4136         ;;
4137   stop)
4138         # No-op
4139         ;;
4140   *)
4141         echo "Usage: mountall-mtab.sh [start|stop]" >&2
4142         exit 3
4143         ;;
4144 esac
4145
4146 :
4147 #!/bin/bash
4148 #
4149 # MySQL daemon start/stop script.
4150 #
4151 # Debian version. Based on the original by TcX.
4152 #
4153 set -e
4154 set -u
4155 ${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
4156
4157 test -x /usr/sbin/mysqld || exit 0
4158
4159 SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
4160 CONF=/etc/mysql/my.cnf
4161 MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
4162
4163 # priority can be overriden and "-s" adds output to stderr
4164 ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
4165
4166 # Safeguard (relative paths, core dumps..)
4167 cd /
4168 umask 077
4169
4170 # mysqladmin likes to read /root/.my.cnf. This is usually not what I want
4171 # as many admins e.g. only store a password without a username there and
4172 # so break my scripts.
4173 export HOME=/etc/mysql/
4174
4175 ## fetch a particular option from mysql's invocation
4176 #
4177 # usage: void mysqld_get_param option
4178 mysqld_get_param() {
4179         /usr/sbin/mysqld --print-defaults \
4180                 | tr " " "\n" \
4181                 | grep -- "--$1" \
4182                 | tail -n 1 \
4183                 | cut -d= -f2
4184 }
4185
4186 ## Checks if there is a server running and if so if it is accessible.
4187 #
4188 # check_alive insists on a pingable server
4189 # check_dead also fails if there is a lost mysqld in the process list
4190 #
4191 # Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
4192 mysqld_status () {
4193     ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
4194
4195     ps_alive=0
4196     pidfile=`mysqld_get_param pid-file`
4197     if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
4198     
4199     if [ "$1" = "check_alive"  -a  $ping_alive = 1 ] ||
4200        [ "$1" = "check_dead"   -a  $ping_alive = 0  -a  $ps_alive = 0 ]; then
4201         return 0 # EXIT_SUCCESS
4202     else
4203         if [ "$2" = "warn" ]; then
4204             /bin/echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
4205         fi
4206         return 1 # EXIT_FAILURE
4207     fi
4208 }
4209
4210 #
4211 # main()
4212 #
4213
4214 case "${1:-''}" in
4215   'start')
4216         # check for config file
4217         if [ ! -r /etc/mysql/my.cnf ]; then
4218           /bin/echo -e "\nWARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
4219         fi 
4220         # Start daemon
4221         echo -n "Starting MySQL database server: mysqld"
4222         if mysqld_status check_alive nowarn; then
4223            echo "...already running."
4224         else
4225             /usr/bin/mysqld_safe > /dev/null 2>&1 &
4226             for i in 1 2 3 4 5 6; do
4227                 sleep 1
4228                 if mysqld_status check_alive nowarn ; then break; fi
4229             done
4230             if mysqld_status check_alive warn; then
4231                 echo "."
4232                 # Now start mysqlcheck or whatever the admin wants.
4233                 /etc/mysql/debian-start
4234             else
4235                 echo "...failed."
4236                 /bin/echo -e "\tPlease take a look at the syslog."
4237             fi
4238         fi
4239
4240         if $MYADMIN variables | egrep -q have_bdb.*YES; then
4241             /bin/echo "BerkeleyDB is obsolete, see /usr/share/doc/mysql-server-4.1/README.Debian.gz" | $ERR_LOGGER -p daemon.info
4242         fi
4243         ;;
4244
4245   'stop')
4246         # * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
4247         # at least for cron, we can rely on it here, too. (although we have 
4248         # to specify it explicit as e.g. sudo environments points to the normal
4249         # users home and not /root)
4250         echo -n "Stopping MySQL database server: mysqld"        
4251         if ! mysqld_status check_dead nowarn; then
4252           set +e
4253           shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
4254           set -e
4255           if [ "$r" -ne 0 ]; then
4256             /bin/echo -e -n "...failed.\n$shutdown_out\nKilling MySQL database server by signal: mysqld"
4257             killall -15 mysqld
4258             server_down=
4259             for i in 1 2 3 4 5 6 7 8 9 10; do
4260               sleep 1
4261               if mysqld_status check_dead nowarn; then server_down=1; break; fi
4262             done
4263           if test -z "$server_down"; then killall -9 mysqld; fi
4264           fi
4265         fi
4266
4267         if ! mysqld_status check_dead warn; then
4268           echo "...failed."
4269           echo "Please stop MySQL manually and read /usr/share/doc/mysql-server-4.1/README.Debian.gz!"
4270           exit -1
4271         else
4272           echo "."
4273         fi
4274         ;;
4275
4276   'restart')
4277         set +e; $SELF stop; set -e
4278         $SELF start 
4279         ;;
4280
4281   'reload'|'force-reload')
4282         echo -n "Reloading MySQL database server: mysqld"
4283         $MYADMIN reload
4284         echo "."
4285         ;;
4286
4287   'status')
4288         if mysqld_status check_alive nowarn; then
4289           $MYADMIN version
4290         else
4291           echo "MySQL is stopped."
4292           exit 3
4293         fi
4294         ;;
4295
4296   *)
4297         echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
4298         exit 1
4299         ;;
4300 esac
4301
4302 #!/bin/bash
4303 #
4304 # MySQL NDB management daemon start/stop script.
4305 #
4306 set -e
4307 set -u
4308 ${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
4309
4310 # Variables
4311 SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
4312 DAEMON=/usr/sbin/ndbd
4313 CONF=/etc/mysql/my.cnf
4314 export HOME=/etc/mysql/
4315
4316 # Safeguard (relative paths, core dumps..)
4317 cd /
4318 umask 077
4319
4320 # Exit *silently* if we're not supposed to be started.
4321 #
4322 # The Debian scripts should execute these scripts to stop and start
4323 # the daemon when upgrading if it is started. On the other hand it should
4324 # remain silently if the server has not even been configured.
4325 # See /usr/share/doc/mysql-server-*/README.Debian for more information.
4326 test -x $DAEMON || exit 0
4327 if $DAEMON --help | grep -q '^ndb-connectstring.*No default value'; then exit 0; fi
4328
4329 #
4330 # main()
4331 #
4332 case "${1:-''}" in
4333   'start')
4334         # Start daemon
4335         # Creatign a PID file does not work as the master process forks
4336         # a child with different PID and then terminates itself.
4337         echo -n "Starting MySQL NDB cluster server: ndbd"
4338         if start-stop-daemon \
4339                 --start \
4340                 --exec $DAEMON \
4341                 --user mysql
4342         then
4343           echo "."
4344         else
4345           echo "...failed."
4346           /bin/echo -e "\tPlease take a look at the syslog."
4347           exit 1
4348         fi                        
4349         ;;
4350
4351   'stop')
4352         echo -n "Stopping MySQL NDB cluster management server: ndbd"    
4353         if start-stop-daemon \
4354                 --stop \
4355                 --oknodo \
4356                 --exec $DAEMON
4357         then
4358           echo "."
4359         else
4360           echo "...failed."
4361           exit 1
4362         fi
4363         ;;
4364
4365   'restart'|'force-reload')
4366         set +e; $SELF stop; set -e
4367         $SELF start 
4368         ;;
4369
4370   *)
4371         echo "Usage: $SELF start|stop|restart|force-reload"
4372         exit 1
4373         ;;
4374 esac
4375
4376 #!/bin/bash
4377 #
4378 # MySQL NDB management daemon start/stop script.
4379 #
4380 set -e
4381 set -u
4382 ${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
4383
4384 # Variables
4385 SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
4386 DAEMON=/usr/sbin/ndb_mgmd
4387 CONF=/etc/mysql/ndb_mgmd.cnf
4388 export HOME=/etc/mysql/
4389
4390 # Safeguard (relative paths, core dumps..)
4391 cd /
4392 umask 077
4393
4394 # Exit *silently* if we're not supposed to be started.
4395 #
4396 # The Debian scripts should execute these scripts to stop and start
4397 # the daemon when upgrading if it is started. On the other hand it should
4398 # remain silently if the server has not even been configured.
4399 # See /usr/share/doc/mysql-server-*/README.Debian for more information.
4400 test -x $DAEMON || exit 0
4401 test -r $CONF || exit 0
4402
4403 #
4404 # main()
4405 #
4406 case "${1:-''}" in
4407   'start')
4408         # Start daemon
4409         echo -n "Starting MySQL NDB cluster management server: ndb_mgmd"
4410         # --pid-file does not work as the daemon forks itself with $PID=$PID+1
4411         if start-stop-daemon \
4412                 --start \
4413                 --exec $DAEMON \
4414                 --user mysql \
4415                 -- \
4416                 -f $CONF
4417         then
4418           echo "."
4419         else
4420           echo "...failed."
4421           /bin/echo -e "\tPlease take a look at the syslog."
4422           exit 1
4423         fi                        
4424         ;;
4425
4426   'stop')
4427         echo -n "Stopping MySQL NDB cluster management server: ndb_mgmd"        
4428         if start-stop-daemon \
4429                 --stop \
4430                 --oknodo \
4431                 --exec $DAEMON
4432         then
4433           echo "."
4434         else
4435           echo "...failed."
4436           exit 1
4437         fi
4438         ;;
4439
4440   'restart'|'force-reload')
4441         set +e; $SELF stop; set -e
4442         $SELF start 
4443         ;;
4444
4445   *)
4446         echo "Usage: $SELF start|stop|restart|force-reload"
4447         exit 1
4448         ;;
4449 esac
4450
4451 #!/bin/sh -e
4452 ### BEGIN INIT INFO
4453 # Provides:          networking
4454 # Required-Start:    mountkernfs ifupdown $local_fs
4455 # Required-Stop:     ifupdown $local_fs
4456 # Default-Start:     S
4457 # Default-Stop:      0 6
4458 # Short-Description: Raise network interfaces.
4459 ### END INIT INFO
4460
4461 PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
4462
4463 [ -x /sbin/ifup ] || exit 0
4464
4465 . /lib/lsb/init-functions
4466
4467
4468 case "$1" in
4469 start)
4470         log_action_begin_msg "Configuring network interfaces"
4471         type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 120" || true
4472         if [ "$VERBOSE" != no ]; then
4473             if ifup -a; then
4474                 log_action_end_msg $?
4475             else
4476                 log_action_end_msg $?
4477             fi
4478         else
4479             if ifup -a >/dev/null 2>&1; then
4480                 log_action_end_msg $?
4481             else
4482                 log_action_end_msg $?
4483             fi
4484         fi
4485         type usplash_write >/dev/null 2>/dev/null && usplash_write "TIMEOUT 15" || true
4486         ;;
4487
4488 stop)
4489         if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts | 
4490                 grep -qE '^(nfs[1234]?|smbfs|ncp|ncpfs|coda|cifs)$'; then
4491             log_warning_msg "not deconfiguring network interfaces: network shares still mounted."
4492             exit 0
4493         fi
4494
4495         log_action_begin_msg "Deconfiguring network interfaces"
4496         if [ "$VERBOSE" != no ]; then
4497             if ifdown -a --exclude=lo; then
4498                 log_action_end_msg $?
4499             else
4500                 log_action_end_msg $?
4501             fi
4502         else
4503             if ifdown -a --exclude=lo >/dev/null 2>/dev/null; then
4504                 log_action_end_msg $?
4505             else
4506                 log_action_end_msg $?
4507             fi
4508         fi
4509         ;;
4510
4511 force-reload|restart)
4512         log_action_begin_msg "Reconfiguring network interfaces"
4513         ifdown -a --exclude=lo || true
4514         if ifup -a --exclude=lo; then
4515             log_action_end_msg $?
4516         else
4517             log_action_end_msg $?
4518         fi
4519         ;;
4520
4521 *)
4522         echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
4523         exit 1
4524         ;;
4525 esac
4526
4527 exit 0
4528
4529 #!/bin/sh
4530 #
4531 # nfs-common    This shell script takes care of starting and stopping
4532 #               common daemons required for NFS clients and servers.
4533 #
4534 # chkconfig: 345 20 80
4535 # description: NFS is a popular protocol for file sharing across \
4536 #              TCP/IP networks. This service provides NFS file \
4537 #              locking functionality.
4538 #
4539
4540 set -e
4541
4542 # What is this?
4543 DESC="NFS common utilities"
4544
4545 # Read config
4546 DEFAULTFILE=/etc/default/nfs-common
4547 PREFIX=
4548 NEED_LOCKD=
4549 NEED_IDMAPD=yes
4550 IDMAPD_PIDFILE=/var/run/rpc.idmapd.pid
4551 NEED_GSSD=yes
4552 GSSD_PIDFILE=/var/run/rpc.gssd.pid
4553 PIPEFS_MOUNTPOINT=/var/lib/nfs/rpc_pipefs
4554 RPCGSSDOPTS=
4555 if [ -f $DEFAULTFILE ]; then
4556     . $DEFAULTFILE
4557 fi
4558
4559 . /lib/lsb/init-functions
4560
4561 # Determine whether lockd daemon is required.
4562 case "$NEED_LOCKD" in
4563 yes|no) ;;
4564 *)  case `uname -r` in
4565     '' | [01].* | 2.[0123].* )
4566         # Older kernels may or may not need a lockd daemon.
4567         # We must assume they do, unless we can prove otherwise.
4568         # (A false positive here results only in a harmless message.)
4569         NEED_LOCKD=yes
4570         if test -f /proc/ksyms
4571         then
4572             grep -q lockdctl /proc/ksyms || NEED_LOCKD=no
4573         fi
4574         ;;
4575
4576     *)  # Modern kernels (>= 2.4) start a lockd thread automatically.
4577         NEED_LOCKD=no
4578         ;;
4579     esac
4580     ;;
4581 esac
4582
4583 # Exit if required binaries are missing.
4584 [ -x $PREFIX/sbin/rpc.statd ] || exit 0
4585 [ -x $PREFIX/sbin/rpc.lockd ] || [ "$NEED_LOCKD"  = no ] || exit 0
4586 [ -x /usr/sbin/rpc.idmapd   ] || [ "$NEED_IDMAPD" = no ] || exit 0
4587 [ -x /usr/sbin/rpc.gssd     ] || [ "$NEED_GSSD"   = no ] || exit 0
4588
4589 do_modprobe() {
4590     modprobe -q "$1" || true
4591 }
4592
4593 do_mount() {
4594     if ! grep -E -qs "$1\$" /proc/filesystems
4595     then
4596         return 1
4597     fi
4598     if ! mountpoint -q "$2"
4599     then
4600         mount -t "$1" "$1" "$2"
4601         return
4602     fi
4603     return 0
4604 }
4605
4606 # See how we were called.
4607 case "$1" in
4608   start)
4609         cd /    # daemons should have root dir as cwd
4610         log_begin_msg "Starting nfs statd..."
4611         ERROR=0
4612         start-stop-daemon --start --quiet \
4613             --exec $PREFIX/sbin/rpc.statd -- $STATDOPTS || ERROR=1
4614         log_end_msg $ERROR
4615         if [ "$NEED_LOCKD" = yes ]
4616         then
4617             log_begin_msg "Starting nfs lockd..."
4618             ERROR=0
4619             start-stop-daemon --start --quiet \
4620                 --exec $PREFIX/sbin/rpc.lockd || ERROR=1
4621             log_end_msg $ERROR
4622         fi
4623         if [ "$NEED_IDMAPD" = yes ] || [ "$NEED_GSSD" = yes ]
4624         then
4625             do_modprobe nfs
4626             if do_mount rpc_pipefs $PIPEFS_MOUNTPOINT
4627             then
4628                 if [ "$NEED_IDMAPD" = yes ]
4629                 then
4630                     log_begin_msg "Starting rpc idmapd..."
4631                     ERROR=0
4632                     start-stop-daemon --start --quiet \
4633                             --make-pidfile --pidfile $IDMAPD_PIDFILE \
4634                             --exec /usr/sbin/rpc.idmapd || ERROR=1
4635                     log_end_msg $ERROR
4636                 fi
4637                 if [ "$NEED_GSSD" = yes ]
4638                 then
4639                     log_begin_msg "Starting rpc gssd..."
4640                     ERROR=0
4641                     start-stop-daemon --start --quiet \
4642                             --make-pidfile --pidfile $GSSD_PIDFILE \
4643                             --exec /usr/sbin/rpc.gssd -- $RPCGSSDOPTS || ERROR=1
4644                     log_end_msg $ERROR
4645                 fi
4646             fi
4647         fi
4648         ;;
4649
4650   stop)
4651         if [ "$NEED_GSSD" = yes ]
4652         then
4653             log_begin_msg "Stopping rpc gssd..."
4654             ERROR=0
4655             start-stop-daemon --stop --oknodo --quiet \
4656                     --name rpc.gssd --user 0 || ERROR=1
4657             log_end_msg $ERROR
4658             rm -f $GSSD_PIDFILE
4659         fi
4660         if [ "$NEED_IDMAPD" = yes ]
4661         then
4662             log_begin_msg "Stopping rpc idmapd..."
4663             ERROR=0
4664             start-stop-daemon --stop --oknodo --quiet \
4665                 --name rpc.idmapd --user 0 || ERROR=1
4666             log_end_msg $ERROR
4667             rm -f $IDMAPD_PIDFILE
4668         fi
4669         if [ "$NEED_LOCKD" = yes ]
4670         then
4671             log_begin_msg "Stopping nfs lockd..."
4672             ERROR=0
4673             start-stop-daemon --stop --oknodo --quiet \
4674                 --name rpc.lockd --user 0  || ERROR=1
4675             log_end_msg $ERROR
4676         fi
4677         log_begin_msg "Stopping nfs statd..."
4678         ERROR=0
4679         start-stop-daemon --stop --oknodo --quiet \
4680             --name rpc.statd --user 0 || ERROR=1
4681         log_end_msg $ERROR
4682         ;;
4683
4684   restart | force-reload)
4685         $0 stop
4686         sleep 1
4687         $0 start
4688         ;;
4689
4690   *)
4691         log_success_msg "Usage: nfs-common {start|stop|restart}"
4692         exit 1
4693         ;;
4694 esac
4695
4696 exit 0
4697 #!/bin/sh
4698 #
4699 # nfs-kernel-server
4700 #               This shell script takes care of starting and stopping
4701 #               the kernel-mode NFS server.
4702 #
4703 # chkconfig: 345 60 20
4704 # description: NFS is a popular protocol for file sharing across TCP/IP \
4705 #              networks. This service provides NFS server functionality, \
4706 #              which is configured via the /etc/exports file.
4707 #
4708
4709 set -e
4710
4711 # What is this?
4712 DESC="NFS kernel daemon"
4713 PREFIX=/usr
4714
4715 # Exit if required binaries are missing.
4716 [ -x $PREFIX/sbin/rpc.nfsd    ] || exit 0
4717 [ -x $PREFIX/sbin/rpc.mountd  ] || exit 0
4718 [ -x $PREFIX/sbin/exportfs    ] || exit 0
4719 [ -x $PREFIX/sbin/rpc.svcgssd ] || exit 0
4720
4721 # Read config
4722 DEFAULTFILE=/etc/default/nfs-kernel-server
4723 RPCNFSDCOUNT=8
4724 RPCMOUNTDOPTS=
4725 NEED_SVCGSSD=yes
4726 RPCGSSDOPTS=
4727 RPCSVCGSSDOPTS=
4728 PROCNFSD_MOUNTPOINT=/proc/fs/nfsd
4729 if [ -f $DEFAULTFILE ]; then
4730     . $DEFAULTFILE
4731 fi
4732
4733 . /lib/lsb/init-functions
4734
4735 do_modprobe() {
4736     modprobe -q "$1" || true
4737 }
4738
4739 do_mount() {
4740     if ! grep -E -qs "$1\$" /proc/filesystems
4741     then
4742         return 1
4743     fi
4744     if ! mountpoint -q "$2"
4745     then
4746         mount -t "$1" "$1" "$2"
4747         return
4748     fi
4749     return 0
4750 }
4751
4752 # See how we were called.
4753 case "$1" in
4754   start)
4755         cd /    # daemons should have root dir as cwd
4756         if grep -q '^/' /etc/exports
4757         then
4758                 do_modprobe nfsd
4759                 do_mount nfsd $PROCNFSD_MOUNTPOINT || NEED_SVCGSSD=no
4760                 log_begin_msg "Exporting directories for $DESC..."
4761                 ERROR=0
4762                 $PREFIX/sbin/exportfs -r || ERROR=1
4763                 log_end_msg $ERROR
4764
4765                 if [ "$NEED_SVCGSSD" = yes ]
4766                 then
4767                     log_begin_msg "Starting rpc svcgssd..."
4768                     ERROR=0
4769                     start-stop-daemon --start --quiet \
4770                             --make-pidfile --pidfile /var/run/rpc.svcgssd.pid \
4771                             --exec $PREFIX/sbin/rpc.svcgssd -- $RPCSVCGSSDOPTS || ERROR=1
4772                     log_end_msg $ERROR
4773                 fi
4774
4775                 log_begin_msg "Starting rpc nfsd..."
4776                 ERROR=0
4777                 start-stop-daemon --start --quiet \
4778                     --exec $PREFIX/sbin/rpc.nfsd -- $RPCNFSDCOUNT || ERROR=1
4779                 log_end_msg $ERROR
4780
4781                 # make sure 127.0.0.1 is a valid source for requests
4782                 ClearAddr=
4783                 if [ -f /proc/net/rpc/auth.unix.ip/channel ]
4784                 then
4785                     fgrep -qs 127.0.0.1 /proc/net/rpc/auth.unix.ip/content || {
4786                         echo "nfsd 127.0.0.1 2147483647 localhost" >/proc/net/rpc/auth.unix.ip/channel
4787                         ClearAddr=yes
4788                     }
4789                 fi
4790
4791                 $PREFIX/bin/rpcinfo -u localhost nfs 3 >/dev/null 2>&1 ||
4792                     RPCMOUNTDOPTS="$RPCMOUNTDOPTS --no-nfs-version 3"
4793
4794                 [ -z "$ClearAddr" ] || echo "nfsd 127.0.0.1 1" >/proc/net/rpc/auth.unix.ip/channel
4795
4796                 log_begin_msg "Starting rpc mountd..."
4797                 ERROR=0
4798                 start-stop-daemon --start --quiet \
4799                     --exec $PREFIX/sbin/rpc.mountd -- $RPCMOUNTDOPTS || ERROR=1
4800                 log_end_msg $ERROR
4801         else
4802                 log_warning_msg "Not starting $DESC: No exports."
4803         fi
4804         ;;
4805
4806   stop)
4807         log_begin_msg "Stopping rpc mountd..."
4808         ERROR=0
4809         start-stop-daemon --stop --oknodo --quiet \
4810             --name rpc.mountd --user 0 || ERROR=1
4811         log_end_msg $ERROR
4812         if [ "$NEED_SVCGSSD" = yes ]
4813         then
4814             log_begin_msg "Stopping rpc svcgssd..."
4815             ERROR=0
4816             start-stop-daemon --stop --oknodo --quiet \
4817                     --name rpc.svcgssd --user 0 || ERROR=1
4818             log_end_msg $ERROR
4819             rm -f /var/run/rpc.svcgssd.pid
4820         fi
4821         log_begin_msg "Stopping rpc nfsd..."
4822         ERROR=0
4823         start-stop-daemon --stop --oknodo --quiet \
4824             --name nfsd --user 0 --signal 2 || ERROR=1
4825         log_end_msg $ERROR
4826
4827         log_begin_msg "Unexporting directories for $DESC..."
4828         ERROR=0
4829         $PREFIX/sbin/exportfs -au || ERROR=1
4830         log_end_msg $ERROR
4831         ;;
4832
4833   reload | force-reload)
4834         log_begin_msg "Re-exporting directories for $DESC..."
4835         ERROR=0
4836         $PREFIX/sbin/exportfs -r || ERROR=1
4837         log_end_msg $ERROR
4838         ;;
4839
4840   restart)
4841         $0 stop
4842         sleep 1
4843         $0 start
4844         ;;
4845
4846   *)
4847         log_success_msg "Usage: nfs-kernel-server {start|stop|reload|force-reload|restart}"
4848         exit 1
4849         ;;
4850 esac
4851
4852 exit 0
4853 #! /bin/sh
4854 #
4855 ### BEGIN INIT INFO
4856 # Provides:          pcmcia
4857 # Required-Start:    udev
4858 # Required-Stop:
4859 # Default-Start:     S
4860 # Default-Stop:
4861 # Short-Description: PCMCIA support
4862 # Description:       This service provides PCMCIA hardware support for
4863 #                    systems running Linux >= 2.6.13-rc1.
4864 ### END INIT INFO
4865
4866 set -e
4867
4868 [ -f /sbin/pccardctl ] || exit 0
4869
4870 # If /lib/lsb/init-functions doesn't exist
4871 # define them here, otherwise installer breaks
4872 if [ -f /lib/lsb/init-functions ]; then
4873     . /lib/lsb/init-functions
4874 else
4875     log_daemon_msg()
4876     {
4877         echo "$1: $2"
4878     }
4879     log_end_msg()
4880     {
4881         if [ "$1" = 0 ]; then
4882             echo "done"
4883         else
4884             echo "failed!"
4885         fi
4886         return $1
4887     }
4888     log_success_msg()
4889     {
4890         echo "$@"
4891     }
4892     log_failure_msg()
4893     {
4894         echo "$@"
4895     }
4896 fi
4897
4898 [ -f /etc/default/pcmciautils ] && . /etc/default/pcmciautils
4899
4900 case $PCMCIA in
4901     no|false)
4902         exit 0
4903         ;;
4904 esac
4905
4906 [ -f /etc/default/rcS ] && . /etc/default/rcS
4907
4908 # Are we running from init?
4909 run_by_init()
4910 {
4911     ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
4912 }
4913
4914 if ls /sys/class/pcmcia_socket/* >/dev/null 2>&1; then
4915     if ! run_by_init; then
4916         log_success_msg "PCMCIA bridge driver already present in kernel"
4917     fi
4918     exit 0
4919 fi
4920
4921 KERNEL_VERSION="$(uname -r | sed 's/-.*//')"
4922
4923 supported_kernel()
4924 {
4925     case $KERNEL_VERSION in
4926         2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;;
4927         2.6.1[012]|2.6.1[012][!0-9]*) return 1 ;;
4928     esac
4929     return 0
4930 }
4931
4932 if ! supported_kernel; then
4933     if ! run_by_init; then
4934         log_failure_msg "pcmciautils requires Linux >= 2.6.13-rc1; use pcmcia-cs instead"
4935     fi
4936     exit 1
4937 fi
4938
4939 if [ -z "$PCIC" ]; then
4940     if ! run_by_init; then
4941         log_failure_msg "No PCMCIA bridge module specified"
4942     fi
4943     exit 1
4944 fi
4945
4946 if ! [ -e /dev/.udev ]; then
4947     if ! run_by_init; then
4948         log_failure_msg "pcmciautils requires udev to be enabled"
4949     fi
4950     exit 1
4951 fi
4952
4953 if [ "$VERBOSE" = "no" ]; then
4954     MODPROBE_OPTIONS="$MODPROBE_OPTIONS -Q"
4955     export MODPROBE_OPTIONS
4956 fi
4957
4958 case "$1" in
4959     start)
4960         log_daemon_msg "Loading PCMCIA bridge driver module" "$PCIC"
4961
4962         if [ "$CORE_OPTS" ]; then
4963             modprobe -Qb pcmcia_core $CORE_OPTS
4964         fi
4965         
4966         modprobe -Qb $PCIC $PCIC_OPTS
4967         
4968         log_end_msg $?
4969         ;;
4970
4971     stop)
4972         ;;
4973     
4974     restart)
4975         $0 stop
4976         $0 start
4977         exit $?
4978         ;;
4979
4980     reload|force-reload)
4981         ;;
4982
4983     *)
4984         log_success_msg "Usage: $0 {start|stop|restart|reload|force-reload}"
4985         exit 2
4986         ;;
4987 esac
4988 #!/bin/sh
4989 #
4990 # start/stop portmap daemon.
4991
4992 ### BEGIN INIT INFO
4993 # Provides:          portmap
4994 # Required-Start:    $network
4995 # Required-Stop:     $network
4996 # Should-Start:      $named
4997 # Should-Stop:       $named
4998 # Default-Start:     S 1 2 3 4 5
4999 # Default-Stop:      0 6
5000 ### END INIT INFO
5001
5002 test -f /sbin/portmap || exit 0
5003
5004 . /lib/lsb/init-functions
5005
5006 OPTIONS=""
5007 if [ -f /etc/default/portmap ]; then
5008   . /etc/default/portmap
5009 elif [ -f /etc/portmap.conf ]; then
5010   . /etc/portmap.conf
5011 fi
5012
5013 case "$1" in
5014     start)
5015         pid=`pidof portmap`
5016         if [ -n "$pid" ] ; then
5017             log_begin_msg "Not starting portmap daemon.  Already running."
5018             log_end_msg 0
5019             exit 0
5020         fi
5021         log_begin_msg "Starting portmap daemon..."
5022          start-stop-daemon --start --quiet --oknodo --exec /sbin/portmap -- $OPTIONS
5023         log_end_msg $?
5024
5025         sleep 1 # needs a short pause or pmap_set won't work. :(
5026         if [ -f /var/run/portmap.upgrade-state ]; then
5027           log_begin_msg "Restoring old RPC service information..."
5028           pmap_set </var/run/portmap.upgrade-state
5029           log_end_msg $?
5030           rm -f /var/run/portmap.upgrade-state
5031         else
5032           if [ -f /var/run/portmap.state ]; then
5033             pmap_set </var/run/portmap.state
5034             rm -f /var/run/portmap.state
5035           fi
5036         fi
5037
5038         ;;
5039     stop)
5040         log_begin_msg "Stopping portmap daemon..."
5041         pmap_dump >/var/run/portmap.state
5042         start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
5043         log_end_msg $?
5044         ;;
5045     force-reload)
5046         $0 restart
5047         ;;
5048     restart)
5049         $0 stop
5050         $0 start
5051         ;;
5052     *)
5053         log_success_msg "Usage: /etc/init.d/portmap {start|stop|force-reload|restart}"
5054         exit 1
5055         ;;
5056 esac
5057
5058 exit 0
5059
5060 #!/bin/sh -e
5061 #
5062 #   /etc/init.d/ppp: start or stop PPP link.
5063 #
5064 # This configuration method is deprecated, please use /etc/network/interfaces.
5065
5066 [ -x /usr/sbin/pppd -a -f /etc/ppp/ppp_on_boot ] || exit 0
5067 if [ -x /etc/ppp/ppp_on_boot ]; then RUNFILE=1; fi
5068 . /lib/lsb/init-functions
5069
5070 case "$1" in
5071 start)
5072     log_begin_msg "Starting up PPP link..."
5073     if [ "$RUNFILE" = "1" ]; then
5074         /etc/ppp/ppp_on_boot
5075     else
5076         pppd call provider
5077     fi
5078     log_end_msg $?
5079     ;;
5080 stop)
5081     log_begin_msg "Shutting down PPP link..."
5082     if [ "$RUNFILE" = "1" ]; then
5083         poff -a
5084     else
5085         poff provider
5086     fi
5087     log_end_msg $?
5088     ;;
5089 restart|force-reload)
5090     log_begin_msg "Restarting PPP link..."
5091     if [ "$RUNFILE" = "1" ]; then      
5092         poff -a || true
5093         sleep 5
5094         /etc/ppp/ppp_on_boot
5095     else                  
5096         poff provider || true
5097         sleep 5
5098         pppd call provider
5099     fi
5100     log_end_msg $?
5101     ;;
5102 *)
5103     log_success_msg "Usage: /etc/init.d/ppp {start|stop|restart|force-reload}"
5104     exit 1
5105     ;;
5106 esac
5107
5108 exit 0
5109 #!/bin/sh -e
5110 ### BEGIN INIT INFO
5111 # Provides:          pppd-dns
5112 # Required-Start:    $local_fs
5113 # Default-Start:     S
5114 # Short-Description: Restore resolv.conf if the system crashed.
5115 ### END INIT INFO
5116 #
5117 # Restore /etc/resolv.conf if the system crashed before the ppp link
5118 # was shut down.
5119
5120 [ -x /etc/ppp/ip-down.d/0000usepeerdns ] \
5121         && exec /etc/ppp/ip-down.d/0000usepeerdns
5122
5123 #!/bin/sh
5124 ###########################################################################
5125 # Autostart script for guest tools' service.
5126 #
5127 # Copyright (c) 2005-2008 Parallels Software International, Inc.
5128 # All rights reserved.
5129 # http://www.parallels.com
5130 ###########################################################################
5131
5132
5133 ###
5134 # chkconfig: 2345 99 20
5135 # description: Autostart script for guest tools' service.
5136 ###
5137
5138 ### BEGIN INIT INFO
5139 # Provides: prltoolsd
5140 # required-start:
5141 # required-stop:
5142 # Default-Start: 2 3 4 5
5143 # Default-Stop:  0 1 6
5144 # Description:   Autostart script for guest tools' service.
5145 ### END INIT INFO
5146
5147
5148 ###########################################################################
5149 # Set configuration data
5150 ###########################################################################
5151
5152 prlfile="prltoolsd"
5153 exefile="/usr/bin/${prlfile}"
5154 pidfile="/var/run/${prlfile}.pid"
5155
5156 # Set custom options if they are required
5157 PRLTOOLSD_OPTIONS="-p $pidfile"
5158
5159 ###########################################################################
5160 # Install client ID for wireless bridged networking
5161 ###########################################################################
5162
5163 # Install record for client ID sending for each networking card
5164 # in the system in the dhclient.conf (dhclient is installed)
5165 dhclient_install() {
5166         # Locate dhclient.conf using strings. The directory can be
5167         # different on different distributions
5168         CONF=`strings /sbin/dhclient | grep etc | grep dhclient.conf`
5169         IFACES=$*
5170
5171         # and can even not exists...
5172         mkdir -p `dirname $CONF`
5173         touch $CONF
5174
5175         for IFACE in $IFACES; do
5176                 HWADDR=`ifconfig -a | grep ^$IFACE | awk '{ print $5 }'`
5177                 export IFACE HWADDR
5178
5179                 # Install section like
5180                 # interface "eth0" {
5181                 #       send dhcp-client-identifier 1:<real_mac>;
5182                 # }
5183                 # or leave it untouched if present
5184                 awk '
5185                         BEGIN {
5186                                 inside_iface = 0
5187                                 iface_found = 0
5188                         }
5189                         END {
5190                                 iface = ENVIRON["IFACE"]
5191                                 addr = ENVIRON["HWADDR"]
5192                                 if (!iface_found) {
5193                                         print "interface \""iface"\" {"
5194                                         print " send dhcp-client-identifier 1:"addr"; # Remove this comment on manual client-id modification"
5195                                         print "}"
5196                                 }
5197                         }
5198
5199                         /^ *interface/ {
5200                                 iface = ENVIRON["IFACE"]
5201                                 test_if = $2
5202                                 gsub(/\"/, "", test_if)
5203                                 gsub(/ /, "", test_if)
5204                                 if (test_if == iface)
5205                                         iface_found = inside_iface = 1
5206                         }
5207
5208                         /dhcp-client-identifier/ {
5209                                 str = $0
5210                                 if (inside_iface &&
5211                                     match(str, /Remove this/))
5212                                         next
5213                                 else
5214                                         inside_iface = 0
5215                         }
5216
5217                         /\}/ {
5218                                 addr = ENVIRON["HWADDR"]
5219
5220                                 if (inside_iface)
5221                                         print " send dhcp-client-identifier 1:"addr"; # Remove this comment on manual client-id modification"
5222                                 inside_iface = 0
5223                         }
5224
5225                         {
5226                                 print $0
5227                         }
5228                 ' $CONF >$CONF.tmp1 || exit 0
5229                 mv $CONF.tmp1 $CONF
5230         done
5231 }
5232
5233 # Install key to send client ID (dhcpcd is installed)
5234 # Kludge to do this on the per/interface basis is not found
5235 dhcpc_install() {
5236         CONF="/etc/sysconfig/network/dhcp"
5237         HWADDR=`/sbin/ifconfig -a | awk '/HWaddr/ { print $5 ; exit }'`
5238         export HWADDR
5239         awk '/DHCLIENT_CLIENT_ID=/{
5240                 str = str1 = $0
5241                 sub(/\".*\"/, "", str1)
5242                 if (length(str1) + 2 >= length(str) || match($str, /Remove this/))
5243                         print "DHCLIENT_CLIENT_ID=\"1:"ENVIRON["HWADDR"]"\" # Remove this comment on manual client-id modification"
5244                 else
5245                         print $0
5246                 next
5247         }
5248         {
5249                 print $0
5250         }
5251         ' $CONF >$CONF.tmp1 || exit 0
5252         mv $CONF.tmp1 $CONF
5253 }
5254
5255 clientid_install() {
5256         IFACES=`ifconfig -a | awk '/HWaddr/{ print $1 }' | xargs`
5257         if [ -n "$IFACES" ]; then
5258                 [ -f /sbin/dhclient ] && dhclient_install $IFACES
5259                 [ -f /etc/sysconfig/network/dhcp ] && dhcpc_install $IFACES
5260         fi
5261 }
5262
5263 ###########################################################################
5264 # Start and Stop operations for tools' daemon
5265 ###########################################################################
5266
5267 start() {
5268     if [ -f $pidfile ]; then
5269         rm -f $pidfile;
5270     fi
5271
5272     echo -n $"Loading Parallels ToolsGate driver: "
5273     if modprobe prl_tg; then
5274         echo $"done"
5275     else
5276         echo $"failed"
5277     fi
5278
5279     echo -n $"Loading Parallels Network driver: "
5280
5281         # Installing client-id to the DHCP client configuration
5282         # is temporary disabled.
5283
5284     #clientid_install
5285
5286     if modprobe prl_eth; then
5287         echo $"done"
5288     else
5289         echo $"failed"
5290     fi
5291
5292     echo -n $"Loading Parallels Shared Folders driver: "
5293     if modprobe prl_fs; then
5294         echo $"done"
5295     else
5296         echo $"failed"
5297     fi
5298
5299     echo -n $"Starting Parallels tools daemon: "
5300     $exefile ${PRLTOOLSD_OPTIONS}
5301     RETVAL=$?
5302     if [ -n $RETVAL ]; then
5303         echo $"done"
5304     else
5305         echo $"failed"
5306     fi
5307
5308     return $RETVAL
5309 }
5310
5311 stop() {
5312     RETVAL=0
5313
5314     echo -n $"Shutting down Parallels tools daemon: "
5315
5316     if [ -f $pidfile ]; then
5317         prlpid=`cat $pidfile 2>/dev/null`
5318
5319         if [ -n $prlpid ] && [ -e /proc/$prlpid ]; then
5320             kill $prlpid;
5321             RETVAL=$?
5322         fi
5323
5324         rm -f $pidfile;
5325     fi
5326
5327     if [ -n $RETVAL ]; then
5328         echo $"done"
5329     else
5330         echo $"failed"
5331     fi
5332
5333     return $RETVAL
5334 }
5335
5336 ###########################################################################
5337 # Perform initial operations
5338 ###########################################################################
5339
5340 [ -f $exefile ] || exit 0
5341
5342 ###########################################################################
5343 # Start/stop guest tools' service
5344 ###########################################################################
5345
5346 case "$1" in
5347     start)
5348         start
5349     ;;
5350     stop)
5351         stop
5352     ;;
5353     restart)
5354         stop
5355         start
5356     ;;
5357     *)
5358         echo "=> This script starts/stops Parallels guest tools' service"
5359         echo "Usage: $0 <start | stop | restart>"
5360         exit 1
5361     ;;
5362 esac
5363
5364 exit $?
5365 #! /bin/sh
5366 # /etc/init.d/procps: Set kernel variables from /etc/sysctl.conf
5367 #
5368 # written by Elrond <Elrond@Wunder-Nett.org>
5369
5370 ### BEGIN INIT INFO
5371 # Provides:          procps
5372 # Required-Start:    mountkernfs
5373 # Required-Stop:
5374 # Default-Start:     S
5375 # Default-Stop:
5376 # Short-Description: Configure kernel parameters at boottime
5377 # Description:  Loads kernel parameters that are specified in /etc/sysctl.conf
5378 ### END INIT INFO
5379
5380
5381 # Check for existance of the default file and exit if not there,
5382 # Closes #52839 for the boot-floppy people
5383 [ -r /etc/default/rcS ] || exit 0
5384 . /etc/default/rcS
5385 . /lib/lsb/init-functions
5386
5387 PATH=/sbin:$PATH
5388 which sysctl > /dev/null || exit 0
5389
5390
5391 case "$1" in
5392        start|restart|force-reload)
5393                if [ ! -r /etc/sysctl.conf ]
5394                then
5395                        exit 0
5396                fi
5397                quiet="-q"
5398                if [ "$VERBOSE" = "yes" ]; then
5399                        quiet=""
5400                fi
5401                log_action_begin_msg "Setting kernel variables"
5402                sysctl $quiet -p
5403                log_action_end_msg $?
5404                ;;
5405        stop)
5406                ;;
5407        *)
5408                echo "Usage: /etc/init.d/procps {start|stop|restart|force-reload}" >&2
5409                exit 3
5410                ;;
5411 esac
5412 exit 0
5413 #! /bin/sh
5414 #
5415 # rc
5416 #
5417 # Starts/stops services on runlevel changes.
5418 #
5419 # Optimization: A start script is not run when the service was already
5420 # configured to run in the previous runlevel.  A stop script is not run
5421 # when the the service was already configured not to run in the previous
5422 # runlevel.
5423 #
5424 # Authors:
5425 #       Miquel van Smoorenburg <miquels@cistron.nl>
5426 #       Bruce Perens <Bruce@Pixar.com>
5427
5428 PATH=/sbin:/bin:/usr/sbin:/usr/bin
5429 export PATH
5430
5431 # Un-comment the following for debugging.
5432 # debug=echo
5433
5434 # Specify method used to enable concurrent init.d scripts.
5435 # Valid options are 'none' and 'shell'.
5436 CONCURRENCY=none
5437
5438 # Make sure the name survive changing the argument list
5439 scriptname="$0"
5440
5441 umask 022
5442
5443 #
5444 # Stub to do progress bar ticks (currently just for usplash) on startup
5445 #
5446 startup_progress() {
5447     $@
5448     step=$(($step + $step_change))
5449     progress=$(($step * $progress_size / $num_steps + $first_step))
5450     if type usplash_write >/dev/null 2>&1; then
5451         usplash_write "PROGRESS $progress" || true
5452     fi
5453 }
5454
5455 #
5456 # Start script or program.
5457 #
5458 case "$CONCURRENCY" in
5459   none)
5460         startup() {
5461                 action=$1
5462                 shift
5463                 scripts="$@"
5464                 sh=sh
5465                 # Debian Policy Â§9.3.1 requires .sh scripts in runlevel S to be sourced
5466                 # However, some important packages currently contain .sh scripts
5467                 # that do "exit" at some point, thus killing this process.  Bad!
5468                 #[ S = "$runlevel" ] && sh=.
5469                 for script in $scripts ; do
5470                         case "$script" in
5471                           *.sh)
5472                                 if [ "." = "$sh" ] ; then
5473                                         set "$action"
5474                                         RC_SAVE_PATH="$PATH"
5475                                         startup_progress $debug . "$script"
5476                                         PATH="$RC_SAVE_PATH"
5477                                 else
5478                                         startup_progress $debug $sh "$script" $action
5479                                 fi
5480                                 ;;
5481                           *)
5482                                 startup_progress $debug "$script" $action
5483                                 ;;
5484                         esac
5485                 done
5486         }
5487         ;;
5488   shell)
5489         startup() {
5490                 action=$1
5491                 shift
5492                 scripts="$@"
5493                 sh=sh
5494                 # Debian Policy Â§9.3.1 requires .sh scripts in runlevel S to be sourced
5495                 # However, some important packages currently contain .sh scripts
5496                 # that do "exit" at some point, thus killing this process.  Bad!
5497                 #[ S = "$runlevel" ] && sh=.
5498                 backgrounded=0
5499                 for script in $scripts ; do
5500                         case "$script" in
5501                           *.sh)
5502                                 if [ "." = "$sh" ] ; then
5503                                         set "$action"
5504                                         RC_SAVE_PATH="$PATH"
5505                                         startup_progress $debug . "$script"
5506                                         PATH="$RC_SAVE_PATH"
5507                                 else
5508                                         startup_progress $debug $sh "$script" $action
5509                                 fi
5510                                 ;;
5511                           *)
5512                                 startup_progress $debug "$script" $action &
5513                                 backgrounded=1
5514                                 ;;
5515                         esac
5516                 done
5517                 [ 1 = "$backgrounded" ] && wait
5518         }
5519         ;;
5520   startpar)
5521         startup() {
5522                 action=$1
5523                 shift
5524                 scripts="$@"
5525                 sh=sh
5526                 # Debian Policy Â§9.3.1 requires .sh scripts in runlevel S to be sourced
5527                 # However, some important packages currently contain .sh scripts
5528                 # that do "exit" at some point, thus killing this process.  Bad!
5529                 #[ S = "$runlevel" ] && sh=.
5530                 # Make sure .sh scripts are sourced in runlevel S
5531                 if [ "." = "$sh" ] ; then
5532                         newscripts=
5533                         for script in $scripts ; do
5534                                 case "$script" in
5535                                   *.sh)
5536                                         set "$action"
5537                                         RC_SAVE_PATH="$PATH"
5538                                         startup_progress $debug . "$script"
5539                                         PATH="$RC_SAVE_PATH"
5540                                         ;;
5541                                   *)
5542                                         newscripts="$newscripts $script"
5543                                         ;;
5544                                 esac
5545                         done
5546                         scripts="$newscripts"
5547                 fi
5548
5549                 # startpar is not working as it should yet [pere 2005-09-10]
5550                 [ -n "$scripts" ] && startup_progress $debug startpar -a $action $scripts
5551                 startup_progress $debug startpar -a $action $scripts
5552         }
5553         ;;
5554 esac
5555
5556 on_exit() {
5557     echo "error: '$scriptname' exited outside the expected code flow."
5558 }
5559 trap on_exit EXIT # Enable emergency handler
5560
5561 # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
5562 trap ":" INT QUIT TSTP
5563
5564 # Should we also output to the console?
5565 # /proc won't be mounted if we don't have an initramfs, but then we're
5566 # dealing with custom systems so it's their own fault that they'll get
5567 # output from rcS ;)
5568 if grep -w -q quiet /proc/cmdline 2>/dev/null; then
5569     QUIET=yes
5570 else
5571     QUIET=no
5572 fi
5573 export QUIET
5574
5575 # Set onlcr to avoid staircase effect.
5576 if [ "$QUIET" != yes ]; then
5577     stty onlcr </dev/console >/dev/console 2>&1
5578 fi
5579
5580 # Now find out what the current and what the previous runlevel are.
5581 runlevel=$RUNLEVEL
5582
5583 # Get first argument. Set new runlevel to this argument.
5584 [ "$1" != "" ] && runlevel=$1
5585 if [ "$runlevel" = "" ]
5586 then
5587         echo "Usage: $scriptname <runlevel>" >&2
5588         exit 1
5589 fi
5590 previous=$PREVLEVEL
5591 [ "$previous" = "" ] && previous=N
5592
5593 export runlevel previous
5594
5595 if [ S = "$runlevel" ]
5596 then
5597         #
5598         # See if system needs to be setup. This is ONLY meant to
5599         # be used for the initial setup after a fresh installation!
5600         #
5601         if [ -x /sbin/unconfigured.sh ]
5602         then
5603                 /sbin/unconfigured.sh
5604         fi
5605 fi
5606
5607 . /etc/default/rcS
5608 export VERBOSE
5609
5610 # Is there an rc directory for this new runlevel?
5611 if [ -d /etc/rc$runlevel.d ]
5612 then
5613         # Split the progress bar into thirds
5614         progress_size=$((100 / 3))
5615
5616         case "$runlevel" in
5617                 0|6)
5618                         ACTION=stop
5619                         # Count down from 0 to -100 and use the entire bar
5620                         first_step=0
5621                         progress_size=100
5622                         step_change=-1
5623                         ;;
5624                 S)
5625                         ACTION=start
5626                         # Use 2/3 of the space
5627                         first_step=0
5628                         progress_size=$(($progress_size * 2))
5629                         step_change=1
5630                         ;;
5631                 *)
5632                         ACTION=start
5633                         # Begin where rcS left off and use the final 1/3 of
5634                         # the space (by leaving progress_size unchanged)
5635                         first_step=$(($progress_size * 2))
5636                         step_change=1
5637                         ;;
5638         esac
5639
5640         # Count the number of scripts we need to run (for usplash progress bar)
5641         num_steps=0
5642         for s in /etc/rc$runlevel.d/[SK]*; do
5643             case "${s##/etc/rc$runlevel.d/S??}" in
5644                 gdm|xdm|kdm|ltsp-client-core|reboot|halt)
5645                     break
5646                     ;;
5647             esac
5648             num_steps=$(($num_steps + 1))
5649         done
5650
5651         step=0
5652
5653         # First, run the KILL scripts.
5654         if [ "$previous" != N ]
5655         then
5656                 # Run all scripts with the same level in parallel
5657                 CURLEVEL=""
5658                 for s in /etc/rc$runlevel.d/K*
5659                 do
5660                         level=$(echo $s | sed 's/.*\/K\([0-9][0-9]\).*/\1/')
5661                         if [ "$level" = "$CURLEVEL" ]
5662                         then
5663                                 continue
5664                         fi
5665                         CURLEVEL=$level
5666                         SCRIPTS=""
5667                         for i in /etc/rc$runlevel.d/K$level*
5668                         do
5669                                 # Check if the script is there.
5670                                 [ ! -f $i ] && continue
5671
5672                                 #
5673                                 # Find stop script in previous runlevel but
5674                                 # no start script there.
5675                                 #
5676                                 suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}
5677                                 previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix
5678                                 previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
5679                                 #
5680                                 # If there is a stop script in the previous level
5681                                 # and _no_ start script there, we don't
5682                                 # have to re-stop the service.
5683                                 #
5684                                 [ -f $previous_stop ] && [ ! -f $previous_start ] && continue
5685
5686                                 # Stop the service.
5687                                 SCRIPTS="$SCRIPTS $i"
5688                         done
5689                         startup stop $SCRIPTS
5690                 done
5691         fi
5692
5693         # Now run the START scripts for this runlevel.
5694         # Run all scripts with the same level in parallel
5695         CURLEVEL=""
5696         for s in /etc/rc$runlevel.d/S*
5697         do
5698                 level=$(echo $s | sed 's/.*\/S\([0-9][0-9]\).*/\1/')
5699                 if [ "$level" = "$CURLEVEL" ]
5700                 then
5701                         continue
5702                 fi
5703                 CURLEVEL=$level
5704                 SCRIPTS=""
5705                 for i in /etc/rc$runlevel.d/S$level*
5706                 do
5707                         [ ! -f $i ] && continue
5708
5709                         if [ "$previous" != N ]
5710                         then
5711                                 #
5712                                 # Find start script in previous runlevel and
5713                                 # stop script in this runlevel.
5714                                 #
5715                                 suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
5716                                 stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
5717                                 previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
5718                                 #
5719                                 # If there is a start script in the previous level
5720                                 # and _no_ stop script in this level, we don't
5721                                 # have to re-start the service.
5722                                 #
5723                                 [ -f $previous_start ] && [ ! -f $stop ] && continue
5724                         fi
5725                         SCRIPTS="$SCRIPTS $i"
5726                 done
5727                 startup $ACTION $SCRIPTS
5728         done
5729 fi
5730
5731 if [ S = "$runlevel" ]
5732 then
5733         #
5734         # For compatibility, run the files in /etc/rc.boot too.
5735         #
5736         [ -d /etc/rc.boot ] && run-parts /etc/rc.boot
5737
5738         #
5739         # Finish setup if needed. The comment above about
5740         # /sbin/unconfigured.sh applies here as well!
5741         #
5742         if [ -x /sbin/setup.sh ]
5743         then
5744                 /sbin/setup.sh
5745         fi
5746 fi
5747
5748 trap - EXIT # Disable emergency handler
5749
5750 exit 0
5751
5752 #! /bin/sh
5753
5754 PATH=/sbin:/bin:/usr/sbin:/usr/bin
5755 [ -f /etc/default/rcS ] && . /etc/default/rcS
5756 . /lib/lsb/init-functions
5757
5758 do_start() {
5759         if [ -x /etc/rc.local ]; then
5760                 log_begin_msg "Running local boot scripts (/etc/rc.local)"
5761                 /etc/rc.local
5762                 log_end_msg $?
5763         fi
5764 }
5765
5766 case "$1" in
5767     start)
5768         do_start
5769         ;;
5770     restart|reload|force-reload)
5771         echo "Error: argument '$1' not supported" >&2
5772         exit 3
5773         ;;
5774     stop)
5775         ;;
5776     *)
5777         echo "Usage: $0 start|stop" >&2
5778         exit 3
5779         ;;
5780 esac
5781 #! /bin/sh
5782 #
5783 # rcS
5784 #
5785 # Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order
5786 #
5787
5788 exec /etc/init.d/rc S
5789         Configuration of System V init under Debian GNU/Linux
5790
5791 Most Unix versions have a file here that describes how the scripts
5792 in this directory work, and how the links in the /etc/rc?.d/ directories
5793 influence system startup/shutdown.
5794
5795 For Debian, this information is contained in the policy manual, chapter 
5796 "System run levels and init.d scripts".  The Debian Policy Manual is 
5797 available at:
5798
5799     http://www.debian.org/doc/debian-policy/#contents
5800
5801 The Debian Policy Manual is also available in the Debian package
5802 "debian-policy".  When this package is installed, the policy manual can be
5803 found in directory /usr/share/doc/debian-policy. If you have a browser
5804 installed you can probably read it at
5805
5806     file://localhost/usr/share/doc/debian-policy/
5807
5808 Some more detailed information can also be found in the files in the
5809 /usr/share/doc/sysv-rc directory.
5810
5811 Debian Policy dictates that /etc/init.d/*.sh scripts must work properly
5812 when sourced.  The following additional rules apply:
5813
5814 * /etc/init.d/*.sh scripts may not rely for their correct functioning
5815   on their being sourced rather than executed.  That is, they must work
5816   properly when executed too. They must include "#!/bin/sh" at the top.
5817
5818 * /etc/init.d/*.sh scripts must conform to the rules for sh scripts as
5819   spelled out in the Debian policy section entitled "Scripts" (§10.4).
5820
5821 #! /bin/sh
5822 ### BEGIN INIT INFO
5823 # Provides:          reboot
5824 # Required-Start:    umountroot $network
5825 # Required-Stop:
5826 # Should-Start:      lvm raid2
5827 # Default-Start:     6
5828 # Default-Stop:
5829 # Short-Description: Execute the reboot command.
5830 # Description:
5831 ### END INIT INFO
5832
5833 PATH=/usr/sbin:/usr/bin:/sbin:/bin
5834
5835 . /lib/lsb/init-functions
5836
5837 do_stop () {
5838         # Message should end with a newline since kFreeBSD may
5839         # print more stuff (see #323749)
5840         log_action_msg "Will now restart"
5841         reboot -d -f -i
5842 }
5843
5844 case "$1" in
5845   start)
5846         # No-op
5847         ;;
5848   restart|reload|force-reload)
5849         echo "Error: argument '$1' not supported" >&2
5850         exit 3
5851         ;;
5852   stop)
5853         do_stop
5854         ;;
5855   *)
5856         echo "Usage: $0 start|stop" >&2
5857         exit 3
5858         ;;
5859 esac
5860 #! /bin/sh
5861 ### BEGIN INIT INFO
5862 # Provides:          rmnologin
5863 # Required-Start:    $local_fs $remote_fs
5864 # Required-Stop: 
5865 # Should-Start:      kdm xdm gdm $syslog
5866 # Default-Start:     0 1 2 3 4 5 6
5867 # Default-Stop:       
5868 # Short-Description: Remove /etc/nologin at boot
5869 # Description:       This script removes the /etc/nologin file as the
5870 #                    last step in the boot process, if DELAYLOGIN=yes.
5871 #                    If DELAYLOGIN=no, /etc/nologin was not created by
5872 #                    bootmisc earlier in the boot process.
5873 ### END INIT INFO
5874
5875 PATH=/sbin:/bin
5876 [ "$DELAYLOGIN" ] || DELAYLOGIN=yes
5877 . /lib/init/vars.sh
5878
5879 do_start () {
5880         #
5881         # If login delaying is enabled then remove the flag file
5882         #
5883         case "$DELAYLOGIN" in
5884           Y*|y*)
5885                 rm -f /var/lib/initscripts/nologin
5886                 ;;
5887         esac
5888 }
5889
5890 case "$1" in
5891   start)
5892         do_start
5893         ;;
5894   restart|reload|force-reload)
5895         echo "Error: argument '$1' not supported" >&2
5896         exit 3
5897         ;;
5898   stop)
5899         # No-op
5900         ;;
5901   *)
5902         echo "Usage: $0 start|stop" >&2
5903         exit 3
5904         ;;
5905 esac
5906
5907 :
5908 #! /bin/sh
5909
5910 ### BEGIN INIT INFO
5911 # Provides:          rsyncd
5912 # Required-Start:    $network
5913 # Required-Stop:     $syslog
5914 # Should-Start:      $named $syslog
5915 # Should-Stop:       $syslog network
5916 # Default-Start:     2 3 4 5
5917 # Default-Stop:      0 1 6
5918 # Short-Description: fast remote file copy program daemon
5919 # Description:       rsync is a program that allows files to be copied to and
5920 #                    from remote machines in much the same way as rcp.
5921 #                    This provides rsyncd daemon functionality.
5922 ### END INIT INFO
5923
5924 set -e
5925
5926 # /etc/init.d/rsync: start and stop the rsync daemon
5927
5928 DAEMON=/usr/bin/rsync
5929 RSYNC_ENABLE=false
5930 RSYNC_OPTS=''
5931 RSYNC_DEFAULTS_FILE=/etc/default/rsync
5932 RSYNC_CONFIG_FILE=/etc/rsyncd.conf
5933 RSYNC_NICE_PARM=''
5934
5935 test -x $DAEMON || exit 0
5936
5937 . /lib/lsb/init-functions
5938 . /etc/default/rcS
5939
5940 if [ -s $RSYNC_DEFAULTS_FILE ]; then
5941     . $RSYNC_DEFAULTS_FILE
5942     case "x$RSYNC_ENABLE" in
5943         xtrue|xfalse)   ;;
5944         xinetd)         exit 0
5945                         ;;
5946         *)              log_failure_msg "Value of RSYNC_ENABLE in $RSYNC_DEFAULTS_FILE must be either 'true' or 'false';"
5947                         log_failure_msg "not starting rsync daemon."
5948                         exit 1
5949                         ;;
5950     esac
5951     case "x$RSYNC_NICE" in
5952         x[0-9])         RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";;
5953         x[1-9][0-9])    RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";;
5954         x)              ;;
5955         *)              log_warning_msg "Value of RSYNC_NICE in $RSYNC_DEFAULTS_FILE must be a value between 0 and 19 (inclusive);"
5956                         log_warning_msg "ignoring RSYNC_NICE now."
5957                         ;;
5958     esac
5959 fi
5960
5961 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
5962
5963 case "$1" in
5964   start)
5965         if "$RSYNC_ENABLE"; then
5966             log_daemon_msg "Starting rsync daemon" "rsync"
5967             if [ -s /var/run/rsync.pid ] && kill -0 $(cat /var/run/rsync.pid) >/dev/null 2>&1; then
5968                 log_progress_msg "apparently already running"
5969                 log_end_msg 0
5970                 exit 0
5971             fi
5972             if [ ! -s "$RSYNC_CONFIG_FILE" ]; then
5973                 log_failure_msg "missing or empty config file $RSYNC_CONFIG_FILE"
5974                 log_end_msg 1
5975                 exit 1
5976             fi
5977             if start-stop-daemon --start --quiet --background \
5978                 --pidfile /var/run/rsync.pid --make-pidfile \
5979                 $RSYNC_NICE_PARM --exec /usr/bin/rsync \
5980                 -- --no-detach --daemon --config "$RSYNC_CONFIG_FILE" $RSYNC_OPTS
5981             then
5982                 rc=0
5983                 sleep 1
5984                 if ! kill -0 $(cat /var/run/rsync.pid) >/dev/null 2>&1; then
5985                     log_failure_msg "rsync daemon failed to start"
5986                     rc=1
5987                 fi
5988             else
5989                 rc=1
5990             fi
5991             if [ $rc -eq 0 ]; then
5992                 log_end_msg 0
5993             else
5994                 log_end_msg 1
5995                 rm -f /var/run/rsync.pid
5996             fi
5997         else
5998             if [ -s "$RSYNC_CONFIG_FILE" ]; then
5999                 [ "$VERBOSE" != no ] && log_warning_msg "rsync daemon not enabled in /etc/default/rsync, not starting..."
6000             fi
6001         fi
6002         ;;
6003   stop)
6004         log_daemon_msg "Stopping rsync daemon" "rsync"
6005         start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/rsync.pid
6006         log_end_msg $?
6007         rm -f /var/run/rsync.pid
6008         ;;
6009
6010   reload|force-reload)
6011         log_warning_msg "Reloading rsync daemon: not needed, as the daemon"
6012         log_warning_msg "re-reads the config file whenever a client connects."
6013         ;;
6014
6015   restart)
6016         set +e
6017         if $RSYNC_ENABLE; then
6018             log_daemon_msg "Restarting rsync daemon" "rsync"
6019             if [ -s /var/run/rsync.pid ] && kill -0 $(cat /var/run/rsync.pid) >/dev/null 2>&1; then
6020                 start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/rsync.pid || true
6021                 sleep 1
6022             else
6023                 log_warning_msg "rsync daemon not running, attempting to start."
6024                 rm -f /var/run/rsync.pid
6025             fi
6026             if start-stop-daemon --start --quiet --background \
6027                 --pidfile /var/run/rsync.pid --make-pidfile \
6028                 $RSYNC_NICE_PARM --exec /usr/bin/rsync \
6029                 -- --no-detach --daemon --config "$RSYNC_CONFIG_FILE" $RSYNC_OPTS
6030             then
6031                 rc=0
6032                 sleep 1
6033                 if ! kill -0 $(cat /var/run/rsync.pid) >/dev/null 2>&1; then
6034                     log_failure_msg "rsync daemon failed to start"
6035                     rc=1
6036                 fi
6037             else
6038                 rc=1
6039             fi
6040             if [ $rc -eq 0 ]; then
6041                 log_end_msg 0
6042             else
6043                 log_end_msg 1
6044                 rm -f /var/run/rsync.pid
6045             fi
6046         else
6047             [ "$VERBOSE" != no ] && log_warning_msg "rsync daemon not enabled in /etc/default/rsync, not starting..."
6048         fi
6049         ;;
6050
6051   *)
6052         echo "Usage: /etc/init.d/rsync {start|stop|reload|force-reload|restart}"
6053         exit 1
6054 esac
6055
6056 exit 0
6057 #!/bin/sh
6058
6059 ### BEGIN INIT INFO
6060 # Provides:          samba
6061 # Required-Start:    $network $local_fs $remote_fs
6062 # Required-Stop:     $network $local_fs $remote_fs
6063 # Default-Start:     2 3 4 5
6064 # Default-Stop:      0 1 6
6065 # Short-Description: start Samba daemons (nmbd and smbd)
6066 ### END INIT INFO
6067
6068
6069 # Defaults
6070 RUN_MODE="daemons"
6071
6072 # Reads config file (will override defaults above)
6073 [ -r /etc/default/samba ] && . /etc/default/samba
6074
6075 DAEMON=/usr/sbin/smbd
6076 PIDDIR=/var/run/samba
6077 NMBDPID=$PIDDIR/nmbd.pid
6078 SMBDPID=$PIDDIR/smbd.pid
6079
6080 # clear conflicting settings from the environment
6081 unset TMPDIR
6082
6083 # See if the daemons are there
6084 test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
6085
6086 . /lib/lsb/init-functions
6087
6088 case "$1" in
6089         start)
6090                 log_daemon_msg "Starting Samba daemons"
6091                 # Make sure we have our PIDDIR, even if it's on a tmpfs
6092                 install -o root -g root -m 755 -d $PIDDIR
6093
6094                 NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null`
6095                 if [ "$NMBD_DISABLED" != 'Yes' ]; then
6096                         log_progress_msg "nmbd"
6097                         if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D
6098                         then
6099                                 log_end_msg 1
6100                                 exit 1
6101                         fi
6102                 fi
6103
6104                 if [ "$RUN_MODE" != "inetd" ]; then
6105                         log_progress_msg "smbd"
6106                         if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D; then
6107                                 log_end_msg 1
6108                                 exit 1
6109                         fi
6110                 fi
6111
6112                 log_end_msg 0
6113                 ;;
6114         stop)
6115                 log_daemon_msg "Stopping Samba daemons"
6116                 log_progress_msg "nmbd"
6117
6118                 start-stop-daemon --stop --quiet --pidfile $NMBDPID
6119                 # Wait a little and remove stale PID file
6120                 sleep 1
6121                 if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
6122                 then
6123                         # Stale PID file (nmbd was succesfully stopped),
6124                         # remove it (should be removed by nmbd itself IMHO.)
6125                         rm -f $NMBDPID
6126                 fi
6127
6128                 if [ "$RUN_MODE" != "inetd" ]; then
6129                         log_progress_msg "smbd"
6130                         start-stop-daemon --stop --quiet --pidfile $SMBDPID
6131                         # Wait a little and remove stale PID file
6132                         sleep 1
6133                         if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
6134                         then
6135                                 # Stale PID file (nmbd was succesfully stopped),
6136                                 # remove it (should be removed by smbd itself IMHO.)
6137                                 rm -f $SMBDPID
6138                         fi
6139                 fi
6140
6141                 log_end_msg 0
6142
6143                 ;;
6144         reload)
6145                 log_daemon_msg "Reloading /etc/samba/smb.conf" "smbd only"
6146
6147                 start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
6148
6149                 log_end_msg 0
6150                 ;;
6151         restart|force-reload)
6152                 $0 stop
6153                 sleep 1
6154                 $0 start
6155                 ;;
6156         status)
6157                 pidofproc -p $SMBDPID $DAEMON >/dev/null
6158                 status=$?
6159                 if [ $status -eq 0 ]; then
6160                         log_success_msg "SMBD is running"
6161                 else
6162                         log_failure_msg "SMBD is not running"
6163                 fi
6164                 exit $status
6165                 ;;
6166         *)
6167                 echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}"
6168                 exit 1
6169                 ;;
6170 esac
6171
6172 exit 0
6173 #! /bin/sh
6174 ### BEGIN INIT INFO
6175 # Provides:          sendsigs
6176 # Required-Start:    
6177 # Required-Stop: 
6178 # Default-Start:     6
6179 # Default-Stop:       
6180 # Short-Description: Kill all remaining processes.
6181 # Description: 
6182 ### END INIT INFO
6183
6184 PATH=/usr/sbin:/usr/bin:/sbin:/bin
6185
6186 . /lib/lsb/init-functions
6187
6188 do_stop () {
6189         OMITPIDS=
6190         if [ -e /var/run/sendsigs.omit ]; then
6191                 for pid in $(cat /var/run/sendsigs.omit); do
6192                         OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
6193                 done
6194         fi
6195
6196         if [ -d /var/run/sendsigs.omit.d/ ]; then
6197                 for pidfile in /var/run/sendsigs.omit.d/*; do
6198                         [ -f "$pidfile" ] || continue
6199                         for pid in $(cat $pidfile); do
6200                                 OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
6201                         done
6202                 done
6203         fi
6204
6205         # Kill all processes.
6206         log_action_begin_msg "Terminating all remaining processes"
6207         killall5 -15 $OMITPIDS
6208         log_action_end_msg 0
6209         sleep 5
6210         log_action_begin_msg "Sending all processes the KILL signal"
6211         killall5 -9 $OMITPIDS
6212         log_action_end_msg 0
6213 }
6214
6215 case "$1" in
6216   start)
6217         # No-op
6218         ;;
6219   restart|reload|force-reload)
6220         echo "Error: argument '$1' not supported" >&2
6221         exit 3
6222         ;;
6223   stop)
6224         do_stop
6225         if which usplash_down >/dev/null; then
6226                 usplash_down
6227         fi
6228         ;;
6229   *)
6230         echo "Usage: $0 start|stop" >&2
6231         exit 3
6232         ;;
6233 esac
6234
6235 :
6236 #! /bin/sh
6237 ### BEGIN INIT INFO
6238 # Provides:          single
6239 # Required-Start:    $local_fs killprocs
6240 # Required-Stop:
6241 # Default-Start:     1
6242 # Default-Stop:
6243 # Short-Description: executed by init(8) upon entering runlevel 1 (single).
6244 ### END INIT INFO
6245
6246 PATH=/sbin:/bin
6247
6248 . /lib/lsb/init-functions
6249
6250 do_start () {
6251         log_action_msg "Will now switch to single-user mode"
6252         exec init -t1 S
6253 }
6254
6255 case "$1" in
6256   start)
6257         do_start
6258         ;;
6259   restart|reload|force-reload)
6260         echo "Error: argument '$1' not supported" >&2
6261         exit 3
6262         ;;
6263   stop)
6264         # No-op
6265         ;;
6266   *)
6267         echo "Usage: $0 start|stop" >&2
6268         exit 3
6269         ;;
6270 esac
6271 #! /bin/sh
6272 ### BEGIN INIT INFO
6273 # Provides:          skeleton
6274 # Required-Start:    $local_fs $remote_fs
6275 # Required-Stop:     $local_fs $remote_fs
6276 # Default-Start:     2 3 4 5
6277 # Default-Stop:      S 0 1 6
6278 # Short-Description: Example initscript
6279 # Description:       This file should be used to construct scripts to be
6280 #                    placed in /etc/init.d.
6281 ### END INIT INFO
6282
6283 # Author: Foo Bar <foobar@baz.org>
6284 #
6285 # Please remove the "Author" lines above and replace them
6286 # with your own name if you copy and modify this script.
6287
6288 # Do NOT "set -e"
6289
6290 # PATH should only include /usr/* if it runs after the mountnfs.sh script
6291 PATH=/usr/sbin:/usr/bin:/sbin:/bin
6292 DESC="Description of the service"
6293 NAME=daemonexecutablename
6294 DAEMON=/usr/sbin/$NAME
6295 DAEMON_ARGS="--options args"
6296 PIDFILE=/var/run/$NAME.pid
6297 SCRIPTNAME=/etc/init.d/$NAME
6298
6299 # Exit if the package is not installed
6300 [ -x "$DAEMON" ] || exit 0
6301
6302 # Read configuration variable file if it is present
6303 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
6304
6305 # Load the VERBOSE setting and other rcS variables
6306 [ -f /etc/default/rcS ] && . /etc/default/rcS
6307
6308 # Define LSB log_* functions.
6309 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
6310 . /lib/lsb/init-functions
6311
6312 #
6313 # Function that starts the daemon/service
6314 #
6315 do_start()
6316 {
6317         # Return
6318         #   0 if daemon has been started
6319         #   1 if daemon was already running
6320         #   2 if daemon could not be started
6321         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
6322                 || return 1
6323         start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
6324                 $DAEMON_ARGS \
6325                 || return 2
6326         # Add code here, if necessary, that waits for the process to be ready
6327         # to handle requests from services started subsequently which depend
6328         # on this one.  As a last resort, sleep for some time.
6329 }
6330
6331 #
6332 # Function that stops the daemon/service
6333 #
6334 do_stop()
6335 {
6336         # Return
6337         #   0 if daemon has been stopped
6338         #   1 if daemon was already stopped
6339         #   2 if daemon could not be stopped
6340         #   other if a failure occurred
6341         start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
6342         RETVAL="$?"
6343         [ "$RETVAL" = 2 ] && return 2
6344         # Wait for children to finish too if this is a daemon that forks
6345         # and if the daemon is only ever run from this initscript.
6346         # If the above conditions are not satisfied then add some other code
6347         # that waits for the process to drop all resources that could be
6348         # needed by services started subsequently.  A last resort is to
6349         # sleep for some time.
6350         start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
6351         [ "$?" = 2 ] && return 2
6352         # Many daemons don't delete their pidfiles when they exit.
6353         rm -f $PIDFILE
6354         return "$RETVAL"
6355 }
6356
6357 #
6358 # Function that sends a SIGHUP to the daemon/service
6359 #
6360 do_reload() {
6361         #
6362         # If the daemon can reload its configuration without
6363         # restarting (for example, when it is sent a SIGHUP),
6364         # then implement that here.
6365         #
6366         start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
6367         return 0
6368 }
6369
6370 case "$1" in
6371   start)
6372         [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
6373         do_start
6374         case "$?" in
6375                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
6376                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
6377         esac
6378         ;;
6379   stop)
6380         [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
6381         do_stop
6382         case "$?" in
6383                 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
6384                 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
6385         esac
6386         ;;
6387   #reload|force-reload)
6388         #
6389         # If do_reload() is not implemented then leave this commented out
6390         # and leave 'force-reload' as an alias for 'restart'.
6391         #
6392         #log_daemon_msg "Reloading $DESC" "$NAME"
6393         #do_reload
6394         #log_end_msg $?
6395         #;;
6396   restart|force-reload)
6397         #
6398         # If the "reload" option is implemented then remove the
6399         # 'force-reload' alias
6400         #
6401         log_daemon_msg "Restarting $DESC" "$NAME"
6402         do_stop
6403         case "$?" in
6404           0|1)
6405                 do_start
6406                 case "$?" in
6407                         0) log_end_msg 0 ;;
6408                         1) log_end_msg 1 ;; # Old process is still running
6409                         *) log_end_msg 1 ;; # Failed to start
6410                 esac
6411                 ;;
6412           *)
6413                 # Failed to stop
6414                 log_end_msg 1
6415                 ;;
6416         esac
6417         ;;
6418   *)
6419         #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
6420         echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
6421         exit 3
6422         ;;
6423 esac
6424
6425 :
6426 #! /bin/sh
6427
6428 ### BEGIN INIT INFO
6429 # Provides:             sshd
6430 # Required-Start:       $network $local_fs $remote_fs
6431 # Required-Stop:
6432 # Default-Start:        2 3 4 5
6433 # Default-Stop:         0 1 6
6434 # Short-Description:    OpenBSD Secure Shell server
6435 ### END INIT INFO
6436
6437 set -e
6438
6439 # /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon
6440
6441 test -x /usr/sbin/sshd || exit 0
6442 ( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
6443
6444 SSHD_OOM_ADJUST=-17
6445 if test -f /etc/default/ssh; then
6446     . /etc/default/ssh
6447 fi
6448
6449 . /lib/lsb/init-functions
6450
6451 if [ -n "$2" ]; then
6452     SSHD_OPTS="$SSHD_OPTS $2"
6453 fi
6454
6455 # Are we running from init?
6456 run_by_init() {
6457     ([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
6458 }
6459
6460 check_for_no_start() {
6461     # forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
6462     if [ -e /etc/ssh/sshd_not_to_be_run ]; then 
6463         if [ "$1" = log_end_msg ]; then
6464             log_end_msg 0
6465         fi
6466         if ! run_by_init; then
6467             log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)"
6468         fi
6469         exit 0
6470     fi
6471 }
6472
6473 check_dev_null() {
6474     if [ ! -c /dev/null ]; then
6475         if [ "$1" = log_end_msg ]; then
6476             log_end_msg 1 || true
6477         fi
6478         if ! run_by_init; then
6479             log_action_msg "/dev/null is not a character device!"
6480         fi
6481         exit 1
6482     fi
6483 }
6484
6485 check_privsep_dir() {
6486     # Create the PrivSep empty dir if necessary
6487     if [ ! -d /var/run/sshd ]; then
6488         mkdir /var/run/sshd
6489         chmod 0755 /var/run/sshd
6490     fi
6491 }
6492
6493 check_config() {
6494     if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then
6495         /usr/sbin/sshd -t || exit 1
6496     fi
6497 }
6498
6499 adjust_oom() {
6500     if [ -e /var/run/sshd.pid ]; then
6501         PID="$(head -n1 /var/run/sshd.pid)"
6502         if [ -e "/proc/$PID/oom_adj" ]; then
6503             printf '%s' "$SSHD_OOM_ADJUST" >"/proc/$PID/oom_adj" || true
6504         fi
6505     fi
6506 }
6507
6508 export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
6509
6510 case "$1" in
6511   start)
6512         check_privsep_dir
6513         check_for_no_start
6514         check_dev_null
6515         log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd"
6516         if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
6517             log_end_msg 0
6518             adjust_oom
6519         else
6520             log_end_msg 1
6521         fi
6522         ;;
6523   stop)
6524         log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd"
6525         if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid; then
6526             log_end_msg 0
6527         else
6528             log_end_msg 1
6529         fi
6530         ;;
6531
6532   reload|force-reload)
6533         check_for_no_start
6534         check_config
6535         log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd"
6536         if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd; then
6537             log_end_msg 0
6538         else
6539             log_end_msg 1
6540         fi
6541         ;;
6542
6543   restart)
6544         check_privsep_dir
6545         check_config
6546         log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
6547         start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/sshd.pid
6548         check_for_no_start log_end_msg
6549         check_dev_null log_end_msg
6550         if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
6551             log_end_msg 0
6552             adjust_oom
6553         else
6554             log_end_msg 1
6555         fi
6556         ;;
6557
6558   try-restart)
6559         check_privsep_dir
6560         check_config
6561         log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd"
6562         set +e
6563         start-stop-daemon --stop --quiet --retry 30 --pidfile /var/run/sshd.pid
6564         RET="$?"
6565         set -e
6566         case $RET in
6567             0)
6568                 # old daemon stopped
6569                 check_for_no_start log_end_msg
6570                 check_dev_null log_end_msg
6571                 if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
6572                     log_end_msg 0
6573                 else
6574                     log_end_msg 1
6575                 fi
6576                 ;;
6577             1)
6578                 # daemon not running
6579                 log_progress_msg "(not running)"
6580                 log_end_msg 0
6581                 ;;
6582             *)
6583                 # failed to stop
6584                 log_progress_msg "(failed to stop)"
6585                 log_end_msg 1
6586                 ;;
6587         esac
6588         ;;
6589
6590   *)
6591         log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart}"
6592         exit 1
6593 esac
6594
6595 exit 0
6596 #! /bin/sh
6597 ### BEGIN INIT INFO
6598 # Provides:          stop-bootlogd
6599 # Required-Start:    $remote_fs
6600 # Required-Stop:
6601 # Default-Start:     1 2 3 4 5
6602 # Default-Stop:
6603 # Short-Description: Stop bootlogd
6604 # Description:       See the bootlogd script
6605 ### END INIT INFO
6606
6607 NAME=stop-bootlogd
6608 DAEMON=/sbin/bootlogd
6609
6610 [ -x "$DAEMON" ] || exit 0
6611
6612 case "$1" in
6613   start)
6614         /etc/init.d/bootlogd stop
6615         ;;
6616   stop|restart|force-reload)
6617         # No-op
6618         ;;
6619   *)
6620         echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
6621         exit 3
6622         ;;
6623 esac
6624
6625 :
6626 #! /bin/sh
6627 ### BEGIN INIT INFO
6628 # Provides:          stop-bootlogd-single
6629 # Required-Start:    $remote_fs
6630 # Required-Stop:
6631 # Default-Start:     S
6632 # Default-Stop:
6633 # Short-Description: Stop bootlogd in single user mode
6634 # Description:       See the bootlogd script
6635 ### END INIT INFO
6636
6637 PATH=/usr/sbin:/usr/bin:/sbin:/bin
6638 NAME=stop-bootlogd-single
6639 DAEMON=/sbin/bootlogd
6640
6641 [ -x "$DAEMON" ] || exit 0
6642
6643 case "$1" in
6644   start)
6645         if [ ! -e /proc/cmdline ] || grep -q '\<single\>' /proc/cmdline
6646         then
6647                 /etc/init.d/bootlogd stop
6648         fi
6649         ;;
6650   stop|restart|force-reload)
6651         # No-op
6652         ;;
6653   *)
6654         echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
6655         exit 3
6656         ;;
6657 esac
6658
6659 :
6660 #! /bin/sh
6661 # /etc/init.d/sysklogd: start the system log daemon.
6662
6663 ### BEGIN INIT INFO
6664 # Provides:             syslog
6665 # Required-Start:       $local_fs $time
6666 # Required-Stop:        $local_fs $time
6667 # Should-Start:         $network $named
6668 # Should-Stop:          $network $named
6669 # Default-Start:        S 1 2 3 4 5
6670 # Default-Stop:         0 6
6671 # Short-Description:    System logger
6672 ### END INIT INFO
6673
6674 PATH=/bin:/usr/bin:/sbin:/usr/sbin
6675
6676 pidfile=/var/run/syslogd.pid
6677 binpath=/sbin/syslogd
6678
6679 test -x $binpath || exit 0
6680
6681 # syslogd options should be set in /etc/default/syslogd
6682 SYSLOGD=""
6683
6684 # user to run syslogd as - this can overriden in /etc/default/syslogd
6685 USER="syslog"
6686
6687 test ! -r /etc/default/syslogd || . /etc/default/syslogd
6688
6689 # allow ltsp to override
6690 test ! -r /etc/ltsp/syslogd || . /etc/ltsp/syslogd
6691
6692 # Figure out under which user syslogd should be running as
6693 if echo ${SYSLOGD} | grep -q '^.*-u[[:space:]]*\([[:alnum:]]*\)[[:space:]]*.*$'
6694 then
6695         # A specific user has been set on the command line, try to extract it.
6696         USER=$(echo ${SYSLOGD} | sed -e 's/^.*-u[[:space:]]*\([[:alnum:]]*\)[[:space:]]*.*$/\1/')
6697 else
6698         # By default, run syslogd under the syslog user
6699         SYSLOGD="${SYSLOGD} -u ${USER}"
6700 fi
6701
6702 # Unable to get the user under which syslogd should be running, stop.
6703 if [ -z "${USER}" ]
6704 then
6705         log_failure_msg "Unable to get syslog user"
6706         exit 1
6707 fi
6708
6709 . /lib/lsb/init-functions
6710
6711 create_xconsole()
6712 {
6713     # Only proceed if /dev/xconsole is used at all
6714     if ! grep -q '^[^#].*/dev/xconsole' /etc/syslog.conf
6715     then
6716         return
6717     fi
6718
6719     if [ ! -e /dev/xconsole ]; then
6720         mknod -m 640 /dev/xconsole p
6721     else
6722         chmod 0640 /dev/xconsole
6723     fi
6724
6725     chown ${USER}:adm /dev/xconsole
6726
6727 }
6728
6729 fix_log_ownership()
6730 {
6731         for l in `syslogd-listfiles -a`
6732         do
6733                 chown ${USER}:adm $l
6734         done
6735 }
6736
6737 running()
6738 {
6739     # No pidfile, probably no daemon present
6740     #
6741     if [ ! -f $pidfile ]
6742     then
6743         return 1
6744     fi
6745
6746     pid=`cat $pidfile`
6747
6748     # No pid, probably no daemon present
6749     #
6750     if [ -z "$pid" ]
6751     then
6752         return 1
6753     fi
6754
6755     if [ ! -d /proc/$pid ]
6756     then
6757         return 1
6758     fi
6759
6760     cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1`
6761
6762     # No syslogd?
6763     #
6764     if [ "$cmd" != "$binpath" ]
6765     then
6766         return 1
6767     fi
6768
6769     return 0
6770 }
6771
6772 case "$1" in
6773   start)
6774     log_begin_msg "Starting system log daemon..."
6775     create_xconsole
6776     fix_log_ownership
6777     start-stop-daemon --start --quiet --pidfile $pidfile --name syslogd --startas $binpath -- $SYSLOGD
6778     log_end_msg $?
6779     ;;
6780   stop)
6781     log_begin_msg "Stopping system log daemon..."
6782     start-stop-daemon --stop --quiet --pidfile $pidfile --name syslogd
6783     log_end_msg $?
6784     ;;
6785   reload|force-reload)
6786     log_begin_msg "Reloading system log daemon..."
6787     fix_log_ownership
6788     start-stop-daemon --stop --quiet --signal 1 --pidfile $pidfile --name syslogd
6789     log_end_msg $?
6790     ;;
6791   restart)
6792     log_begin_msg "Restarting system log daemon..."
6793     start-stop-daemon --stop --retry 5 --quiet --pidfile $pidfile --name syslogd
6794     fix_log_ownership
6795     start-stop-daemon --start --quiet --pidfile $pidfile --name syslogd --startas $binpath -- $SYSLOGD
6796     log_end_msg $?
6797     ;;
6798   reload-or-restart)
6799     if running
6800     then
6801         $0 reload
6802     else
6803         $0 start
6804     fi
6805     ;;
6806   *)
6807     log_success_msg "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}"
6808     exit 1
6809 esac
6810
6811 exit 0
6812 #!/bin/sh -e
6813 # init script for udev
6814
6815 # Check the package is still installed
6816 [ -x /sbin/udevd ] || exit 0
6817
6818 # Get LSB functions
6819 . /lib/lsb/init-functions
6820 . /etc/default/rcS
6821
6822
6823 case "$1" in
6824     start)
6825         # We need the uevent support introduced in 2.6.15, bail out if we
6826         # don't have it and fall back to a static /dev
6827         if [ ! -f /sys/class/mem/null/uevent ]; then
6828             if mountpoint -q /dev; then
6829                 # uh-oh, initramfs made some kind of /dev, get rid of it
6830                 umount -l /dev/.static/dev
6831                 umount -l /dev
6832             fi
6833             exit 1
6834         fi
6835
6836         if ! mountpoint -q /dev; then
6837             # initramfs didn't mount /dev, so we'll need to do that
6838             mount -n --bind /dev /etc/udev
6839             mount -n -t tmpfs -o mode=0755 udev /dev
6840             mkdir -m 0700 -p /dev/.static/dev
6841             mount -n --move /etc/udev /dev/.static/dev
6842         fi
6843
6844         # Copy over default device tree
6845         cp -a -f /lib/udev/devices/* /dev
6846
6847         # It's all over netlink now
6848         if [ -e /proc/sys/kernel/hotplug ]; then
6849             echo "" > /proc/sys/kernel/hotplug
6850         fi
6851         
6852         # Start udevd
6853         log_begin_msg "Starting kernel event manager..."
6854         if start-stop-daemon --start --quiet --exec /sbin/udevd -- --daemon; then
6855             log_end_msg 0
6856         else
6857             log_end_msg $?
6858         fi
6859
6860         # This next bit can take a while
6861         if type usplash_write >/dev/null 2>&1; then
6862             usplash_write "TIMEOUT 360" ||:
6863             trap "usplash_write 'TIMEOUT 15' ||:" 0
6864         fi
6865
6866         # Log things that trigger does
6867         /sbin/udevadm monitor -e >/dev/.udev.log &
6868         UDEV_MONITOR_PID=$!
6869
6870         # Fix permissions and missing symlinks/programs for devices made in
6871         # initramfs, and catch up on everything we missed
6872         log_begin_msg "Loading hardware drivers..."
6873         /sbin/udevadm trigger
6874         if /sbin/udevadm settle; then
6875             log_end_msg 0
6876         else
6877             log_end_msg $?
6878         fi
6879
6880         # Kill the udev monitor again
6881         kill $UDEV_MONITOR_PID
6882         ;;
6883     stop)
6884         log_begin_msg "Stopping kernel event manager..."
6885         if start-stop-daemon --stop --quiet --oknodo --exec /sbin/udevd; then
6886             log_end_msg 0
6887         else
6888             log_end_msg $?
6889         fi
6890         umount -l /dev/.static/dev
6891         umount -l /dev
6892         ;;
6893     restart)
6894         cp -au /lib/udev/devices/* /dev
6895
6896         log_begin_msg "Loading additional hardware drivers..."
6897         /sbin/udevadm trigger
6898         if /sbin/udevadm settle; then
6899             log_end_msg 0
6900         else
6901             log_end_msg $?
6902         fi
6903         ;;
6904     reload|force-reload)
6905         log_begin_msg "Reloading kernel event manager..."
6906         if start-stop-daemon --stop --signal 1 --exec /sbin/udevd; then
6907             log_end_msg 0
6908         else
6909             log_end_msg $?
6910         fi
6911         ;;
6912 *)
6913         echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}"
6914         exit 1
6915         ;;
6916 esac
6917
6918 exit 0
6919 #!/bin/sh -e
6920 # init script to finish up udev
6921
6922 # Check the package is still installed
6923 [ -x /sbin/udevd ] || exit 0
6924
6925 # Get LSB functions
6926 . /lib/lsb/init-functions
6927 . /etc/default/rcS
6928
6929
6930 case "$1" in
6931     start)
6932         # Save udev log in /var/log/udev
6933         if [ -e /dev/.udev.log ]; then
6934             mv -f /dev/.udev.log /var/log/udev
6935         fi
6936
6937         # Copy any rules generated while the root filesystem was read-only
6938         for file in /dev/.udev/tmp-rules--*; do
6939             dest=${file##*tmp-rules--}
6940             [ "$dest" = '*' ] && break
6941             cat $file >> /etc/udev/rules.d/$dest
6942             rm -f $file
6943         done
6944         ;;
6945     stop|restart|reload|force-reload)
6946         ;;
6947 *)
6948         echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload}"
6949         exit 1
6950         ;;
6951 esac
6952
6953 exit 0
6954 #! /bin/sh
6955 ### BEGIN INIT INFO
6956 # Provides:          umountfs
6957 # Required-Start:    umountnfs urandom
6958 # Required-Stop:
6959 # Default-Start:     0 6
6960 # Default-Stop:
6961 # Short-Description: Turn off swap and unmount all local file systems.
6962 # Description:
6963 ### END INIT INFO
6964
6965 PATH=/usr/sbin:/usr/bin:/sbin:/bin
6966 . /lib/init/vars.sh
6967
6968 . /lib/lsb/init-functions
6969
6970 umask 022
6971
6972 # Print in order of decreasing length
6973 #
6974 # Algorithm: Find and print longest argument, then call self
6975 # to print remaining arguments in order of decreasing length
6976 #
6977 # This function runs at one tenth the speed of the sort program
6978 # but we use the function because we don't want to rely on any
6979 # programs in /usr/.
6980 #
6981 # N.B.: Arguments must not be null and must not contain whitespace
6982 #
6983 pioodl() {
6984         [ "$1" ] || return 0
6985         ARGNUM=1
6986         ARGNUM_LONGEST=0
6987         ARGLENGTH_LONGEST=0
6988         for ARG in "$@"
6989         do
6990                 ARGLENGTH="${#ARG}"
6991                 if [ "$ARGLENGTH" -gt "$ARGLENGTH_LONGEST" ]
6992                 then
6993                         ARGLENGTH_LONGEST="$ARGLENGTH"
6994                         ARGNUM_LONGEST="$ARGNUM"
6995                 fi
6996                 ARGNUM=$(($ARGNUM + 1))
6997         done
6998         # The method of passing prevargs assumes that args can be
6999         # delimited with spaces
7000         ARGNUM=1
7001         PREVARGS=""
7002         while [ "$ARGNUM" -lt "$ARGNUM_LONGEST" ]
7003         do
7004                 PREVARGS="$PREVARGS $1"
7005                 shift
7006                 ARGNUM=$(($ARGNUM + 1))
7007         done
7008         echo "$1"
7009         shift
7010         pioodl $PREVARGS "$@"
7011 }
7012
7013
7014 do_stop () {
7015         exec 9<&0 </proc/mounts
7016         PROTECTED_MOUNTS="$(sed -n '0,/^\/[^ ]* \/ /p' /proc/mounts)"
7017         WEAK_MTPTS="" #be gentle, don't use force
7018         REG_MTPTS=""
7019         TMPFS_MTPTS=""
7020         while read DEV MTPT FSTYPE REST
7021         do
7022                 echo "$PROTECTED_MOUNTS" | grep -qs "^$DEV $MTPT " && continue
7023                 case "$MTPT" in
7024                         /|/proc|/dev|/.dev|/dev/pts|/dev/shm|/proc/*|/sys|/var/run|/var/lock)
7025                         continue
7026                         ;;
7027                 esac
7028                 case "$FSTYPE" in
7029                         proc|procfs|linprocfs|devfs|sysfs|usbfs|usbdevfs|devpts|securityfs)
7030                         continue
7031                         ;;
7032                   tmpfs)
7033                         if [ -d "$MTPT" ]; then
7034                                 TMPFS_MTPTS="$TMPFS_MTPTS $MTPT"
7035                         fi
7036                         ;;
7037                   *)
7038                         REG_MTPTS="$REG_MTPTS $MTPT"
7039                         if echo "$PROTECTED_MOUNTS" | grep -qs "^$DEV "; then
7040                                 WEAK_MTPTS="$WEAK_MTPTS $MTPT "
7041                         fi
7042                         ;;
7043                 esac
7044         done
7045
7046         exec 0<&9 9<&-
7047
7048         #
7049         # Make sure tmpfs file systems are umounted before turning off
7050         # swap, to avoid running out of memory if the tmpfs filesystems
7051         # use a lot of space.
7052         #
7053         if [ "$TMPFS_MTPTS" ]
7054         then
7055                 if [ "$VERBOSE" = no ]
7056                 then
7057                         log_action_begin_msg "Unmounting temporary filesystems"
7058                         umount $TMPFS_MTPTS
7059                         log_action_end_msg $?
7060                 else
7061                         log_action_msg "Will now unmount temporary filesystems"
7062                         umount -v $TMPFS_MTPTS
7063                         ES=$?
7064                         if [ "$ES" = 0 ]
7065                         then
7066                                 log_success_msg "Done unmounting temporary filesystems."
7067                         else
7068                                 log_failure_msg "Unmounting temporary filesystems failed with error code ${ES}."
7069                         fi
7070                 fi
7071         fi
7072
7073         #
7074         # Deactivate swap
7075         #
7076         if [ "$VERBOSE" = no ]
7077         then
7078                 log_action_begin_msg "Deactivating swap"
7079                 swapoff -a >/dev/null
7080                 log_action_end_msg $?
7081         else
7082                 log_action_msg "Will now deactivate swap"
7083                 swapoff -a -v
7084                 ES=$?
7085                 if [ "$ES" = 0 ]
7086                 then
7087                         log_success_msg "Done deactivating swap."
7088                 else
7089                         log_failure_msg "Swap deactivation failed with error code ${ES}."
7090                 fi
7091         fi
7092
7093         #
7094         # Unmount local filesystems
7095         #
7096         [ -z "$REG_MTPTS" ] && return
7097         [ "$VERBOSE" = no ] && log_action_begin_msg "Unmounting local filesystems"
7098         REG_MTPTS="$(pioodl $REG_MTPTS)"
7099         local ES2=0
7100         for MTPT in $REG_MTPTS; do
7101                 if echo "$WEAK_MTPTS" | grep -qs " $MTPT "; then
7102                         FORCE=""
7103                 else
7104                         FORCE="-f"
7105                 fi
7106                 if [ "$VERBOSE" = no ]; then
7107                         umount $FORCE -r -d $MTPT
7108                         ES=$?
7109                         [ "$ES" != 0 ] && [ "$ES2" = 0 ] && ES2=$ES
7110                 else
7111                         log_action_begin_msg "Unmounting local filesystem $MTPT"
7112                         umount $FORCE -v -r -d $MTPT
7113                         ES=$?
7114                         if [ "$ES" = 0 ]; then
7115                                 log_success_msg "Done unmounting local filesystem $MTPT."
7116                         else
7117                                 log_failure_msg "Unmounting local filesystem $MTPT failed with error code $ES."
7118                         fi
7119                 fi
7120         done
7121         [ "$VERBOSE" = no ] && log_action_end_msg $ES2
7122 }
7123
7124 case "$1" in
7125   start)
7126         # No-op
7127         ;;
7128   restart|reload|force-reload)
7129         echo "Error: argument '$1' not supported" >&2
7130         exit 3
7131         ;;
7132   stop)
7133         do_stop
7134         ;;
7135   *)
7136         echo "Usage: $0 start|stop" >&2
7137         exit 3
7138         ;;
7139 esac
7140
7141 :
7142 #! /bin/sh
7143 ### BEGIN INIT INFO
7144 # Provides:          umountnfs
7145 # Required-Start:    sendsigs
7146 # Required-Stop:
7147 # Default-Start:     6
7148 # Default-Stop:
7149 # Short-Description: Unmount all network filesystems except the root file system.
7150 # Description:       Also unmounts all virtual filesystems (proc, devfs, devpts,
7151 #                    usbfs, sysfs) that are not mounted at the top level.
7152 ### END INIT INFO
7153
7154 PATH=/usr/sbin:/usr/bin:/sbin:/bin
7155 KERNEL="$(uname -s)"
7156 RELEASE="$(uname -r)"
7157 . /lib/init/vars.sh
7158
7159 . /lib/lsb/init-functions
7160
7161 case "${KERNEL}:${RELEASE}" in
7162   Linux:[01].*|Linux:2.[01].*)
7163         FLAGS=""
7164         ;;
7165   Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*)
7166         FLAGS="-f"
7167         ;;
7168   *)
7169         FLAGS="-f -l"
7170         ;;
7171 esac
7172
7173 do_stop () {
7174         # Write a reboot record to /var/log/wtmp before unmounting
7175         halt -w
7176
7177         # Remove bootclean flag files (precaution against symlink attacks)
7178         rm -f /tmp/.clean /var/lock/.clean /var/run/.clean
7179
7180         [ "$VERBOSE" = no ] || log_action_begin_msg "Unmounting remote and non-toplevel virtual filesystems"
7181
7182         #
7183         # Make list of points to unmount in reverse order of their creation
7184         #
7185
7186         exec 9<&0 </proc/mounts
7187
7188         DIRS=""
7189         while read DEV MTPT FSTYPE REST
7190         do
7191                 case "$MTPT" in
7192                   /|/proc|/dev|/dev/pts|/dev/shm|/proc/*|/sys|/var/run|/var/lock)
7193                         continue
7194                         ;;
7195                 esac
7196                 case "$FSTYPE" in
7197                   nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs)
7198                         DIRS="$MTPT $DIRS"
7199                         ;;
7200                   proc|procfs|linprocfs|devfs|devpts|usbfs|usbdevfs|sysfs)
7201                         DIRS="$MTPT $DIRS"
7202                         ;;
7203                 esac
7204         done
7205
7206         exec 0<&9 9<&-
7207
7208         if [ "$DIRS" ]
7209         then
7210                 umount $FLAGS $DIRS
7211         fi
7212         ES=$?
7213
7214         [ "$VERBOSE" = no ] || log_action_end_msg $ES
7215 }
7216
7217 case "$1" in
7218   start)
7219         # No-op
7220         ;;
7221   restart|reload|force-reload)
7222         echo "Error: argument '$1' not supported" >&2
7223         exit 3
7224         ;;
7225   stop|"")
7226         do_stop
7227         ;;
7228   *)
7229         echo "Usage: umountnfs.sh [start|stop]" >&2
7230         exit 3
7231         ;;
7232 esac
7233
7234 :
7235 #! /bin/sh
7236 ### BEGIN INIT INFO
7237 # Provides:          umountroot
7238 # Required-Start:    umountfs
7239 # Required-Stop:     umountfs
7240 # Default-Start:     6
7241 # Default-Stop:
7242 # Short-Description: Mount the root filesystem read-only.
7243 ### END INIT INFO
7244
7245 PATH=/sbin:/bin
7246 . /lib/init/vars.sh
7247
7248 . /lib/lsb/init-functions
7249
7250 remount_ro () {
7251         local MTPT=$1
7252         [ "$VERBOSE" = no ] || log_action_begin_msg "Mounting $MTPT filesystem read-only"
7253         MOUNT_FORCE_OPT=
7254         [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
7255         # This:
7256         #     mount -n -o remount,ro /
7257         # will act on a bind mount of / if there is one.
7258         # See #339023 and the comment in checkroot.sh
7259         mount    $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev $MTPT 2>/dev/null \
7260         || mount $MOUNT_FORCE_OPT -n -o remount,ro              dummydev $MTPT 2>/dev/null \
7261         || mount $MOUNT_FORCE_OPT -n -o remount,ro                       $MTPT
7262         ES=$?
7263         [ "$VERBOSE" = no ] || log_action_end_msg $ES
7264 }
7265
7266 do_stop () {
7267         # These directories must exist on the root filesystem as they are
7268         # targets for system mountpoints.  We've just unmounted all other
7269         # filesystems, so either they are mounted now (in which case the
7270         # mount point exists) or we can make the mountpoint.
7271         for dir in /proc /sys /var/run /var/lock; do
7272             mkdir -p $dir || true
7273         done
7274         exec 9<&0 < /proc/mounts
7275
7276         REG_MTPTS=""
7277         TMPFS_MTPTS=""
7278         while read DEV MTPT FSTYPE REST
7279         do
7280                 case "$MTPT" in
7281                   /proc|/dev|/.dev|/dev/pts|/dev/shm|/proc/*|/sys|/var/run|/var/lock)
7282                         continue
7283                         ;;
7284                 esac
7285                 case "$FSTYPE" in 
7286                   proc|procfs|linprocfs|devfs|sysfs|usbfs|usbdevfs|devpts|tmpfs)
7287                         continue
7288                         ;;
7289                   *)
7290                         remount_ro $MTPT
7291                         ;;
7292                 esac
7293         done
7294
7295         exec 0<&9 9<&-
7296 }
7297
7298 case "$1" in
7299   start)
7300         # No-op
7301         ;;
7302   restart|reload|force-reload)
7303         echo "Error: argument '$1' not supported" >&2
7304         exit 3
7305         ;;
7306   stop)
7307         do_stop
7308         ;;
7309   *)
7310         echo "Usage: $0 start|stop" >&2
7311         exit 3
7312         ;;
7313 esac
7314
7315 :
7316 #! /bin/sh
7317 #
7318 # skeleton      example file to build /etc/init.d/ scripts.
7319 #               This file should be used to construct scripts for /etc/init.d.
7320 #
7321 #               Written by Miquel van Smoorenburg <miquels@cistron.nl>.
7322 #               Modified for Debian 
7323 #               by Ian Murdock <imurdock@gnu.ai.mit.edu>.
7324 #
7325 # Version:      @(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
7326 #
7327
7328 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
7329 DAEMON=/usr/sbin/uniconfd
7330 NAME=uniconfd
7331 DESC="UniConf daemon"
7332
7333 test -x $DAEMON || exit 0
7334
7335 # Include uniconf defaults if available
7336 if [ -f /etc/default/uniconfd ] ; then
7337         . /etc/default/uniconfd
7338 fi
7339
7340 DAEMON_OPTS="$UNICONFD_OPTS $UNICONFD_MOUNTS"
7341
7342 case "$1" in
7343   start)
7344         echo -n "Starting $DESC: "
7345         start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
7346                 --make-pidfile --background \
7347                 --exec $DAEMON -- -f $DAEMON_OPTS
7348         if [ "$?" != "0" ]; then ERR=$?; echo; exit $ERR; fi
7349         echo "$NAME."
7350         ;;
7351   stop)
7352         echo -n "Stopping $DESC: "
7353         start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
7354                 --exec $DAEMON
7355         if [ "$?" != "0" ]; then ERR=$?; echo; exit $ERR; fi
7356         echo "$NAME."
7357         ;;
7358   #reload)
7359         #
7360         #       If the daemon can reload its config files on the fly
7361         #       for example by sending it SIGHUP, do it here.
7362         #
7363         #       If the daemon responds to changes in its config file
7364         #       directly anyway, make this a do-nothing entry.
7365         #
7366         # echo "Reloading $DESC configuration files."
7367         # start-stop-daemon --stop --signal 1 --quiet --pidfile \
7368         #       /var/run/$NAME.pid --exec $DAEMON
7369   #;;
7370   restart|force-reload)
7371         #
7372         #       If the "reload" option is implemented, move the "force-reload"
7373         #       option to the "reload" entry above. If not, "force-reload" is
7374         #       just the same as "restart".
7375         #
7376         echo -n "Restarting $DESC: "
7377         start-stop-daemon --stop --quiet --pidfile \
7378                 /var/run/$NAME.pid --exec $DAEMON || exit $?
7379         sleep 1
7380         start-stop-daemon --start --quiet --pidfile \
7381                 /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
7382         if [ "$?" != "0" ]; then ERR=$?; echo; exit $ERR; fi
7383         echo "$NAME."
7384         ;;
7385   *)
7386         N=/etc/init.d/$NAME
7387         # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
7388         echo "Usage: $N {start|stop|restart|force-reload}" >&2
7389         exit 1
7390         ;;
7391 esac
7392
7393 exit 0
7394 #! /bin/sh
7395 ### BEGIN INIT INFO
7396 # Provides:          urandom
7397 # Required-Start:    $local_fs
7398 # Required-Stop:     $local_fs
7399 # Default-Start:     S
7400 # Default-Stop:      0 6
7401 # Short-Description: Save and restore random seed between restarts.
7402 # Description        This script saves the random seed between restarts.
7403 #                    It is called from the boot, halt and reboot scripts.
7404 ### END INIT INFO
7405
7406 [ -c /dev/urandom ] || exit 0
7407
7408 PATH=/usr/sbin:/usr/bin:/sbin:/bin
7409 SAVEDFILE=/var/lib/urandom/random-seed
7410 POOLSIZE=512
7411 [ -f /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)"
7412 . /lib/init/vars.sh
7413
7414 . /lib/lsb/init-functions
7415
7416 case "$1" in
7417   start|"")
7418         [ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator"
7419         # Load and then save $POOLSIZE bytes,
7420         # which is the size of the entropy pool
7421         if [ -f "$SAVEDFILE" ]
7422         then
7423                 # Handle locally increased pool size
7424                 SAVEDSIZE="$(find "$SAVEDFILE" -printf "%s")"
7425                 if [ "$SAVEDSIZE" -gt "$POOLSIZE" ]
7426                 then
7427                         [ -w /proc/sys/kernel/random/poolsize ] && echo $POOLSIZE > /proc/sys/kernel/random/poolsize
7428                         POOLSIZE=$SAVEDSIZE
7429                 fi
7430                 cat "$SAVEDFILE" >/dev/urandom
7431         fi
7432         rm -f $SAVEDFILE
7433         umask 077
7434         dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
7435         ES=$?
7436         umask 022
7437         [ "$VERBOSE" = no ] || log_action_end_msg $ES
7438         ;;
7439   stop)
7440         # Carry a random seed from shut-down to start-up;
7441         # see documentation in linux/drivers/char/random.c
7442         [ "$VERBOSE" = no ] || log_action_begin_msg "Saving random seed"
7443         umask 077
7444         dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
7445         ES=$?
7446         [ "$VERBOSE" = no ] || log_action_end_msg $ES
7447         ;;
7448   restart|reload|force-reload)
7449         echo "Error: argument '$1' not supported" >&2
7450         exit 3
7451         ;;
7452   *)
7453         echo "Usage: urandom start|stop" >&2
7454         exit 3
7455         ;;
7456 esac
7457
7458 :
7459 #!/bin/sh
7460
7461 test -x /usr/sbin/vbetool || exit 0
7462 set -e
7463
7464 . /lib/lsb/init-functions
7465
7466 test -f /etc/default/rcS && . /etc/default/rcS
7467 test -f /etc/default/acpi-support && . /etc/default/acpi-support
7468 test -f /usr/share/acpi-support/device-funcs && . /usr/share/acpi-support/device-funcs
7469
7470 case "$1" in
7471  start)
7472         if laptop-detect > /dev/null; then
7473                 LAPTOP=true;
7474         fi
7475
7476         if [ x$LAPTOP != xtrue ]; then
7477                 exit 0;
7478         fi
7479
7480         DeviceConfig
7481         log_begin_msg "Saving VESA state..."
7482         if [ "$SAVE_VBE_STATE" = "true" ]; then
7483             if [ "$VERBOSE" = no ]; then 
7484                 if ! vbetool vbestate save > $VBESTATE 2>/dev/null; then
7485                     log_end_msg $?
7486                     exit 1
7487                 fi
7488             else
7489                 if ! vbetool vbestate save > $VBESTATE ; then
7490                     log_end_msg $?
7491                     exit 1
7492                 fi
7493             fi
7494             log_end_msg 0
7495         fi
7496         ;;
7497  *)
7498         exit 0
7499         ;;
7500 esac
7501 #! /bin/sh
7502 ### BEGIN INIT INFO
7503 # Provides:          waitnfs
7504 # Required-Start:    $network $local_fs
7505 # Required-Stop:
7506 # Default-Start:     S
7507 # Default-Stop:
7508 # Short-Description: Wait for critical network file systems to be mounted
7509 # Description:       Network file systems are mounted in the background when
7510 #                    interfaces are brought up; this script waits for
7511 #                    those among them which are critical for booting to be
7512 #                    mounted before carrying on.
7513 #                    Specifically, it will wait for file systems mounted
7514 #                    on /usr, /usr/*, /var, /var/* 
7515 #                    This script WILL NOT wait on other network file which are
7516 #                    mounted elsewhere!
7517 ### END INIT INFO
7518
7519 [ -f /etc/default/rcS ] && . /etc/default/rcS
7520 . /lib/lsb/init-functions
7521
7522 do_start() {
7523         [ -f /etc/fstab ] || return
7524         #
7525         # Read through fstab line by line, building a list of networked
7526         # file systems mounted on /usr* or /var*
7527         # Wait up to a fixed period of time for these file systems to mount
7528         #
7529
7530         exec 9<&0 </etc/fstab
7531
7532         waitnfs=
7533         while read DEV MTPT FSTYPE OPTS REST
7534         do
7535                 case "$DEV" in
7536                   ""|\#*)
7537                         continue
7538                         ;;
7539                 esac
7540                 case "$OPTS" in
7541                   noauto|*,noauto|noauto,*|*,noauto,*)
7542                         continue
7543                         ;;
7544                 esac
7545                 case "$FSTYPE" in
7546                   nfs|nfs4|smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs)
7547                         ;;
7548                   *)
7549                         continue
7550                         ;;
7551                 esac
7552                 case "$MTPT" in
7553                   /usr/local|/usr/local/*)
7554                         ;;
7555                   /usr|/usr/*)
7556                         waitnfs="$waitnfs $MTPT"
7557                         ;;
7558                   /var|/var/*)
7559                         waitnfs="$waitnfs $MTPT"
7560                         ;;
7561                 esac
7562         done
7563
7564         exec 0<&9 9<&-
7565
7566         # Try mounting all networked filesystems here, just before waiting for
7567         # them; background this call so as not to block startup sequence
7568         /lib/init/mountall-net-fs &
7569
7570         # Wait for each path, the timeout is for all of them as that's
7571         # really the maximum time we have to wait anyway
7572         TIMEOUT=900
7573         for mountpt in $waitnfs; do
7574                 log_action_begin_msg "Waiting for $mountpt"
7575
7576                 while ! mountpoint -q $mountpt; do
7577                         sleep 0.1
7578
7579                         TIMEOUT=$(( $TIMEOUT - 1 ))
7580                         if [ $TIMEOUT -le 0 ]; then
7581                                 log_action_end_msg 1
7582                                 break
7583                         fi
7584                 done
7585
7586                 if [ $TIMEOUT -gt 0 ]; then
7587                         log_action_end_msg 0
7588                 fi
7589         done
7590 }
7591
7592 case "$1" in
7593     start)
7594         do_start
7595         ;;
7596     restart|reload|force-reload)
7597         echo "Error: argument '$1' not supported" >&2
7598         exit 3
7599         ;;
7600     stop)
7601         ;;
7602     *)
7603         echo "Usage: $0 start|stop" >&2
7604         exit 3
7605         ;;
7606 esac
7607
7608 : exit 0
7609 #!/bin/sh
7610
7611 ### BEGIN INIT INFO
7612 # Provides:          winbind
7613 # Required-Start:    $network $local_fs $remote_fs
7614 # Required-Stop:     $network $local_fs $remote_fs
7615 # Default-Start:     2 3 4 5
7616 # Default-Stop:      0 1 6
7617 # Short-Description: start Winbind daemon
7618 ### END INIT INFO
7619
7620
7621 PATH=/sbin:/bin:/usr/sbin:/usr/bin
7622
7623 [ -r /etc/default/winbind ] && . /etc/default/winbind
7624
7625 DAEMON=/usr/sbin/winbindd
7626 PIDDIR=/var/run/samba
7627
7628 # clear conflicting settings from the environment
7629 unset TMPDIR
7630
7631 # See if the daemon is there
7632 test -x $DAEMON || exit 0
7633
7634 . /lib/lsb/init-functions
7635
7636 case "$1" in
7637         start)
7638                 log_daemon_msg "Starting the Winbind daemon" "winbind"
7639
7640                 mkdir -p /var/run/samba/winbindd_privileged || return 1
7641                 chgrp winbindd_priv $PIDDIR/winbindd_privileged/ || return 1
7642                 chmod 0750 $PIDDIR/winbindd_privileged/ || return 1
7643                 start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- $WINBINDD_OPTS
7644
7645                 log_end_msg $?
7646                 ;;
7647
7648         stop)
7649                 log_daemon_msg "Stopping the Winbind daemon" "winbind"
7650                 start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
7651                 log_end_msg $?
7652                 ;;
7653
7654         restart|force-reload)
7655                 $0 stop && sleep 2 && $0 start
7656                 ;;
7657
7658         *)
7659                 echo "Usage: /etc/init.d/winbind {start|stop|restart|force-reload}"
7660                 exit 1
7661                 ;;
7662 esac
7663 #!/bin/sh
7664
7665 ### BEGIN INIT INFO
7666 # Provides:             wpa-ifupdown
7667 # Required-Start:       $network
7668 # Required-Stop:        $network
7669 # Should-Start:
7670 # Should-Stop:
7671 # Default-Start:
7672 # Default-Stop:         0 6
7673 # Short-Description:    Stop wpa_supplicant processes started via ifupdown
7674 # Description:          Run ifdown on interfaces authenticated via
7675 #                       wpa_supplicant. Sendsigs terminates wpa_supplicant
7676 #                       processes before networking is stopped causing each
7677 #                       network interface authenticated via a wpa_supplicant
7678 #                       daemon to be terminated abrubtly.
7679 ### END INIT INFO
7680
7681 PATH=/usr/sbin:/usr/bin:/sbin:/bin
7682
7683 test -d /var/run || exit 0
7684
7685 test -x /sbin/ifdown || exit 0
7686
7687 . /lib/lsb/init-functions
7688
7689 stop_wpa_action () {
7690         test -x /sbin/wpa_action || return
7691         unset IFACES
7692         IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_action.*.pid' -printf '%P\n' | cut -d'.' -f2)
7693         if test -n "$IFACES"; then
7694                 log_daemon_msg "Stopping wpa_action roaming interfaces"
7695                 for iface in $IFACES; do
7696                         log_progress_msg "$iface"
7697                         # wpa_action executes /sbin/ifdown
7698                         wpa_action "$iface" stop >/dev/null 2>&1
7699                 done
7700                 log_end_msg 0
7701         fi
7702 }
7703
7704 stop_wpa_supplicant () {
7705         unset IFACES
7706         IFACES=$(find /var/run -maxdepth 1 -type f -name 'wpa_supplicant.*.pid' -printf '%P\n' | cut -d'.' -f2)
7707         if test -n "$IFACES"; then
7708                 log_daemon_msg "Stopping wpa_supplicant interfaces"
7709                 for iface in $IFACES; do
7710                         log_progress_msg "$iface"
7711                         ifdown $iface >/dev/null 2>&1
7712                 done
7713                 log_end_msg 0
7714         fi
7715 }
7716
7717 case "$1" in
7718         start|restart|force-reload)
7719                 # No-op
7720                 ;;
7721         stop)
7722                 stop_wpa_action
7723                 stop_wpa_supplicant
7724                 ;;
7725         *)
7726                 echo "Usage: $0 {start|stop|restart|force-reload}" >&2
7727                 exit 3
7728                 ;;
7729 esac
7730
7731 exit 0
7732 #!/bin/sh
7733 # /etc/init.d/x11-common: set up the X server and ICE socket directories
7734 ### BEGIN INIT INFO
7735 # Provides:          x11-common
7736 # Required-Start:    $local_fs $remote_fs
7737 # Required-Stop:     $local_fs $remote_fs
7738 # Should-Start:      $named
7739 # Should-Stop:       $named
7740 # Default-Start:     S
7741 # Default-Stop:
7742 ### END INIT INFO
7743
7744 set -e
7745
7746 PATH=/bin:/usr/bin:/sbin:/usr/sbin
7747 SOCKET_DIR=/tmp/.X11-unix
7748 ICE_DIR=/tmp/.ICE-unix
7749
7750 . /lib/lsb/init-functions
7751 if [ -f /etc/default/rcS ]; then
7752   . /etc/default/rcS
7753 fi
7754
7755 do_restorecon () {
7756   # Restore file security context (SELinux).
7757   if which restorecon >/dev/null 2>&1; then
7758     restorecon "$1"
7759   fi
7760 }
7761
7762 set_up_socket_dir () {
7763   if [ "$VERBOSE" != no ]; then
7764     log_begin_msg "Setting up X server socket directory $SOCKET_DIR..."
7765   fi
7766   if [ -e $SOCKET_DIR ] && [ ! -d $SOCKET_DIR ]; then
7767     mv $SOCKET_DIR $SOCKET_DIR.$$
7768   fi
7769   mkdir -p $SOCKET_DIR
7770   chown 0:0 $SOCKET_DIR
7771   chmod 1777 $SOCKET_DIR
7772   do_restorecon $SOCKET_DIR
7773   [ "$VERBOSE" != no ] && log_end_msg 0 || return 0
7774 }
7775
7776 set_up_ice_dir () {
7777   if [ "$VERBOSE" != no ]; then
7778     log_begin_msg "Setting up ICE socket directory $ICE_DIR..."
7779   fi
7780   if [ -e $ICE_DIR ] && [ ! -d $ICE_DIR ]; then
7781     mv $ICE_DIR $ICE_DIR.$$
7782   fi
7783   mkdir -p $ICE_DIR
7784   chown 0:0 $ICE_DIR
7785   chmod 1777 $ICE_DIR
7786   do_restorecon $ICE_DIR
7787   [ "$VERBOSE" != no ] && log_end_msg 0 || return 0
7788 }
7789
7790 do_status () {
7791     if [ -d $ICE_DIR ] && [ -d $SOCKET_DIR ]; then
7792       return 0
7793     else
7794       return 4
7795     fi
7796 }
7797
7798 case "$1" in
7799   start)
7800     set_up_socket_dir
7801     set_up_ice_dir
7802   ;;
7803
7804   restart|reload|force-reload)
7805     /etc/init.d/x11-common start
7806   ;;
7807
7808   stop)
7809    :
7810   ;;
7811
7812   status)
7813     do_status
7814   ;;
7815   *)
7816     log_success_msg "Usage: /etc/init.d/x11-common {start|stop|status|restart|reload|force-reload}"
7817     exit 1
7818     ;;
7819 esac
7820
7821 exit 0
7822
7823 # vim:set ai et sts=2 sw=2 tw=0: