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