Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
Warning: Cannot modify header information - headers already sent by (output started at /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code:102) in /var/www/iplanru/data/www/intesco.ru/d59ed/index.php(1) : eval()'d code(2) : eval()'d code on line 4
PK +#Y[_l
hwclock.shnu W+A #!/bin/sh
# hwclock.sh Set and adjust the CMOS clock, according to the UTC
# setting in /etc/default/rcS (see also rcS(5)).
#
# Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl
#
# Patches:
# 2000-01-30 Henrique M. Holschuh
# - Minor cosmetic changes in an attempt to help new
# users notice something IS changing their clocks
# during startup/shutdown.
# - Added comments to alert users of hwclock issues
# and discourage tampering without proper doc reading.
# WARNING: Please read /usr/share/doc/util-linux/README.Debian.hwclock
# before changing this file. You risk serious clock
# misbehaviour otherwise.
### BEGIN INIT INFO
# Provides: hwclock
# Required-Start: checkroot
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
### END INIT INFO
FIRST=no # debian/rules sets this to 'yes' when creating hwclockfirst.sh
# Set this to any options you might need to give to hwclock, such
# as machine hardware clock type for Alphas.
HWCLOCKPARS=
# Set this to the hardware clock device you want to use, it should
# probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option.
HCTOSYS_DEVICE=rtc0
hwclocksh()
{
[ ! -x /sbin/hwclock ] && return 0
[ ! -r /etc/default/rcS ] || . /etc/default/rcS
. /lib/lsb/init-functions
verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
[ "$GMT" = "-u" ] && UTC="yes"
case "$UTC" in
no|"") GMT="--localtime"
UTC=""
if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then
if [ -z "$TZ" ]; then
log_action_msg "System clock was not updated at this time"
return 1
fi
fi
;;
yes) GMT="--utc"
UTC="--utc"
;;
*) log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;;
esac
case "$BADYEAR" in
no|"") BADYEAR="" ;;
yes) BADYEAR="--badyear" ;;
*) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
esac
case "$1" in
start)
if [ -d /dev/.udev ]; then
return 0
fi
if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
echo "0.0 0 0.0" > /etc/adjtime
fi
if [ ! -w /etc/adjtime ]; then
NOADJ="--noadjfile"
else
NOADJ=""
fi
if [ "$FIRST" != yes ]; then
# Uncomment the hwclock --adjust line below if you want
# hwclock to try to correct systematic drift errors in the
# Hardware Clock.
#
# WARNING: If you uncomment this option, you must either make
# sure *nothing* changes the Hardware Clock other than
# hwclock --systohc, or you must delete /etc/adjtime
# every time someone else modifies the Hardware Clock.
#
# Common "vilains" are: ntp, MS Windows, the BIOS Setup
# program.
#
# WARNING: You must remember to invalidate (delete)
# /etc/adjtime if you ever need to set the system clock
# to a very different value and hwclock --adjust is being
# used.
#
# Please read /usr/share/doc/util-linux/README.Debian.hwclock
# before enabling hwclock --adjust.
#/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --adjust $GMT $BADYEAR
:
fi
if [ "$HWCLOCKACCESS" != no ]; then
log_action_msg "Setting the system clock"
# Copies Hardware Clock time to System Clock using the correct
# timezone for hardware clocks in local time, and sets kernel
# timezone. DO NOT REMOVE.
if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
# Announce the local time.
verbose_log_action_msg "System Clock set to: `date $UTC`"
else
log_warning_msg "Unable to set System Clock to: `date $UTC`"
fi
else
verbose_log_action_msg "Not setting System Clock"
fi
;;
stop|restart|reload|force-reload)
#
# Updates the Hardware Clock with the System Clock time.
# This will *override* any changes made to the Hardware Clock.
#
# WARNING: If you disable this, any changes to the system
# clock will not be carried across reboots.
#
if [ ! -w /etc/adjtime ]; then
NOADJ="--noadjfile"
else
NOADJ=""
fi
if [ "$HWCLOCKACCESS" != no ]; then
log_action_msg "Saving the system clock"
if [ "$GMT" = "-u" ]; then
GMT="--utc"
fi
if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
verbose_log_action_msg "Hardware Clock updated to `date`"
fi
else
verbose_log_action_msg "Not saving System Clock"
fi
;;
show)
if [ ! -w /etc/adjtime ]; then
NOADJ="--noadjfile"
else
NOADJ=""
fi
if [ "$HWCLOCKACCESS" != no ]; then
/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ
fi
;;
*)
log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}"
log_success_msg " start sets kernel (system) clock from hardware (RTC) clock"
log_success_msg " stop and reload set hardware (RTC) clock from kernel (system) clock"
return 1
;;
esac
}
hwclocksh "$@"
PK +#Y[hBc rebootnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: reboot
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop: 6
# Short-Description: Execute the reboot command.
# Description:
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/lsb/init-functions
do_stop () {
# Message should end with a newline since kFreeBSD may
# print more stuff (see #323749)
log_action_msg "Will now restart"
reboot -d -f -i
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
PK +#Y[ۺhe e sambanu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: samba
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: slapd
# Should-Stop: slapd
# Short-Description: start Samba daemons (nmbd and smbd)
### END INIT INFO
# Defaults
RUN_MODE="daemons"
# Reads config file (will override defaults above)
[ -r /etc/default/samba ] && . /etc/default/samba
PIDDIR=/var/run/samba
NMBDPID=$PIDDIR/nmbd.pid
SMBDPID=$PIDDIR/smbd.pid
# clear conflicting settings from the environment
unset TMPDIR
# See if the daemons are there
test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting Samba daemons"
# Make sure we have our PIDDIR, even if it's on a tmpfs
install -o root -g root -m 755 -d $PIDDIR
NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null`
if [ "$NMBD_DISABLED" != 'Yes' ]; then
log_progress_msg "nmbd"
if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D
then
log_end_msg 1
exit 1
fi
fi
if [ "$RUN_MODE" != "inetd" ]; then
log_progress_msg "smbd"
if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D; then
log_end_msg 1
exit 1
fi
fi
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping Samba daemons"
log_progress_msg "nmbd"
start-stop-daemon --stop --quiet --pidfile $NMBDPID
# Wait a little and remove stale PID file
sleep 1
if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
then
# Stale PID file (nmbd was succesfully stopped),
# remove it (should be removed by nmbd itself IMHO.)
rm -f $NMBDPID
fi
if [ "$RUN_MODE" != "inetd" ]; then
log_progress_msg "smbd"
start-stop-daemon --stop --quiet --pidfile $SMBDPID
# Wait a little and remove stale PID file
sleep 1
if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
then
# Stale PID file (nmbd was succesfully stopped),
# remove it (should be removed by smbd itself IMHO.)
rm -f $SMBDPID
fi
fi
log_end_msg 0
;;
reload)
log_daemon_msg "Reloading /etc/samba/smb.conf" "smbd only"
start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
log_end_msg 0
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
status)
status="0"
NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' 2>/dev/null`
if [ "$NMBD_DISABLED" != "Yes" ]; then
status_of_proc -p $NMBDPID /usr/sbin/nmbd nmbd || status=$?
fi
if [ "$RUN_MODE" != "inetd" ]; then
status_of_proc -p $SMBDPID /usr/sbin/smbd smbd || status=$?
fi
if [ "$NMBD_DISABLED" = "Yes" -a "$RUN_MODE" = "inetd" ]; then
status="4"
fi
exit $status
;;
*)
echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}"
exit 1
;;
esac
exit 0
PK +#Y[݁o o sendmailnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: sendmail
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: powerful, efficient, and scalable Mail Transport Agent
# Description: Sendmail is an alternative Mail Transport Agent (MTA)
# for Debian. It is suitable for handling sophisticated
# mail configurations, although this means that its
# configuration can also be complex. Fortunately, simple
# thing can be done easily, and complex thing are possible,
# even if not easily understood ;) Sendmail is the *ONLY*
# MTA with a Turing complete language to control *ALL*
# aspects of delivery!
### END INIT INFO
# Author: Marc-Christian Petersen
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="Mail Transport Agent (MTA)"
NAME=sendmail
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/sendmail ] && . /etc/default/sendmail
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
. /lib/lsb/init-functions
#!/bin/sh
#-----------------------------------------------------------------------------
# $Sendmail: sm_helper.sh,v 8.14.3 2010-09-21 11:05:34 cowboy Exp $
#
# Copyright (c) 1998-2009 Richard Nelson. All Rights Reserved.
#
# Debian helper function script for Debian Sendmail
# Note: this file supports 8.7.6 - 9.0.0
#
# Notes (to all):
# *
#
# Notes (to self):
# * clean_queues fubar, esp wrt MSP
#
#-----------------------------------------------------------------------------
#
DEBUG=0;
# Support stand-alone execution
if [ -z "$DAEMON" ]; then
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="Mail Transport Agent (MTA)"
NAME=sendmail
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS=""
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/sendmail ] && . /etc/default/sendmail
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
. /lib/lsb/init-functions
fi;
# Can't do this earlier, the lsb inclusion is unsafe :(
set -e;
#------------------------------------------------------------------------------
# Parameters for the sendmail daemon
# Do *NOT* touch these lines, instead, edit /etc/mail/sendmail.conf
# The _PARMS lines are listed in precedence order
#------------------------------------------------------------------------------
Get_Parameters () {
# Main configuration parameters in /etc/mail/sendmail.conf
DAEMON_MODE='Daemon';
DAEMON_PARMS='';
DAEMON_UID='root';
QUEUE_MODE="$DAEMON_MODE";
QUEUE_INTERVAL='10m';
QUEUE_PARMS='';
MSP_MODE="$QUEUE_MODE";
MSP_INTERVAL="$QUEUE_INTERVAL";
MSP_PARMS="";
MISC_PARMS='';
CRON_PARMS='';
LOG_CMDS='No';
# Secondary (non-documented) parameters in /etc/mail/sendmail.conf
# Caveat Emptor: change these at your own risk - they impact several
# disjoint pieces parts...
SENDMAIL_ROOT='/var/run/sendmail';
MTA_DAEMON='/usr/sbin/sendmail-mta';
MTA_COMMAND='/usr/sbin/sendmail-mta';
MTA_A='-Am';
MTAL_L='-L sm-mta';
MTAL_L_QUEUE='-L sm-mta-queue';
MTAL_L_RUNQ='-L sm-mta-runq';
MTA_ROOT="${SENDMAIL_ROOT}/mta";
MTAL_PIDFILE="${MTA_ROOT}/sendmail.pid";
MTAL_SOCKET="${MTA_ROOT}/smsocket";
MTAL_CNTL="${MTA_ROOT}/smcontrol";
MTAQ_L='-L sm-que';
MTAQ_L_RUNQ='-L sm-que-runq';
MTAQ_PIDFILE="${MTA_ROOT}/queue.pid";
MTAQ_SOCKET="${MTA_ROOT}/qusocket";
MTAQ_CNTL="${MTA_ROOT}/qucontrol";
MSP_DAEMON='/usr/sbin/sendmail-msp';
MSP_COMMAND='/usr/sbin/sendmail-msp';
MSP_A='-Ac';
MSP_L='-L sm-msp';
MSP_L_QUEUE='-L sm-msp-queue';
MSP_ROOT="${SENDMAIL_ROOT}/msp";
MSP_PIDFILE="${MSP_ROOT}/sendmail.pid";
MSP_SOCKET="${MSP_ROOT}/smsocket";
MSP_CNTL="${MSP_ROOT}/smcontrol";
# Pull in any user modified variables
if [ -f /etc/mail/sendmail.conf ]; then
. /etc/mail/sendmail.conf;
fi;
# These can't be user customized
SM_Get_Parameters='yes';
PATH='/bin:/usr/bin:/sbin:/usr/sbin';
STAMP_DIR="${SENDMAIL_ROOT}/stampdir";
START_MTAL_CMD="start-stop-daemon \
--pidfile $MTAL_PIDFILE \
--exec $MTA_DAEMON \
--startas $MTA_COMMAND \
--start";
STOP_MTAL_CMD="start-stop-daemon \
--pidfile $MTAL_PIDFILE \
--name sendmail-mta \
--stop";
SIGNAL_MTAL_CMD="start-stop-daemon \
--pidfile $MTAL_PIDFILE \
--name sendmail-mta \
--stop";
START_MTAQ_CMD="start-stop-daemon \
--pidfile $MTAQ_PIDFILE \
--make-pidfile \
--exec $MTA_DAEMON \
--startas $MTA_COMMAND \
--start";
STOP_MTAQ_CMD="start-stop-daemon \
--pidfile $MTAQ_PIDFILE \
--name sendmail-mta \
--stop";
SIGNAL_MTAQ_CMD="start-stop-daemon \
--pidfile $MTAQ_PIDFILE \
--name sendmail-mta \
--stop";
START_MSP_CMD="start-stop-daemon \
--pidfile $MSP_PIDFILE \
--exec $MSP_DAEMON \
--startas $MSP_COMMAND \
--chuid smmsp \
--start";
STOP_MSP_CMD="start-stop-daemon \
--pidfile $MSP_PIDFILE \
--name sendmail-msp \
--stop";
SIGNAL_MSP_CMD="start-stop-daemon \
--pidfile $MSP_PIDFILE \
--name sendmail-msp \
--stop";
NAME='sendmail';
FLAGS='defaults 50';
# Sanitize some keyword entries
DAEMON_MODE=$(echo "$DAEMON_MODE" | tr '[:upper:]' '[:lower:]');
QUEUE_MODE=$(echo "$QUEUE_MODE" | tr '[:upper:]' '[:lower:]');
MSP_MODE=$(echo "$MSP_MODE" | tr '[:upper:]' '[:lower:]');
# See if we can share the listener and queue-runner daemon:
# * Both must be in daemon mode
# * They must have the same (possibly empty) parameters
if [ "$DAEMON_MODE" = "daemon" \
-a \( \( "$QUEUE_MODE" = "cron" -o "$QUEUE_MODE" = "none" \) \
-o \( "$QUEUE_MODE" != "cron" \
-a "$QUEUE_MODE" != "none" \
-a "$DAEMON_PARMS" = "$QUEUE_PARMS" \
\) \
\) ]; then
SPLIT_DAEMON=0;
else
SPLIT_DAEMON=1;
fi;
# Version dependant support:
# 8.12.0+ M{TA,MSP}_A
if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
MTA_A='';
MTAL_L='';
MTAL_L_QUEUE='';
MSP_A='';
MSP_L='';
MSP_L_QUEUE='';
fi;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# enhanced sendmail startup
#------------------------------------------------------------------------------
start_mta () {
local result;
result=0;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# If already running, don't start it...
if is_running mta; then
log_warning_msg 'MTA is already running.';
return 1;
fi;
#
# Check if we're going to run a daemon (and how many):
daemon_check || result=$?;
if [ "$result" -ne 0 ]; then
return 0;
fi;
#
# Mark restarted for communication betwixt here and /etc/mail/Makefile
touch $STAMP_DIR/reload;
#
if [ "$DAEMON_MODE" = "daemon" ]; then
#
# Allow Unix (local) connections betwixt MSP/MTA:
touch $MTAL_SOCKET;
#
# We can only afford to clean the MTA queues if running daemon mode,
# otherwise, there is a chance that a cronjob might still be using
# the queue... Thats also why we don't clean the MSP queues herein.
#clean_queues;
#
# cd to a safe place to stash core files...
cd $MTA_ROOT;
CMD="$START_MTAL_CMD -- $MTAL_PARMS";
if [ "$LOG_CMDS" = "Yes" ]; then
logger -i -p mail.debug -- "$0 $CMD";
fi;
$CMD &
#
# Update permissions on smsocket
sleep 2;
chown $DAEMON_UID:smmsp $MTAL_SOCKET;
chmod 0666 $MTAL_SOCKET;
fi;
#
# Check for split daemon mode (separate listener/queue runner)
if [ "$SPLIT_DAEMON" -eq 1 ]; then
CMD="$START_MTAQ_CMD -- $MTAQ_PARMS";
if [ "$LOG_CMDS" = "Yes" ]; then
logger -i -p mail.debug -- "$0 $CMD";
fi;
$CMD &
sleep 2;
qp=`expr "${MTAQ_PARMS}" : '.*\(-qp[0-9]*[smhdw]\)'` || true;
if [ -z "$qp" ]; then
chmod 0664 $MTAQ_PIDFILE;
else
qc=`ps --no-headers -fCsendmail \
| egrep -e 'Queue control' \
| awk '{print $2}'`;
if [ -z "$qc" ]; then
rm -f $MTAQ_PIDFILE;
else
chmod 0664 $MTAQ_PIDFILE;
printf "$qc\n$MTA_COMMAND $MTAQ_PARMS" > $MTAQ_PIDFILE;
fi;
fi;
fi;
#
# if running split service, run the client queues (just to make sure)
if check_msp; then
$MSP_COMMAND -q $MSP_A $MSP_L_QUEUE $MSP_PARMS $MISC_PARMS;
fi;
return $result;
};
start_msp () {
local result;
result=0;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# If already running, don't start it...
if is_running msp; then
log_warning_msg 'MSP is already running.';
return 1;
fi;
#
# Check to see if MSP mode is indeed available
if ! check_msp; then
return 0;
fi;
#
# Check if we're going to run a daemon:
if [ "$MSP_MODE" != 'daemon' ]; then
return 0;
fi;
#
# We can only afford to clean the MSP queues if running daemon mode,
# otherwise, there is a chance that a cronjob might still be using
# the queue... Thats also why we don't clean the MTA queues herein.
#clean_queues /var/spool/mqueue-client;
#
# cd to a safe place to stash core files...
cd $MSP_ROOT;
$START_MSP_CMD -- \
$MSP_A $MSP_L -q${MSP_INTERVAL} $MSP_PARMS $MISC_PARMS &
return $result;
};
start_sendmail () {
local result;
# Update databases
make_databases;
result=0;
start_mta || result=$?;
if check_msp; then
start_msp || true;
fi;
return $result;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# enhanced sendmail reload
#------------------------------------------------------------------------------
reload_mta () {
local result;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# Update databases
make_databases;
#
# reload (signal -HUP) is *much* better/faster than stop/start
#
# Mark restarted for communication betwixt here and /etc/mail/Makefile
touch $STAMP_DIR/reload;
#
# If not running, just start it...
if ! is_running mta; then
start_mta;
fi;
#
# Is running, must signal it...
result=0;
$SIGNAL_MTAL_CMD --signal HUP --oknodo --quiet || result=$?;
sleep 2;
chown $DAEMON_UID:smmta $MTAL_SOCKET;
chmod 0666 $MTAL_SOCKET;
#
# Check for split daemon mode (separate listener/queue runner)
if [ "$SPLIT_DAEMON" -eq 1 ]; then
$SIGNAL_MTAQ_CMD --signal HUP --oknodo --quiet || true;
fi;
return $result;
};
reload_msp () {
local result;
result=0;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# reload (signal -HUP) is *much* better/faster than stop/start
#
# If not running, just start it...
if ! is_running msp; then
start_msp;
fi;
#
# Is running, must signal it...
$SIGNAL_MSP_CMD --signal HUP --oknodo --quiet || result=$?;
return $result;
};
reload_sendmail () {
local result;
result=0;
reload_mta || result=$?;
if check_msp; then
reload_msp || true;
fi;
return $result;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# enhanced sendmail shutdown
#------------------------------------------------------------------------------
stop_mta () {
local result cnt;
result=0;
stopped=0;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# If not running, don't stop it...
if ! is_running mta; then
return 0;
fi;
#
# Is running, must stop it...
$STOP_MTAL_CMD --signal TERM --quiet --oknodo > /dev/null;
#
# Now we have to wait until sendmail has _really_ stopped.
#
sleep 2;
if $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; then
log_progress_msg ' Waiting .';
cnt=0;
while $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; do
cnt=`expr $cnt + 1`;
if [ $cnt -gt 60 ]; then
#
# Waited 120 seconds now. Fail.
#
echo -n ' Failed ';
stopped=1;
break;
fi;
sleep 2;
log_progress_msg '.';
done;
echo -n ' Done ';
fi;
#
# Remove pidfile iff stopped
if ! $STOP_MTAL_CMD --signal TERM --quiet > /dev/null; then
rm -f "$MTAL_PIDFILE";
fi
return $result;
};
stop_queue () {
local result cnt;
result=0;
stopped=0;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# If not running, don't stop it...
if ! is_running queue; then
return 0;
fi;
#
# Is running, must stop it...
$STOP_MTAQ_CMD --signal TERM --quiet --oknodo > /dev/null;
#
# Now we have to wait until sendmail has _really_ stopped.
#
sleep 2;
if $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; then
log_progress_msg ' Waiting .';
cnt=0;
while $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; do
cnt=`expr $cnt + 1`;
if [ $cnt -gt 60 ]; then
#
# Waited 120 seconds now. Fail.
#
echo -n ' Failed ';
stopped=1;
break;
fi;
sleep 2;
log_progress_msg '.';
done;
echo -n ' Done ';
fi;
#
# Remove pidfile iff stopped
if ! $STOP_MTAQ_CMD --signal TERM --quiet > /dev/null; then
rm -f "$MTAQ_PIDFILE";
fi
return $result;
};
stop_msp () {
local result cnt;
result=0;
stopped=0;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# If not running, don't stop it...
if ! is_running msp; then
return 0;
fi;
#
# Is running, must stop it...
$STOP_MSP_CMD --signal TERM --quiet --oknodo > /dev/null;
#
# Now we have to wait until sendmail has _really_ stopped.
#
sleep 2;
if $STOP_MSP_CMD --signal TERM --quiet > /dev/null; then
log_progress_msg 'Waiting .';
cnt=0;
while $STOP_MSP_CMD --signal TERM --quiet > /dev/null; do
cnt=`expr $cnt + 1`;
if [ $cnt -gt 60 ]; then
#
# Waited 120 seconds now. Fail.
#
echo -n ' Failed ';
stopped=1;
break;
fi;
sleep 2;
log_progress_msg '.';
done;
echo -n ' Done ';
fi;
#
# Remove pidfile iff stopped
if ! $STOP_MSP_CMD --signal TERM --quiet > /dev/null; then
rm -f "$MSP_PIDFILE";
fi;
return $result;
};
stop_sendmail () {
local result;
result=0;
if check_msp; then
stop_msp || true;
fi;
stop_mta || result=$?;
stop_queue || true;
return $result;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Check to see if sendmail is running
#------------------------------------------------------------------------------
is_running () {
local result;
result=1;
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# Determine proper pidfile to check
who=$(echo "$1" | tr '[:upper:]' '[:lower:]');
case $who in
mta)
PIDFILE="$MTAL_PIDFILE";
;;
queue)
PIDFILE="$MTAQ_PIDFILE";
;;
msp)
PIDFILE="$MSP_PIDFILE";
;;
*)
PIDFILE="$1";
;;
esac;
#
# If no pidfile, not running
# Extract pid/command and see if still running
# Remove pidfile if app didn't
# Also remove any control sockets
if [ -s $PIDFILE ]; then
PID=`head -n 1 $PIDFILE 2>/dev/null`;
COMMAND=`tail -n 1 $PIDFILE`;
if [ ! -z "`ps --no-heading $PID`" ]; then
result=0;
else
rm -f $PIDFILE;
case $who in
mta)
rm -f $MTAL_SOCKET $MTAL_CNTL;
;;
queue)
rm -f $MTAQ_SOCKET $MTAQ_CNTL;
;;
msp)
rm -f $MSP_SOCKET $MSP_CNTL;
esac;
fi;
fi;
return $result;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Check to see if running split service (MTA, MSP)
# Must be at 8.12.0+ for this support
#------------------------------------------------------------------------------
check_msp () {
local result;
result=1;
if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
result=1;
elif [ -s /etc/mail/submit.cf ] \
&& [ -s /etc/mail/submit.mc ]; then
if grep -qEe "^[[:space:]]*\`?FEATURE\([[:space:]]*\`?msp" \
/etc/mail/submit.mc; then
result=0;
fi;
fi;
return $result;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Miscellaneous sendmail command support for MSP/MTA split
# mailstats, mailq, runq
#------------------------------------------------------------------------------
newaliases () {
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
$MTA_COMMAND $MTA_A -bi $*;
};
hoststat () {
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
$MTA_COMMAND $MTA_A -bh $*;
};
purgestat () {
local parms;
parms=$(echo "$1" | tr '[:upper:]' '[:lower:]');
case $parms in
n*) # Now
parms='-O Timeout.hoststatus=1s';
shift;
;;
*)
parms='';
;;
esac;
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
$MTA_COMMAND $MTA_A -bH $parms $*;
};
mailstats () {
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
# if running split service, show the client status first
if check_msp; then
echo 'MSP statistics...';
#check if we have a status file for the MSP
statusfile=$(grep -Ee '^O StatusFile=/.*' \
/etc/mail/submit.cf | cut -d= -f2);
if [ -n $statusfile ]; then
/usr/lib/sm.bin/mailstats -C \
/etc/mail/submit.cf $* || true;
fi;
echo 'MTA statistics...';
fi;
#
# check if we have a status file for the MTA
statusfile=$(grep -Ee '^O StatusFile=/.*' \
/etc/mail/sendmail.cf | cut -d= -f2);
if [ -n $statusfile ]; then
/usr/lib/sm.bin/mailstats $* || true;
fi;
};
mailq () {
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
# if running split service, show the client queues first
if check_msp; then
echo 'MSP Queue status...';
#
# Check to see if shared memory is in use (8.12.0+)
if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \
/etc/mail/submit.mc; then
$MSP_COMMAND -bP || true;
fi;
$MSP_COMMAND -bp $MSP_A $MISC_PARMS $* || true;
echo 'MTA Queue status...';
fi;
#
# Check to see if shared memory is in use (8.12.0+)
if grep -qEe "^[[:space:]]*\`?define\(\`?confSHAREDMEMORYKEY'?[[:space:]]*,[[:space:]]*\`?0*[1-9]+[0-9]*'?[[:space:]]*\)" \
/etc/mail/sendmail.mc; then
$MTA_COMMAND -bP || true;
fi;
$MTA_COMMAND -bp $MTA_A $MISC_PARMS $* || true;
};
runq () {
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
# if running split service, run the client queues first
if check_msp; then
echo 'Running the MSP queue...';
$MSP_COMMAND -q $MSP_A \
$MSP_L_QUEUE $MSP_PARMS $MISC_PARMS $* || true;
echo 'Running the MTA queues...';
fi;
if [ "$SPLIT_DAEMON" -eq 0 ]; then
$MTA_COMMAND -q $MTA_A \
$MTAL_L_RUNQ $QUEUE_PARMS $MISC_PARMS $* || true;
else
$MTA_COMMAND -q $MTA_A \
$MTAQ_L_RUNQ $QUEUE_PARMS $MISC_PARMS $* || true;
fi;
};
control () {
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
local parms;
parms="$*";
if [ -z "$parms" ]; then
parms='help';
fi;
if is_running mta; then
/usr/share/sendmail/smcontrol.pl $parms;
else
echo 'MTA: is not running';
fi;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Print status of running job(s)
#------------------------------------------------------------------------------
status () {
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
# if running split service, check the client status first
if check_msp; then
if is_running msp; then
echo "MSP: $PID $COMMAND";
ps -fwp $PID;
if [ -S ${MSP_CNTL} ]; then
/usr/share/sendmail/smcontrol.pl \
-f ${MSP_CNTL} status || true;
fi;
elif [ $MSP_MODE = 'cron' ]; then
echo "MSP: is run via cron ($MSP_INTERVAL)";
elif [ $MSP_MODE = 'none' ]; then
echo 'MSP: is disabled';
else
echo 'MSP: is not running';
fi;
fi;
#
# Check MTA listener
if is_running mta; then
echo "MTA: $PID $COMMAND";
ps -fwp $PID;
if [ -S ${MTAL_CNTL} ]; then
/usr/share/sendmail/smcontrol.pl \
-f ${MTAL_CNTL} status || true;
fi;
elif [ $DAEMON_MODE = 'inetd' ]; then
echo 'MTA: is run via inetd';
elif [ $DAEMON_MODE = 'none' ]; then
echo 'MTA: is disabled';
else
echo 'MTA: is not running';
fi;
#
# Check for split daemon mode (separate listener/queue runner)
if is_running queue; then
echo "QUE: $PID $COMMAND";
ps -fwp $PID;
if [ -S ${MTAQ_CNTL} ]; then
/usr/share/sendmail/smcontrol.pl \
-f ${MTAQ_CNTL} status || true;
fi;
elif [ $QUEUE_MODE = 'cron' ]; then
echo "QUE: is run via cron ($QUEUE_INTERVAL)";
elif [ $QUEUE_MODE = 'none' ]; then
echo 'QUE: is disabled';
elif [ "$SPLIT_DAEMON" -eq 0 ]; then
echo "QUE: Same as MTA";
else
echo 'QUE: is not running';
fi;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Cronjob handling
#------------------------------------------------------------------------------
cron_mta () {
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
# If cron not needed, don't do queue running (though it wouldn't hurt)
if [ $QUEUE_MODE = 'cron' ]; then
#
# If running a split (MTA/MSP) setup, we need to make sure that
# messages not immediately accepted by the MTA get delivered.
# Only run the MSP queue if MSP_MODE=none
if check_msp; then
if [ $MSP_MODE = 'none' ]; then
# Make sure only *ONE* cronjob at a time
if [ ! -f $STAMP_DIR/cron_msp ]; then
touch $STAMP_DIR/cron_msp;
#clean_queues /var/spool/mqueue-client;
$MSP_COMMAND -qf $MSP_A $MSP_L_QUEUE \
$MSP_PARMS $MISC_PARMS \
$CRON_PARMS || true;
rm -f $STAMP_DIR/cron_msp;
fi;
fi;
fi;
# Make sure only *ONE* cronjob at a time
if [ ! -f $STAMP_DIR/cron_mta ]; then
touch $STAMP_DIR/cron_mta;
$MTA_COMMAND -qf $MTA_A $MTAL_L_QUEUE \
$QUEUE_PARMS $MISC_PARMS $CRON_PARMS || true;
rm -f $STAMP_DIR/cron_mta;
fi;
fi;
};
cron_msp () {
#
# Make sure /var/run/sendmail/ exists
check_dirs;
#
# Obtain parameters IFF needed
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
#
# If cron not needed, don't do queue running (though it wouldn't hurt)
if [ $MSP_MODE = 'cron' ]; then
#
# If running a split (MTA/MSP) setup, we need to make sure that
# messages not immediately accepted by the MTA get delivered.
if check_msp; then
# Make sure only *ONE* cronjob at a time
if [ ! -f $STAMP_DIR/cron_msp ]; then
touch $STAMP_DIR/cron_msp;
#clean_queues /var/spool/mqueue-client;
$MSP_COMMAND -qf $MSP_A $MSP_L_QUEUE \
$MSP_PARMS $MISC_PARMS \
$CRON_PARMS || true;
rm -f $STAMP_DIR/cron_msp;
fi;
fi;
fi;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Determine how to run sendmail mta daemon
# * No daemon
# * As listener
# * As queue runner
# * As both listener and queue runner
#------------------------------------------------------------------------------
daemon_check () {
local run_daemon;
#
# Skip daemon run for the following:
# * sendmail hasn't been configured
# * DAEMON_MODE = (none | inet) & QUEUE_MODE = (none | cron)
if [ ! -s /etc/mail/sendmail.cf ] || \
[ ! -s /etc/mail/sendmail.mc ]; then
log_failure_msg 'Not configured, not started.';
return 1;
fi;
MTAL_PARMS="$MTA_A $MTAL_L";
MTAQ_PARMS="$MTA_A $MTAQ_L";
run_daemon=3;
case "$DAEMON_MODE" in
none* | \
inetd*)
run_daemon=`expr $run_daemon - 1`;
;;
daemon* | \
*)
MTAL_PARMS="$MTAL_PARMS -bd $DAEMON_PARMS";
;;
esac;
case "$QUEUE_MODE" in
none* | \
cron*)
run_daemon=`expr $run_daemon - 1`;
;;
daemon* | \
*)
# Check for split daemon mode (separate listener/queue runner)
if [ $SPLIT_DAEMON -eq 0 ]; then
if [ ! -z "$QUEUE_INTERVAL" ]; then
MTAL_PARMS="$MTAL_PARMS -q${QUEUE_INTERVAL}";
fi;
MTAL_PARMS="$MTAL_PARMS $QUEUE_PARMS";
else
if [ ! -z "$QUEUE_INTERVAL" ]; then
MTAQ_PARMS="$MTAQ_PARMS -q${QUEUE_INTERVAL}";
fi;
MTAQ_PARMS="$MTAQ_PARMS $QUEUE_PARMS";
fi;
;;
esac;
# Add any miscellanous (ie debugging) parameters
MTAL_PARMS="$MTAL_PARMS $MISC_PARMS";
MTAQ_PARMS="$MTAQ_PARMS $MISC_PARMS";
# Add PidFile override for MTA queue runner
MTAQ_PARMS="$MTAQ_PARMS -O PidFile=$MTAQ_PIDFILE";
MTAQ_PARMS="$MTAQ_PARMS -O ControlSocketName=$MTAQ_CNTL";
if [ $run_daemon -lt 2 ]; then
log_failure_msg 'listen/queue daemon not needed.';
return 1;
fi;
return 0;
};
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Simple routine to update the databases on start/refresh/restart
#------------------------------------------------------------------------------
make_databases () {
#
# Life is so much simpler with make
if test -x /usr/bin/make -a -f /etc/mail/Makefile; then
/usr/bin/make all -s -C /etc/mail >/dev/null;
#
# Here, all I could do would be handle a *few* database -
# quite frankly, it isn't worth it, someone will want yet another
else
echo "No make, you'll have to rebuild your databases by hand :(";
fi;
}
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# Clean sendmail queues (somewhat): does *not* support split qf/df/xf dirs.
# NOTE: This whole thing sucks with queue-groups, need to redo it!!!
# NOTE: Check for race conditions betwixt this code and queue-runners
#------------------------------------------------------------------------------
clean_queues () {
local QUEUE_ROOT QUEUE QUIET
# Obtain queue root directory
if [ -z "$1" ]; then
QUEUE_ROOT=/var/spool/mqueue
QUEUE=/var/spool/mqueue
QUIET=''
else
QUEUE_ROOT="$1"
QUEUE="$1"
QUIET='1'
fi
# remove lock files left because of kill/crash
# rm -f $QUEUE/[lnx]f* doesn't work with a plethora of files ;-(
for i in A B C D E F G H I J K L M N O P Q R S T U V W X Y Z \
a b c d e f g h i j k l m n o p q r s t u v w x y z; do
rm -f $QUEUE/[lnx]f${i}*
done
# remove zero length qf files
#for qffile in $QUEUE/qf*; do
for qffile in $(find $QUEUE_ROOT -type f -name 'qf*'); do
if [ -r "$qffile" ] && [ ! -s "$qffile" ]; then
if [ ! -z "$QUIET" ]; then
echo -n " "; fi
rm -f "$qffile"
fi
done
# rename tf files to be qf if the qf does not exist
for tffile in $QUEUE/tf*; do
qffile=`echo "$tffile" | sed 's/\/tf\([[:alnum:]]*\)$/\/qf\1/'`
if [ -r "$tffile" ] && [ ! -f "$qffile" ]; then
if [ ! -z "$QUIET" ]; then
echo -n " "; fi
mv "$tffile" "$qffile"
elif [ -f "$tffile" ]; then
echo -n " "
rm -f "$tffile"
fi
done
# remove df files with no corresponding qf files
for dffile in $QUEUE/df*; do
qffile=`echo "$dffile" | sed 's/\/df\([[:alnum:]]*\)$/\/qf\1/'`
Dffile=`echo "$dffile" | sed 's/\/df\([[:alnum:]]*\)$/\/Df\1/'`
if [ -r "$dffile" ] && [ ! -f "$qffile" ]; then
if [ ! -s "$dffile" ]; then
rm -f "$dffile"
else
if [ ! -z "$QUIET" ]; then
echo -n " "; fi
mv "$dffile" "$Dffile";
fi
fi
done
# announce files that have been saved during disaster recovery
for xffile in $QUEUE/[A-Z]f*; do
if [ -f "$xffile" ]; then
if [ ! -z "$QUIET" ]; then
echo -n " "; fi
fi
done
}
#------------------------------------------------------------------------------
#------------------------------------------------------------------------------
# check_dirs: Make sure /var/run/sendmail/{mta,msp,stampdir} exist
#------------------------------------------------------------------------------
check_dirs () {
if [ ! -d "${SENDMAIL_ROOT}" ]; then
mkdir -p "${SENDMAIL_ROOT}";
chown root:smmta "${SENDMAIL_ROOT}";
chmod 02755 "${SENDMAIL_ROOT}";
fi;
if [ ! -d "${MTA_ROOT}" ]; then
mkdir -p "${MTA_ROOT}";
chown $DAEMON_UID:smmta "${MTA_ROOT}";
chmod 02755 "${MTA_ROOT}";
fi;
if [ ! -d "${MSP_ROOT}" ]; then
mkdir -p "${MSP_ROOT}";
chown smmsp:smmsp "${MSP_ROOT}";
chmod 02775 "${MSP_ROOT}";
fi;
if [ ! -d "${STAMP_DIR}" ]; then
mkdir -p "${STAMP_DIR}";
chown root:smmsp "${STAMP_DIR}";
chmod 02775 "${STAMP_DIR}";
fi;
}
#------------------------------------------------------------------------------
# Why are we here ?
#------------------------------------------------------------------------------
# Some requisite initialization
if [ -z "$SM_Get_Parameters" ]; then
Get_Parameters;
fi;
if [ "$LOG_CMDS" = "Yes" ]; then
logger -i -p mail.debug -- "$0 $@";
fi;
#------------------------------------------------------------------------------
# Handle being called via an alias
#------------------------------------------------------------------------------
case $(basename $0) in
newaliases)
newaliases $*;
exit $?;
;;
hoststat)
hoststat $*;
exit $?;
;;
purgestat)
purgestat $*;
exit $?;
;;
mailstats)
mailstats $*;
exit $?;
;;
mailq)
mailq $*;
exit $?;
;;
runq)
runq $*;
exit $?;
;;
control|smcontrol)
control $*;
exit $?;
;;
status)
status $*
exit $?
;;
*)
: # Fall through and handle below
;;
esac;
#------------------------------------------------------------------------------
# Handle being called via /etc/init.d/sendmail or directly
#------------------------------------------------------------------------------
# Ok, why are we here...
case "$1" in
#-----------------------------------------------------------------------
# Debian required/optional targets:
#-----------------------------------------------------------------------
start)
log_daemon_msg "Starting $DESC" "$NAME";
start_sendmail;
log_end_msg $?;
;;
stop|force-stop)
log_daemon_msg "Stopping $DESC" "$NAME";
stop_sendmail;
log_end_msg $?;
;;
restart)
log_daemon_msg "Restarting $DESC" "$NAME";
# reload is equivalent (but faster) than stop/start !
# but... it doesn't honor changes to /etc/mail/sendmail.conf
#reload_sendmail;
stop_sendmail;
start_sendmail;
log_end_msg $?;
;;
restart-if-running)
if ! is_running mta && ! is_running msp; then
echo 'Mail Transport Agent: sendmail is not running';
else
$0 restart;
fi;
;;
reload-if-running)
if ! is_running mta && ! is_running msp; then
echo 'Mail Transport Agent: sendmail is not running';
else
$0 reload;
fi;
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME";
reload_sendmail;
log_end_msg $?;
;;
#-----------------------------------------------------------------------
# Local targets (sendmail commands/aliases) for MSP/MTA split support
# These targets will pass along any provided parameters
#-----------------------------------------------------------------------
newaliases)
shift;
newaliases $*;
;;
hoststat)
shift;
hoststat $*;
;;
purgestat)
shift;
purgestat $*;
;;
mailstats)
shift;
mailstats $*;
;;
mailq)
shift;
mailq $*;
;;
runq)
shift;
runq $*;
;;
control|smcontrol)
shift;
control $*;
;;
#-----------------------------------------------------------------------
# Local targets for extended support/debugging
#-----------------------------------------------------------------------
status)
shift;
status $*;
;;
debug)
#
# If not running, can't debug
if is_running msp; then
echo -n 'Dumping MSP state...';
$SIGNAL_MSP_CMD --signal USR1;
echo 'done.';
fi;
if is_running mta; then
echo -n 'Dumping MTA state...';
$SIGNAL_MTAL_CMD --signal USR1;
echo 'done.';
fi;
;;
clean|clean_que*|clean-que*)
#
# If running, don't clean the queues...
if is_running mta; then
echo 'MTA is running, queue cleaning ill advised...';
else
echo -n 'Cleaning up the queues...';
clean_queues;
echo 'done.';
fi;
;;
#-----------------------------------------------------------------------
# Local targets for cronjob support
#-----------------------------------------------------------------------
cron-msp)
cron_msp;
;;
cron-mta)
cron_mta;
;;
#-----------------------------------------------------------------------
# Default target - bitch and moan
#-----------------------------------------------------------------------
*)
echo "Invalid command <$1>";
echo "Usage: $0 ";
echo ' Where is one of the following';
echo ' start|stop|restart|restart-if-running';
echo ' reload-if-running|reload|force-reload';
echo ' newaliases|hoststat|purgestat|mailstats|mailq|runq|control';
echo ' status|debug|clean';
exit 1;
;;
esac;
exit 0;
PK +#Y[Tۛ# # mountoverflowtmpnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: mountoverflowtmp
# Required-Start: mountall-bootclean
# Required-Stop: umountfs
# Default-Start: S
# Default-Stop:
# Short-Description: mount emergency /tmp.
# Description: Mount a tmpfs on /tmp if there would
# otherwise be too little space to log in.
### END INIT INFO
. /lib/init/vars.sh
. /lib/lsb/init-functions
set -e
defs=/etc/default/mountoverflowtmp
test ! -f "$defs" || . "$defs"
: ${MINTMPKB:=1024}
if test "$MINTMPKB" = "0"; then exit 0; fi
case "$1" in
start)
[ "$VERBOSE" != no ] && log_action_begin_msg "Checking minimum space in /tmp"
df="`LC_ALL=C df -kP /tmp | grep -v Filesystem`"
set -- $df
avail="$4"
[ "$VERBOSE" != no ] && log_action_end_msg 0
if test $avail -lt "$MINTMPKB"; then
log_action_begin_msg "Mounting emergency tmpfs on /tmp"
mount -t tmpfs -o size=1048576,mode=1777 overflow /tmp
log_action_end_msg 0
fi
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
if LC_ALL=C mount | \
grep '^overflow on /tmp type tmpfs' >/dev/null; then
log_action_begin_msg "Unmounting any overflow tmpfs from /tmp"
umount overflow
log_action_end_msg 0
fi
;;
*)
echo "Usage: mountoverflowtmp [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[^X klogdnu W+A #! /bin/sh
# /etc/init.d/klogd: start the kernel log daemon.
### BEGIN INIT INFO
# Provides: klogd
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Kernel logger
### END INIT INFO
PATH=/bin:/usr/bin:/sbin:/usr/sbin
pidfile=/var/run/klogd.pid
binpath=/sbin/klogd
test -f $binpath || exit 0
test ! -r /etc/default/klogd || . /etc/default/klogd
. /lib/lsb/init-functions
case "$1" in
start)
log_begin_msg "Starting kernel log daemon..."
start-stop-daemon --start --quiet --pidfile $pidfile --name klogd --startas $binpath -- $KLOGD
log_end_msg $?
test -d /lib/init/rw/sendsigs.omit.d || mkdir -p /lib/init/rw/sendsigs.omit.d
test ! -f /lib/init/rw/sendsigs.omit.d/klogd || rm -f /lib/init/rw/sendsigs.omit.d/klogd
ln -s $pidfile /lib/init/rw/sendsigs.omit.d/klogd
;;
stop)
log_begin_msg "Stopping kernel log daemon..."
start-stop-daemon --stop --quiet --retry 3 --exec $binpath --pidfile $pidfile
log_end_msg $?
;;
restart|force-reload)
log_begin_msg "Reloading kernel log daemon..."
start-stop-daemon --stop --quiet --retry 3 --exec $binpath --pidfile $pidfile
start-stop-daemon --start --quiet --pidfile $pidfile --name klogd --startas $binpath -- $KLOGD
log_end_msg $?
;;
*)
log_success_msg "Usage: /etc/init.d/klogd {start|stop|restart|force-reload}"
exit 1
esac
exit 0
PK +#Y[s@S ntpnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: ntp
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Start NTP daemon
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
DAEMON=/usr/sbin/ntpd
PIDFILE=/var/run/ntpd.pid
test -x $DAEMON || exit 5
if [ -r /etc/default/ntp ]; then
. /etc/default/ntp
fi
if [ -e /var/lib/ntp/ntp.conf.dhcp ]; then
NTPD_OPTS="$NTPD_OPTS -c /var/lib/ntp/ntp.conf.dhcp"
fi
LOCKFILE=/var/lock/ntpdate
lock_ntpdate() {
if [ -x /usr/bin/lockfile-create ]; then
lockfile-create $LOCKFILE
lockfile-touch $LOCKFILE &
LOCKTOUCHPID="$!"
fi
}
unlock_ntpdate() {
if [ -x /usr/bin/lockfile-create ] ; then
kill $LOCKTOUCHPID
lockfile-remove $LOCKFILE
fi
}
RUNASUSER=ntp
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
if test "$(uname -s)" = "Linux"; then
NTPD_OPTS="$NTPD_OPTS -u $UGID"
fi
case $1 in
start)
log_daemon_msg "Starting NTP server" "ntpd"
if [ -z "$UGID" ]; then
log_failure_msg "user \"$RUNASUSER\" does not exist"
exit 1
fi
lock_ntpdate
start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --startas $DAEMON -- -p $PIDFILE $NTPD_OPTS
status=$?
unlock_ntpdate
log_end_msg $status
;;
stop)
log_daemon_msg "Stopping NTP server" "ntpd"
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
log_end_msg $?
rm -f $PIDFILE
;;
restart|force-reload)
$0 stop && sleep 2 && $0 start
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload)
exit 3
;;
status)
status_of_proc $DAEMON "NTP server"
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|status}"
exit 2
;;
esac
PK +#Y[/ / quotarpcnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: quotarpc
# Short-Description: Starts rpc process for remote quota handling
# Required-Start: $remote_fs $syslog quota
# Required-Stop: $remote_fs $syslog quota
# Should-Start: $portmap rpcbind
# Should-Stop: $portmap rpcbind
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME=rpc.rquotad
DESC="quota service"
# names of binaries
DAEMON=/usr/sbin/rpc.rquotad
# check if quota are enabled
if test -f /etc/exports && grep -q '^[^#]*quota' /etc/fstab && grep -q '^/' /etc/exports; then
need_rquotad=1
else
need_rquotad=0
fi
test -f $DAEMON || exit 0
. /lib/lsb/init-functions
# check if there are some options to rpc.rquotad
test -f /etc/default/quota && . /etc/default/quota
pidp=`pidof portmap`
pidr=`pidof rpcbind`
set -e
case "$1" in
start)
# To start the daemon, portmap must be up and running
if [ -x $DAEMON ] && [ $need_rquotad = 1 ]; then
if [ -z "$pidp" ] && [ -z "$pidr" ] ; then
log_warning_msg "Not starting $DESC rpc.rquotad, because neither portmap nor rcpbind are running"
else
log_daemon_msg "Starting $DESC" "rpc.rquotad"
start-stop-daemon --start --quiet --exec $DAEMON -- $RPCRQUOTADOPTS
log_end_msg $?
fi
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "rpc.rquotad"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
log_end_msg $?
;;
restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
$0 stop
$0 start
;;
status)
status_of_proc $DAEMON quotarpc
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0
PK +#Y[Vr5 5 umountfsnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: umountfs
# Required-Start:
# Required-Stop: umountroot
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Turn off swap and unmount all local file systems.
# Description:
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
umask 022
do_stop () {
exec 9<&0 /dev/null
log_action_end_msg $?
else
log_daemon_msg "Will now deactivate swap"
swapoff -a -v
log_end_msg $?
fi
#
# Unmount local filesystems
#
if [ "$WEAK_MTPTS" ]; then
# Do not use -f umount option for WEAK_MTPTS
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Unmounting weak filesystems"
fstab-decode umount -r -d $WEAK_MTPTS
log_action_end_msg $?
else
log_daemon_msg "Will now unmount weak filesystems"
fstab-decode umount -v -r -d $WEAK_MTPTS
log_end_msg $?
fi
fi
if [ "$REG_MTPTS" ]
then
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Unmounting local filesystems"
fstab-decode umount -f -r -d $REG_MTPTS
log_action_end_msg $?
else
log_daemon_msg "Will now unmount local filesystems"
fstab-decode umount -f -v -r -d $REG_MTPTS
log_end_msg $?
fi
fi
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:
PK +#Y[}!/ / atdnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: atd
# Required-Start: $syslog $time $remote_fs
# Required-Stop: $syslog $time $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Deferred execution scheduler
# Description: Debian init script for the atd deferred executions
# scheduler
### END INIT INFO
#
# Author: Ryan Murray
#
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/atd
PIDFILE=/var/run/atd.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting deferred execution scheduler" "atd"
start_daemon -p $PIDFILE $DAEMON
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping deferred execution scheduler" "atd"
killproc -p $PIDFILE $DAEMON
log_end_msg $?
;;
force-reload|restart)
$0 stop
$0 start
;;
status)
status_of_proc -p $PIDFILE $DAEMON atd && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/atd {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0
PK +#Y[yL) L) hdparmnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: hdparm
# Required-Start: mountdevsubfs
# Required-Stop:
# Should-Start: udev
# Default-Start: S
# Default-Stop:
# Short-Description: Tune IDE hard disks
### END INIT INFO
set -e
. /lib/lsb/init-functions
# Defaults for configuration variables.
RAID_WORKAROUND=no
# Source the defaults file.
[ -e /etc/default/hdparm ] && . /etc/default/hdparm
raid_speed_limit_min=
raid_speed_limit_max=
case "$0" in
*hdparm)
FIRST=yes
;;
*)
FIRST=no
;;
esac
case "$1" in
start|restart|reload|force-reload)
UDEV=no
;;
hotplug)
UDEV=yes
[ "$DEVNAME" ] || exit 1
;;
stop)
exit 0
;;
*)
log_failure_msg "Usage: $0 {stop|start|restart|reload|force-reload|hotplug}" >&2
exit 3
;;
esac
if [ "$FORCE_RUN" != 'yes' ]; then
if [ -e /proc/cmdline ]; then #linux only - future proofing against BSD and Hurd :)
if grep -wq "nohdparm" /proc/cmdline ; then
log_warning_msg "Skipping setup of disc parameters."
exit 0
fi
fi
raidstat=OK
if [ -e /proc/mdstat ]; then
if egrep -iq "resync|repair|recover|check" /proc/mdstat; then
raidstat=RESYNC
fi
elif [ -e /proc/rd/status ]; then
raidstat=`cat /proc/rd/status`
fi
if ! [ "$raidstat" = 'OK' ] && [ "$RAID_WORKAROUND" != "yes" ]; then
log_failure_msg "RAID status not OK. Exiting."
exit 0
fi
fi
slow_down_raid_sync()
{
if [ -f /proc/sys/dev/raid/speed_limit_min ]; then
raid_speed_limit_min=`cat /proc/sys/dev/raid/speed_limit_min`
echo 0 >/proc/sys/dev/raid/speed_limit_min
fi
if [ -f /proc/sys/dev/raid/speed_limit_max ]; then
raid_speed_limit_max=`cat /proc/sys/dev/raid/speed_limit_max`
echo 0 >/proc/sys/dev/raid/speed_limit_max
fi
sleep 2
trap undo_slow_down_raid_sync EXIT
}
undo_slow_down_raid_sync()
{
if [ -f /proc/sys/dev/raid/speed_limit_min ] && [ "x$raid_speed_limit_min" != "x" ]; then
echo $raid_speed_limit_min >/proc/sys/dev/raid/speed_limit_min
fi
if [ -f /proc/sys/dev/raid/speed_limit_max ] && [ "x$raid_speed_limit_max" != "x" ]; then
echo $raid_speed_limit_max >/proc/sys/dev/raid/speed_limit_max
fi
}
set_option()
{
if test -n "$DISC"; then
NEW_OPT=
for i in $OPTIONS; do
if test x${i%${i#??}} != x${1%${1#??}}; then
NEW_OPT="$NEW_OPT $i"
else
NEW_OPT=${NEW_OPT%-q}
fi
done
OPTIONS="$NEW_OPT $OPT_QUIET $1"
else
NEW_DEF=
for i in $DEFAULT; do
if test x${i%${i#??}} != x${1%${1#??}}; then
NEW_DEF="$NEW_DEF $i"
else
NEW_DEF=${NEW_DEF%-q}
fi
done
DEFAULT="$NEW_DEF $DEF_QUIET $1"
fi
}
eval_value()
{
case $1 in
off|0)
set_option "$2"0
;;
on|1)
set_option "$2"1
;;
*)
log_failure_msg "Unknown Value for $2: $1"
exit 1
;;
esac
}
WAS_RUN=0
# Turn off RAID synchronisation if needed and asked for.
if [ "$raidstat" != 'OK' ] && [ "$RAID_WORKAROUND" = "yes" ]; then
slow_down_raid_sync
fi
# Get blocks as far as the drive's write cache.
/bin/sync
[ "$UDEV" = 'yes' ] || log_daemon_msg "Setting parameters of disc"
DISC=
DEFAULT=
OPTIONS=
DEF_QUIET=
OPT_QUIET=
egrep -v '^[[:space:]]*(#|$)' /etc/hdparm.conf |
{
while read KEY SEP VALUE; do
if [ "$NEXT_LINE" != 'go' ]; then
case $SEP in
'{')
case $KEY in
command_line)
NEXT_LINE=go
unset DISC
unset OPTIONS
unset OPT_QUIET
if [ "$UDEV" = 'yes' ]; then
IN_BLOCK=0
fi
;;
*)
if [ -h "$KEY" ]; then
DISC=$(readlink -m "$KEY")
else
DISC=$KEY
fi
OPTIONS=$DEFAULT
OPT_QUIET=$DEF_QUIET
WAS_RUN=0
if [ "$UDEV" = 'yes' ]; then
if [ "$DISC" = "$DEVNAME" ]; then
IN_BLOCK=1
else
IN_BLOCK=0
fi
fi
;;
esac
;;
=)
case $KEY in
read_ahead_sect)
set_option -a$VALUE
;;
lookahead)
eval_value $VALUE -A
;;
bus)
eval_value $VALUE -b
;;
apm)
set_option -B$VALUE
;;
io32_support)
set_option -c$VALUE
;;
dma)
eval_value $VALUE -d
;;
defect_mana)
eval_value $VALUE -D
;;
cd_speed)
set_option -E$VALUE
;;
mult_sect_io)
set_option -m$VALUE
;;
prefetch_sect)
set_option -P$VALUE
;;
read_only)
eval_value $VALUE -r
;;
spindown_time)
case "$VALUE" in
*[hms])
case "$VALUE" in
*h)
time=$((${VALUE%h} * 3600))
;;
*m)
time=$((${VALUE%m} * 60))
;;
*s)
time=${VALUE%s}
;;
esac
if [ $time -lt 1260 ]; then # up to 21 minutes
new_VALUE=$(($time / 5))
if [ $new_VALUE -gt 240 ]; then
new_VALUE=240
fi
if [ $(($new_VALUE * 5)) -ne $time ]; then
log_warning_msg "$VALUE not possible, using $(($new_VALUE * 5)) seconds"
fi
VALUE=$new_VALUE
elif [ $time -lt 1800 ]; then
if [ $time -ne 1260 ]; then
log_warning_msg "$VALUE not possible, using 21 minutes"
fi
VALUE=252
else
new_time=$(($time / 1800))
if [ $new_time -gt 11 ]; then
new_time=11
fi
if [ $((new_time * 1800)) -ne $time ]; then
log_warning_msg "$VALUE not possible, using $(($new_time * 30)) minutes"
fi
VALUE=$((new_time + 240))
fi
;;
esac
set_option -S$VALUE
;;
poweron_standby)
eval_value $VALUE -s
;;
interrupt_unmask)
eval_value $VALUE -u
;;
write_cache)
eval_value $VALUE -W
;;
transfer_mode)
set_option -X$VALUE
;;
acoustic_management)
set_option -M$VALUE
;;
keep_settings_over_reset)
eval_value $VALUE -k
;;
keep_features_over_reset)
eval_value $VALUE -K
;;
chipset_pio_mode)
set_option -p$VALUE
;;
security_unlock)
set_option --security-unlock $VALUE
;;
security_pass)
set_option --security-set-pass $VALUE
;;
security_disable)
set_option --security-disable $VALUE
;;
user-master)
set_option --user-master $VALUE
;;
security_mode)
set_option --security-mode $VALUE
;;
ROOTFS)
ROOTFS=$VALUE
;;
*)
log_failure_msg "Unknown option $KEY"
exit 1
;;
esac
;;
"")
case $KEY in
'}')
if [ -z "$DISC" ] && [ "$WAS_RUN" != '1' ]; then
log_failure_msg "No disk enabled. Exiting"
exit 1
fi
if [ -n "$OPTIONS" ] && [ -b "$DISC" ]; then
if [ -n "$ROOTFS" ]; then
if [ "$FIRST" = 'yes' ] && [ "$DISC" != "$ROOTFS" ]; then
continue
fi
if [ "$FIRST" = 'no' ] && [ "$DISC" = "$ROOTFS" ]; then
continue
fi
fi
ret=0
if [ "$UDEV" = 'yes' ] && [ "$IN_BLOCK" = 1 ]; then
# Flush the drive's internal write cache to the disk.
/sbin/hdparm -q -f $DISC 2>/dev/null || ret=$?
/sbin/hdparm $OPTIONS $DISC 2>/dev/null || ret=$?
if [ "$VERBOSE" = 'yes' ]; then
log_progress_msg " $DISC"
log_end_msg $ret || true
fi
elif [ "$UDEV" = 'no' ]; then
/sbin/hdparm -q -f $DISC 2>/dev/null || ret=$?
/sbin/hdparm $OPTIONS $DISC 2>/dev/null || ret=$?
WAS_RUN=1
log_progress_msg " $DISC"
log_end_msg $ret || true
fi
fi
;;
quiet)
if [ -n "$DISC" ]; then
OPT_QUIET=-q
else
DEF_QUIET=-q
fi
;;
standby)
set_option -y
;;
sleep)
set_option -Y
;;
disable_seagate)
set_option -Z
;;
security_freeze)
set_option --security-freeze
;;
*)
log_failure_msg "unknown option $KEY"
exit 1
;;
esac
;;
*)
log_failure_msg "unknown separator $SEP"
exit 1
;;
esac
else
$KEY $SEP $VALUE
NEXT_LINE=no-go
WAS_RUN=1
fi
done
if [ -n "$harddisks" ] && [ -n "$hdparm_opts" ] && [ "$UDEV" = 'no' ]; then
ret=0
for drive in $harddisks; do
WAS_RUN=1
log_progress_msg "$drive "
/sbin/hdparm -q -f $drive 2>/dev/null|| ret=$?
/sbin/hdparm -q $hdparm_opts -q $drive 2>/dev/null|| ret=$?
done
log_end_msg $ret || true
fi
if [ "$UDEV" = 'no' -a "$WAS_RUN" = 0 ]; then
log_progress_msg "(none)"
log_end_msg 0
fi
}
exit 0
PK +#Y[Ufw w stop-bootlogd-singlenu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: stop-bootlogd-single
# Required-Start: $local_fs $all
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Stop bootlogd in single user mode
# Description: See the init.d/bootlogd script
### END INIT INFO
#
# This has to run in the boot sequence (rcS.d), and not in the "single
# user" sequence (rc1.d), because rc1.d/ is not used when booting into
# single user. "grep :[S1]: /etc/inittab" show that single user is just
# a call to /sbin/sulogin, while runlevel 1 is a call to
# "/etc/init.d/rc 1" which in the end switches to runlevel S to run
# /sbin/sulogin.
PATH=/sbin:/usr/sbin:/bin:/usr/bin
NAME=stop-bootlogd-single
DAEMON=/sbin/bootlogd
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
single=false
for word in $(cat /proc/cmdline); do
case "$word" in
S|single|1)
single=true
;;
esac
done
if [ true = "$single" ] ; then
/etc/init.d/bootlogd stop
fi
;;
stop|restart|force-reload)
# No-op
;;
status)
exec /etc/init.d/bootlogd status
;;
*)
echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
PK +#Y[ml l mountall-bootclean.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: mountall-bootclean
# Required-Start: mountall
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: bootclean after mountall.
# Description: Clean temporary filesystems after
# all local filesystems have been mounted.
### END INIT INFO
case "$1" in
start|"")
# Clean /tmp, /var/lock, /var/run
. /lib/init/bootclean.sh
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: mountall-bootclean.sh [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[9; mountdevsubfs.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: mountdevsubfs
# Required-Start: mountkernfs
# Required-Stop:
# Should-Start: udev
# Default-Start: S
# Default-Stop:
# Short-Description: Mount special file systems under /dev.
# Description: Mount the virtual filesystems the kernel provides
# that ordinarily live under the /dev filesystem.
### END INIT INFO
#
# This script gets called multiple times during boot
#
PATH=/sbin:/bin
TTYGRP=5
TTYMODE=620
[ -f /etc/default/devpts ] && . /etc/default/devpts
TMPFS_SIZE=
[ -f /etc/default/tmpfs ] && . /etc/default/tmpfs
KERNEL="$(uname -s)"
. /lib/lsb/init-functions
. /lib/init/mount-functions.sh
do_start () {
#
# Mount a tmpfs on /dev/shm
#
if [ ! -d /dev/shm ]
then
mkdir --mode=755 /dev/shm
[ -x /sbin/restorecon ] && /sbin/restorecon /dev/shm
fi
SHM_OPT=
[ "${SHM_SIZE:=$TMPFS_SIZE}" ] && SHM_OPT=",size=$SHM_SIZE"
domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT
#
# Mount /dev/pts
#
if [ "$KERNEL" = Linux ]
then
if [ ! -d /dev/pts ]
then
mkdir --mode=755 /dev/pts
[ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts
fi
domount devpts "" /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
fi
}
case "$1" in
"")
echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2
do_start
;;
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: mountdevsubfs [start|stop]" >&2
exit 3
;;
esac
PK +#Y[s)= = mysqlnu W+A #!/bin/bash
#
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $network $time
# Should-Stop: $network $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the mysql database server daemon
# Description: Controls the main MySQL database server daemon "mysqld"
# and its wrapper script "mysqld_safe".
### END INIT INFO
#
set -e
set -u
${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
test -x /usr/bin/mysqld_safe || exit 0
. /lib/lsb/init-functions
SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
CONF=/etc/mysql/my.cnf
MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
# priority can be overriden and "-s" adds output to stderr
ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
# Safeguard (relative paths, core dumps..)
cd /
umask 077
# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
# as many admins e.g. only store a password without a username there and
# so break my scripts.
export HOME=/etc/mysql/
## Fetch a particular option from mysql's invocation.
#
# Usage: void mysqld_get_param option
mysqld_get_param() {
/usr/sbin/mysqld --print-defaults \
| tr " " "\n" \
| grep -- "--$1" \
| tail -n 1 \
| cut -d= -f2
}
## Do some sanity checks before even trying to start mysqld.
sanity_checks() {
# check for config file
if [ ! -r /etc/mysql/my.cnf ]; then
log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
echo "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
fi
# check for diskspace shortage
datadir=`mysqld_get_param datadir`
if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
echo "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
exit 1
fi
}
## Checks if there is a server running and if so if it is accessible.
#
# check_alive insists on a pingable server
# check_dead also fails if there is a lost mysqld in the process list
#
# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
mysqld_status () {
ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
ps_alive=0
pidfile=`mysqld_get_param pid-file`
if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
if [ "$1" = "check_alive" -a $ping_alive = 1 ] ||
[ "$1" = "check_dead" -a $ping_alive = 0 -a $ps_alive = 0 ]; then
return 0 # EXIT_SUCCESS
else
if [ "$2" = "warn" ]; then
echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
fi
return 1 # EXIT_FAILURE
fi
}
#
# main()
#
case "${1:-''}" in
'start')
sanity_checks;
# Start daemon
log_daemon_msg "Starting MySQL database server" "mysqld"
if mysqld_status check_alive nowarn; then
log_progress_msg "already running"
log_end_msg 0
else
# Could be removed during boot
test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
# Start MySQL!
/usr/bin/mysqld_safe > /dev/null 2>&1 &
# 6s was reported in #352070 to be too few when using ndbcluster
for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
sleep 1
if mysqld_status check_alive nowarn ; then break; fi
log_progress_msg "."
done
if mysqld_status check_alive warn; then
log_end_msg 0
# Now start mysqlcheck or whatever the admin wants.
output=$(/etc/mysql/debian-start)
[ -n "$output" ] && log_action_msg "$output"
else
log_end_msg 1
log_failure_msg "Please take a look at the syslog"
fi
fi
;;
'stop')
# * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
# at least for cron, we can rely on it here, too. (although we have
# to specify it explicit as e.g. sudo environments points to the normal
# users home and not /root)
log_daemon_msg "Stopping MySQL database server" "mysqld"
if ! mysqld_status check_dead nowarn; then
set +e
shutdown_out=`$MYADMIN shutdown 2>&1`; r=$?
set -e
if [ "$r" -ne 0 ]; then
log_end_msg 1
[ "$VERBOSE" != "no" ] && log_failure_msg "Error: $shutdown_out"
log_daemon_msg "Killing MySQL database server by signal" "mysqld"
killall -15 mysqld
server_down=
for i in 1 2 3 4 5 6 7 8 9 10; do
sleep 1
if mysqld_status check_dead nowarn; then server_down=1; break; fi
done
if test -z "$server_down"; then killall -9 mysqld; fi
fi
fi
if ! mysqld_status check_dead warn; then
log_end_msg 1
log_failure_msg "Please stop MySQL manually and read /usr/share/doc/mysql-server-5.1/README.Debian.gz!"
exit -1
else
log_end_msg 0
fi
;;
'restart')
set +e; $SELF stop; set -e
$SELF start
;;
'reload'|'force-reload')
log_daemon_msg "Reloading MySQL database server" "mysqld"
$MYADMIN reload
log_end_msg 0
;;
'status')
if mysqld_status check_alive nowarn; then
log_action_msg "$($MYADMIN version)"
else
log_action_msg "MySQL is stopped."
exit 3
fi
;;
*)
echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
exit 1
;;
esac
PK +#Y[Vi hostname.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: hostname
# Required-Start:
# Required-Stop:
# Should-Start: glibc
# Default-Start: S
# Default-Stop:
# Short-Description: Set hostname based on /etc/hostname
# Description: Read the machines hostname from /etc/hostname, and
# update the kernel value with this value. If
# /etc/hostname is empty, the current kernel value
# for hostname is used. If the kernel value is
# empty, the value 'localhost' is used.
### END INIT INFO
PATH=/sbin:/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start () {
[ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
# Keep current name if /etc/hostname is missing.
[ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)"
# And set it to 'localhost' if no setting was found
[ -z "$HOSTNAME" ] && HOSTNAME=localhost
[ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'"
hostname "$HOSTNAME"
ES=$?
[ "$VERBOSE" != no ] && log_action_end_msg $ES
exit $ES
}
do_status () {
HOSTNAME=$(hostname)
if [ "$HOSTNAME" ] ; then
return 0
else
return 4
fi
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
do_status
exit $?
;;
*)
echo "Usage: hostname.sh [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[%Tg urandomnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: urandom
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Save and restore random seed between restarts.
# Description: This script saves the random seed between restarts.
# It is called from the boot, halt and reboot scripts.
### END INIT INFO
[ -c /dev/urandom ] || exit 0
PATH=/sbin:/bin
SAVEDFILE=/var/lib/urandom/random-seed
POOLSIZE=512
[ -f /proc/sys/kernel/random/poolsize ] && POOLSIZE="$(cat /proc/sys/kernel/random/poolsize)"
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_status () {
if [ -f $SAVEDFILE ] ; then
return 0
else
return 4
fi
}
case "$1" in
start|"")
[ "$VERBOSE" = no ] || log_action_begin_msg "Initializing random number generator"
# Load and then save $POOLSIZE bytes,
# which is the size of the entropy pool
if [ -f "$SAVEDFILE" ]
then
# Handle locally increased pool size
set -- $(LC_ALL=C ls -l "$SAVEDFILE")
SAVEDSIZE="$5"
if [ "$SAVEDSIZE" -gt "$POOLSIZE" ]
then
[ -w /proc/sys/kernel/random/poolsize ] && echo $POOLSIZE > /proc/sys/kernel/random/poolsize
POOLSIZE=$SAVEDSIZE
fi
cat "$SAVEDFILE" >/dev/urandom
fi
rm -f $SAVEDFILE
# Hm, why is the saved pool re-created at boot? [pere 2009-09-03]
umask 077
dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
ES=$?
umask 022
[ "$VERBOSE" = no ] || log_action_end_msg $ES
;;
stop)
# Carry a random seed from shut-down to start-up;
# see documentation in linux/drivers/char/random.c
[ "$VERBOSE" = no ] || log_action_begin_msg "Saving random seed"
umask 077
dd if=/dev/urandom of=$SAVEDFILE bs=$POOLSIZE count=1 >/dev/null 2>&1
ES=$?
[ "$VERBOSE" = no ] || log_action_end_msg $ES
;;
status)
do_status
exit $?
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
*)
echo "Usage: urandom start|stop" >&2
exit 3
;;
esac
:
PK +#Y[0s ifupdownnu W+A #!/bin/sh -e
### BEGIN INIT INFO
# Provides: ifupdown
# Required-Start: ifupdown-clean
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Prepare the system for taking up interfaces.
### END INIT INFO
[ -x /sbin/ifup ] || exit 0
[ -x /sbin/ifdown ] || exit 0
. /lib/lsb/init-functions
MYNAME="${0##*/}"
report() { echo "${MYNAME}: $*" ; }
report_err() { log_failure_msg "$*" ; }
RUN_DIR=/etc/network/run
[ -r /etc/default/ifupdown ] && . /etc/default/ifupdown
# Note: The state file location is hardcoded in ifup|ifdown
IFSTATE=/etc/network/run/ifstate
myreadlink () {
dest="${1%/}"
extras=""
while [ "$dest" != "" ]; do
if [ -d "$dest" ]; then
cd "$dest"
dest=$(/bin/pwd)
break
fi
if [ -L "$dest" ]; then
d2=$(readlink "$dest")
if [ "${d2#/}" = "$d2" ]; then
dest="${dest%/*}/$d2"
else
dest="$d2"
fi
fi
while [ ! -e "$dest" ]; do
extras="${dest##*/}/$extras"
if [ "${extras%%/*}" = ".." ]; then return 1; fi
destx="${dest%/*}"
if [ "$destx" = "$dest" ]; then destx=""; fi
dest="$destx"
done
done
dest="$dest/$extras"
echo "${dest%/}"
}
case "$1" in
start|restart)
if [ "$2" ]; then
report_err "Arguments to '$1' command not accepted"
exit 3
fi
log_begin_msg "Setting up networking..."
# if /etc/network/run is a symlink to a directory that doesn't exist,
# create it.
if [ -L "$RUN_DIR" ] && [ ! -d "$RUN_DIR" ] ; then
runmkdir="$(myreadlink "$RUN_DIR")"
if [ ! "$runmkdir" ] ; then
report_err "Cannot create target of /etc/network/run"
log_end_msg 1
exit 1
fi
if ! mkdir -p "$runmkdir"; then
report_err "Failure creating directory $runmkdir"
log_end_msg 1
exit 1
fi
fi
# Create the state file
# Doing this also signals that ifupdown is available for use
if [ ! -r "$IFSTATE" ]; then
if ! : > "$IFSTATE" ; then
report_err "Failure initializing $IFSTATE"
log_end_msg 1
exit 1
fi
fi
log_end_msg 0
exit 0
;;
stop)
if [ "$2" ]; then
report_err "Arguments to '$1' command not accepted"
exit 3
fi
if [ -x /etc/init.d/ifupdown-clean ]; then
/etc/init.d/ifupdown-clean start
fi
;;
force-reload)
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
PK +#Y[e7 7
stop-bootlogdnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: stop-bootlogd
# Required-Start: $local_fs $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Stop bootlogd
# Description: See the init.d/bootlogd script
### END INIT INFO
NAME=stop-bootlogd
DAEMON=/sbin/bootlogd
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
/etc/init.d/bootlogd stop
;;
stop|restart|force-reload)
# No-op
;;
status)
exec /etc/init.d/bootlogd status
;;
*)
echo "Usage: $NAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:
PK +#Y[bM hwclockfirst.shnu W+A #!/bin/sh
# hwclock.sh Set and adjust the CMOS clock, according to the UTC
# setting in /etc/default/rcS (see also rcS(5)).
#
# Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl
#
# Patches:
# 2000-01-30 Henrique M. Holschuh
# - Minor cosmetic changes in an attempt to help new
# users notice something IS changing their clocks
# during startup/shutdown.
# - Added comments to alert users of hwclock issues
# and discourage tampering without proper doc reading.
# WARNING: Please read /usr/share/doc/util-linux/README.Debian.hwclock
# before changing this file. You risk serious clock
# misbehaviour otherwise.
### BEGIN INIT INFO
# Provides: hwclockfirst
# Required-Start: mountdevsubfs
# Required-Stop:
# Default-Start: S
# X-Start-Before: checkroot
# Default-Stop:
### END INIT INFO
FIRST=yes # debian/rules sets this to 'yes' when creating hwclockfirst.sh
# Set this to any options you might need to give to hwclock, such
# as machine hardware clock type for Alphas.
HWCLOCKPARS=
# Set this to the hardware clock device you want to use, it should
# probably match the CONFIG_RTC_HCTOSYS_DEVICE kernel config option.
HCTOSYS_DEVICE=rtc0
hwclocksh()
{
[ ! -x /sbin/hwclock ] && return 0
[ ! -r /etc/default/rcS ] || . /etc/default/rcS
. /lib/lsb/init-functions
verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
[ "$GMT" = "-u" ] && UTC="yes"
case "$UTC" in
no|"") GMT="--localtime"
UTC=""
if [ "X$FIRST" = "Xyes" ] && [ ! -r /etc/localtime ]; then
if [ -z "$TZ" ]; then
log_action_msg "System clock was not updated at this time"
return 1
fi
fi
;;
yes) GMT="--utc"
UTC="--utc"
;;
*) log_action_msg "Unknown UTC setting: \"$UTC\""; return 1 ;;
esac
case "$BADYEAR" in
no|"") BADYEAR="" ;;
yes) BADYEAR="--badyear" ;;
*) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
esac
case "$1" in
start)
if [ -d /dev/.udev ]; then
return 0
fi
if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
echo "0.0 0 0.0" > /etc/adjtime
fi
if [ ! -w /etc/adjtime ]; then
NOADJ="--noadjfile"
else
NOADJ=""
fi
if [ "$FIRST" != yes ]; then
# Uncomment the hwclock --adjust line below if you want
# hwclock to try to correct systematic drift errors in the
# Hardware Clock.
#
# WARNING: If you uncomment this option, you must either make
# sure *nothing* changes the Hardware Clock other than
# hwclock --systohc, or you must delete /etc/adjtime
# every time someone else modifies the Hardware Clock.
#
# Common "vilains" are: ntp, MS Windows, the BIOS Setup
# program.
#
# WARNING: You must remember to invalidate (delete)
# /etc/adjtime if you ever need to set the system clock
# to a very different value and hwclock --adjust is being
# used.
#
# Please read /usr/share/doc/util-linux/README.Debian.hwclock
# before enabling hwclock --adjust.
#/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --adjust $GMT $BADYEAR
:
fi
if [ "$HWCLOCKACCESS" != no ]; then
log_action_msg "Setting the system clock"
# Copies Hardware Clock time to System Clock using the correct
# timezone for hardware clocks in local time, and sets kernel
# timezone. DO NOT REMOVE.
if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --hctosys $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
# Announce the local time.
verbose_log_action_msg "System Clock set to: `date $UTC`"
else
log_warning_msg "Unable to set System Clock to: `date $UTC`"
fi
else
verbose_log_action_msg "Not setting System Clock"
fi
;;
stop|restart|reload|force-reload)
#
# Updates the Hardware Clock with the System Clock time.
# This will *override* any changes made to the Hardware Clock.
#
# WARNING: If you disable this, any changes to the system
# clock will not be carried across reboots.
#
if [ ! -w /etc/adjtime ]; then
NOADJ="--noadjfile"
else
NOADJ=""
fi
if [ "$HWCLOCKACCESS" != no ]; then
log_action_msg "Saving the system clock"
if [ "$GMT" = "-u" ]; then
GMT="--utc"
fi
if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $GMT $HWCLOCKPARS $BADYEAR $NOADJ; then
verbose_log_action_msg "Hardware Clock updated to `date`"
fi
else
verbose_log_action_msg "Not saving System Clock"
fi
;;
show)
if [ ! -w /etc/adjtime ]; then
NOADJ="--noadjfile"
else
NOADJ=""
fi
if [ "$HWCLOCKACCESS" != no ]; then
/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $GMT $HWCLOCKPARS $BADYEAR $NOADJ
fi
;;
*)
log_success_msg "Usage: hwclock.sh {start|stop|reload|force-reload|show}"
log_success_msg " start sets kernel (system) clock from hardware (RTC) clock"
log_success_msg " stop and reload set hardware (RTC) clock from kernel (system) clock"
return 1
;;
esac
}
hwclocksh "$@"
PK +#Y[<E bootlogdnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: bootlogd
# Required-Start: mountdevsubfs
# X-Start-Before: hostname keymap keyboard-setup procps pcmcia hwclock hwclockfirst hdparm hibernate-cleanup lvm2
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Start or stop bootlogd.
# Description: Starts or stops the bootlogd log program
# which logs boot messages.
### END INIT INFO
PATH=/sbin:/bin # No remote fs at start
DAEMON=/sbin/bootlogd
[ -x "$DAEMON" ] || exit 0
NAME=bootlogd
DESC="boot logger"
BOOTLOGD_OPTS="-r -c"
[ -r /etc/default/bootlogd ] && . /etc/default/bootlogd
. /lib/init/vars.sh
. /lib/lsb/init-functions
# Because bootlogd is broken on some systems, we take the special measure
# of requiring it to be enabled by setting an environment variable.
case "$BOOTLOGD_ENABLE" in
[Nn]*)
exit 0
;;
esac
# Previously this script was symlinked as "stop-bootlogd" which, when run
# with the "start" argument, should stop bootlogd. Now stop-bootlogd is
# a distinct script, but for backward compatibility this script continues
# to implement the old behavior.
SCRIPTNAME=${0##*/}
SCRIPTNAME=${SCRIPTNAME#[SK]??}
ACTION="$1"
case "$0" in
*stop-bootlog*)
[ "$ACTION" = start ] && ACTION=stop
;;
esac
case "$ACTION" in
start)
# PATH is set above
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
if [ -d /proc/1/. ]
then
umask 027
start-stop-daemon --start --quiet --exec $DAEMON -- \
$BOOTLOGD_OPTS
ES=$?
else
$DAEMON $BOOTLOGD_OPTS
ES=$?
fi
[ "$VERBOSE" != no ] && log_end_msg $ES
;;
stop)
PATH=/bin:/sbin:/usr/bin:/usr/sbin
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --oknodo --stop --quiet --exec $DAEMON
ES=$?
sleep 1
[ "$VERBOSE" != no ] && log_end_msg $ES
if [ -f /var/log/boot ] && [ -f /var/log/boot~ ]
then
[ "$VERBOSE" = no ] || log_action_begin_msg "Moving boot log file"
# bootlogd writes to boot, making backup at boot~
cd /var/log && {
chgrp adm boot || :
savelog -q -p -c 5 boot \
&& mv boot.0 boot \
&& mv boot~ boot.0
}
ES=$?
[ "$VERBOSE" = no ] || log_action_end_msg $ES
fi
;;
restart|force-reload)
/etc/init.d/bootlogd stop
/etc/init.d/bootlogd start
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
exit 3
;;
esac
:
PK +#Y[h#
killprocsnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: killprocs
# Required-Start: $local_fs
# Required-Stop:
# Default-Start: 1
# Default-Stop:
# Short-Description: executed by init(8) upon entering runlevel 1 (single).
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/lsb/init-functions
do_start () {
# Kill all processes.
log_action_begin_msg "Asking all remaining processes to terminate"
killall5 -15 # SIGTERM
log_action_end_msg 0
alldead=""
for seq in 1 2 3 4 5 6 7 8 9 10; do
# use SIGCONT/signal 18 to check if there are
# processes left. No need to check the exit code
# value, because either killall5 work and it make
# sense to wait for processes to die, or it fail and
# there is nothing to wait for.
if killall5 -18 ; then
:
else
alldead=1
break
fi
sleep 1
done
if [ -z "$alldead" ] ; then
log_action_begin_msg "Killing all remaining processes"
killall5 -9 # SIGKILL
log_action_end_msg 1
else
log_action_begin_msg "All processes ended within $seq seconds."
log_action_end_msg 0
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
PK +#Y[ U mountall.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: mountall
# Required-Start: checkfs
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Mount all filesystems.
# Description:
### END INIT INFO
PATH=/sbin:/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
. /lib/init/mount-functions.sh
. /lib/init/swap-functions.sh
# for ntfs-3g to get correct file name encoding
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG
fi
do_start() {
#
# Mount local file systems in /etc/fstab.
#
mount_all_local() {
mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2 \
-O no_netdev
}
pre_mountall
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Mounting local filesystems"
mount_all_local
log_action_end_msg $?
else
log_daemon_msg "Will now mount local filesystems"
mount_all_local
log_end_msg $?
fi
post_mountall
case "$(uname -s)" in
*FreeBSD)
INITCTL=/etc/.initctl
;;
*)
INITCTL=/dev/initctl
;;
esac
#
# We might have mounted something over /dev, see if
# /dev/initctl is there. Look for /usr/share/sysvinit/update-rc.d
# to verify that sysvinit (and not upstart) is installed).
#
if [ ! -p $INITCTL ] && [ -f /usr/share/sysvinit/update-rc.d ]; then
rm -f $INITCTL
mknod -m 600 $INITCTL p
kill -USR1 1
fi
# Execute swapon command again, in case we want to swap to
# a file on a now mounted filesystem.
swaponagain 'swapfile'
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: mountall.sh [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[80! ! rc.localnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: rc.local
# Required-Start: $remote_fs $syslog $all
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Run /etc/rc.local if it exist
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_start() {
if [ -x /etc/rc.local ]; then
[ "$VERBOSE" != no ] && log_begin_msg "Running local boot scripts (/etc/rc.local)"
/etc/rc.local
ES=$?
[ "$VERBOSE" != no ] && log_end_msg $ES
return $ES
fi
}
case "$1" in
start)
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
PK +#Y[m screen-cleanupnu W+A #!/bin/sh
# $Id: init,v 1.3 2004/03/16 01:43:45 zal Exp $
#
# Script to remove stale screen named pipes on bootup.
#
### BEGIN INIT INFO
# Provides: screen-cleanup
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: S
# Default-Stop:
# Short-Description: screen sessions cleaning
### END INIT INFO
set -e
SCREENDIR=/var/run/screen
case "$1" in
start)
if test -L $SCREENDIR || ! test -d $SCREENDIR; then
rm -f $SCREENDIR
mkdir $SCREENDIR
chown root:utmp $SCREENDIR
fi
find $SCREENDIR -type p -print0 | xargs -0r rm -f --
# If the local admin has used dpkg-statoverride to install the screen
# binary with different set[ug]id bits, change the permissions of
# $SCREENDIR accordingly
BINARYPERM=`stat -c%a /usr/bin/screen`
if [ "$BINARYPERM" -ge 4000 ]; then
chmod 0755 $SCREENDIR
elif [ "$BINARYPERM" -ge 2000 ]; then
chmod 0775 $SCREENDIR
else
chmod 0777 $SCREENDIR
fi
;;
stop|restart|reload|force-reload)
;;
esac
exit 0
PK +#Y[Jan ifupdown-cleannu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: ifupdown-clean
# Required-Start: checkroot
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Clean old interface status info during boot.
### END INIT INFO
set -e
. /lib/lsb/init-functions
MYNAME="${0##*/}"
PATH=/sbin:/bin
[ -r /etc/default/ifupdown ] && . /etc/default/ifupdown
# Note: The state file location is hardcoded in ifup|ifdown
# it is used as a variable in this script order to ease transitions
# to other locations by the package (not by the sysadmin), if you want
# to setup an alternate location please use a symlink
IFSTATE=/etc/network/run/ifstate
case "$1" in
start)
log_begin_msg "Cleaning up ifupdown..."
if [ -f $IFSTATE -a ! -L $IFSTATE ]; then
rm -f "$IFSTATE"
elif [ -f $IFSTATE ]; then
# This is kinda bad :(
>$IFSTATE
fi
log_end_msg 0
exit 0
;;
stop|restart|force-reload)
exit 0
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
PK +#Y[Av! mountnfs.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: mountnfs
# Required-Start: $local_fs
# Required-Stop:
# Should-Start: $network $portmap nfs-common udev-mtab
# Default-Start: S
# Default-Stop:
# Short-Description: Wait for network file systems to be mounted
# Description: Network file systems are mounted by
# /etc/network/if-up.d/mountnfs in the background
# when interfaces are brought up; this script waits
# for them to be mounted before carrying on.
### END INIT INFO
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_wait_async_mount() {
[ -f /etc/fstab ] || return
#
# Read through fstab line by line. If it is NFS, set the flag
# for mounting NFS file systems. If any NFS partition is found
# then wait around for it.
#
exec 9<&0 &2
exit 3
;;
stop)
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
: exit 0
PK +#Y[(e e proftpdnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: proftpd
# Required-Start: $remote_fs $syslog $local_fs $network
# Required-Stop: $remote_fs $syslog $local_fs $network
# Should-Start: $named
# Should-Stop: $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts ProFTPD daemon
# Description: This script runs the FTP service offered
# by the ProFTPD daemon
### END INIT INFO
# Start the proftpd FTP daemon.
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/proftpd
NAME=proftpd
# Defaults
RUN="no"
OPTIONS=""
PIDFILE=`grep -i 'pidfile' /etc/proftpd/proftpd.conf | sed -e 's/pidfile[\t ]\+//i'`
if [ "x$PIDFILE" = "x" ];
then
PIDFILE=/var/run/proftpd.pid
fi
# Read config (will override defaults)
[ -r /etc/default/proftpd ] && . /etc/default/proftpd
trap "" 1
trap "" 15
test -f $DAEMON || exit 0
. /lib/lsb/init-functions
#
# Servertype could be inetd|standalone|none.
# In all cases check against inetd and xinetd support.
#
if ! egrep -qi "^[[:space:]]*ServerType.*standalone" /etc/proftpd/proftpd.conf
then
if egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.conf 2>/dev/null || \
egrep -qi "server[[:space:]]*=[[:space:]]*/usr/sbin/proftpd" /etc/xinetd.d/* 2>/dev/null || \
egrep -qi "^ftp.*/usr/sbin/proftpd" /etc/inetd.conf 2>/dev/null
then
RUN="no"
INETD="yes"
else
if ! egrep -qi "^[[:space:]]*ServerType.*inetd" /etc/proftpd/proftpd.conf
then
RUN="yes"
INETD="no"
else
RUN="no"
INETD="no"
fi
fi
fi
# /var/run could be on a tmpfs
[ ! -d /var/run/proftpd ] && mkdir /var/run/proftpd
inetd_check()
{
if [ ! -x /usr/sbin/inetd -a ! -x /usr/sbin/xinetd ]; then
echo "Neither inetd nor xinetd appears installed: check your configuration."
fi
}
start()
{
log_daemon_msg "Starting ftp server" "$NAME"
start-stop-daemon --start --quiet --pidfile "$PIDFILE" --oknodo --exec $DAEMON -- $OPTIONS
if [ $? != 0 ]; then
log_end_msg 1
exit 1
else
log_end_msg 0
fi
}
signal()
{
if [ "$1" = "stop" ]; then
SIGNAL="TERM"
log_daemon_msg "Stopping ftp server" "$NAME"
else
if [ "$1" = "reload" ]; then
SIGNAL="HUP"
log_daemon_msg "Reloading ftp server" "$NAME"
else
echo "ERR: wrong parameter given to signal()"
exit 1
fi
fi
if [ -f "$PIDFILE" ]; then
start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"
if [ $? = 0 ]; then
log_end_msg 0
else
SIGNAL="KILL"
start-stop-daemon --stop --signal $SIGNAL --quiet --pidfile "$PIDFILE"
if [ $? != 0 ]; then
log_end_msg 1
[ $2 != 0 ] || exit 0
else
log_end_msg 0
fi
fi
if [ "$SIGNAL" = "KILL" ]; then
rm -f "$PIDFILE"
fi
else
log_end_msg 0
fi
}
case "$1" in
start)
if [ "x$RUN" = "xyes" ] ; then
start
else
if [ "x$INETD" = "xyes" ] ; then
echo "ProFTPd is started from inetd/xinetd."
inetd_check
else
echo "ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration."
fi
fi
;;
force-start)
if [ "x$INETD" = "xyes" ] ; then
echo "Warning: ProFTPd is started from inetd/xinetd (trying to start anyway)."
inetd_check
fi
start
;;
stop)
if [ "x$RUN" = "xyes" ] ; then
signal stop 0
else
if [ "x$INETD" = "xyes" ] ; then
echo "ProFTPd is started from inetd/xinetd."
inetd_check
else
echo "ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration."
fi
fi
;;
force-stop)
if [ "x$INETD" = "xyes" ] ; then
echo "Warning: ProFTPd is started from inetd/xinetd (trying to kill anyway)."
inetd_check
fi
signal stop 0
;;
reload)
signal reload 0
;;
force-reload|restart)
if [ "x$RUN" = "xyes" ] ; then
signal stop 1
sleep 2
start
else
if [ "x$INETD" = "xyes" ] ; then
echo "ProFTPd is started from inetd/xinetd."
inetd_check
else
echo "ProFTPd warning: cannot start neither in standalone nor in inetd/xinetd mode. Check your configuration."
fi
fi
;;
status)
if [ "x$INETD" = "xyes" ] ; then
echo "ProFTPd is started from inetd/xinetd."
inetd_check
exit 0
else
if [ -f "$PIDFILE" ]; then
pid=$(cat $PIDFILE)
else
pid="x"
fi
if [ `pidof proftpd|grep "$pid"|wc -l` -ne 0 ] ; then
echo "ProFTPd is started in standalone mode, currently running."
exit 0
else
echo "ProFTPd is started in standalone mode, currently not running."
exit 3
fi
fi
;;
check-config)
$DAEMON -t >/dev/null && echo "ProFTPd configuration OK" && exit 0
exit 1
;;
*)
echo "Usage: /etc/init.d/$NAME {start|status|force-start|stop|force-stop|reload|restart|force-reload|check-config}"
exit 1
;;
esac
exit 0
PK +#Y[zʓ
networkingnu W+A #!/bin/sh -e
### BEGIN INIT INFO
# Provides: networking
# Required-Start: mountkernfs $local_fs
# Required-Stop: $local_fs
# Should-Start: ifupdown
# Should-Stop: ifupdown
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Raise network interfaces.
### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
[ -x /sbin/ifup ] || exit 0
. /lib/lsb/init-functions
process_options() {
[ -e /etc/network/options ] || return 0
log_warning_msg "/etc/network/options still exists and it will be IGNORED! Read README.Debian of netbase."
}
check_network_file_systems() {
[ -e /proc/mounts ] || return 0
if [ -e /etc/iscsi/iscsi.initramfs ]; then
log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted."
exit 0
fi
exec 9<&0 < /proc/mounts
while read DEV MTPT FSTYPE REST; do
case $DEV in
/dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
log_warning_msg "not deconfiguring network interfaces: network devices still mounted."
exit 0
;;
esac
case $FSTYPE in
nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
log_warning_msg "not deconfiguring network interfaces: network file systems still mounted."
exit 0
;;
esac
done
exec 0<&9 9<&-
}
check_network_swap() {
[ -e /proc/swaps ] || return 0
exec 9<&0 < /proc/swaps
while read DEV MTPT FSTYPE REST; do
case $DEV in
/dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
exit 0
;;
esac
done
exec 0<&9 9<&-
}
case "$1" in
start)
process_options
log_action_begin_msg "Configuring network interfaces"
if ifup -a; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
;;
stop)
check_network_file_systems
check_network_swap
log_action_begin_msg "Deconfiguring network interfaces"
if ifdown -a --exclude=lo; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
;;
force-reload|restart)
process_options
log_warning_msg "Running $0 $1 is deprecated because it may not enable again some interfaces"
log_action_begin_msg "Reconfiguring network interfaces"
ifdown -a --exclude=lo || true
if ifup -a --exclude=lo; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
;;
*)
echo "Usage: /etc/init.d/networking {start|stop}"
exit 1
;;
esac
exit 0
PK +#Y[9F* F* checkroot.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: checkroot
# Required-Start: mountdevsubfs hostname
# Required-Stop:
# Should-Start: keymap hwclockfirst hdparm bootlogd
# Should-stop:
# Default-Start: S
# Default-Stop:
# X-Interactive: true
# Short-Description: Check to root file system.
### END INIT INFO
# Include /usr/bin in path to find on_ac_power if /usr/ is on the root
# partition.
PATH=/sbin:/bin:/usr/bin
FSCK_LOGFILE=/var/log/fsck/checkroot
[ "$FSCKFIX" ] || FSCKFIX=no
[ "$SULOGIN" ] || SULOGIN=no
. /lib/init/vars.sh
. /lib/lsb/init-functions
. /lib/init/mount-functions.sh
. /lib/init/splash-functions-base
. /lib/init/usplash-fsck-functions.sh
do_start () {
#
# Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to
# be spawned from this script *before anything else* with a timeout,
# like sysv does.
#
[ "$SULOGIN" = yes ] && sulogin -t 30 $CONSOLE
KERNEL="$(uname -s)"
MACHINE="$(uname -m)"
#
# Read /etc/fstab, looking for:
# 1) The root filesystem, resolving LABEL=*|UUID=* entries to the
# device node,
# 2) Swap that is on a md device or a file that may be on a md
# device,
#
exec 9<&0 /dev/null 2>&1
log_action_end_msg $?
else
log_daemon_msg "Activating swap"
swapon -a -v
log_end_msg $?
fi
fi
#
# Does the root device in /etc/fstab match with the actual device ?
# If not we try to use the /dev/root alias device, and if that
# fails we create a temporary node in /lib/init/rw.
#
if [ "$rootcheck" = yes ]
then
ddev="$(mountpoint -qx $rootdev)"
rdev="$(mountpoint -d /)"
if [ "$ddev" != "$rdev" ] && [ "$ddev" != "4:0" ]
then
if [ "$(mountpoint -qx /dev/root)" = "4:0" ]
then
rootdev=/dev/root
else
if \
rm -f /lib/init/rw/rootdev \
&& mknod -m 600 /lib/init/rw/rootdev b ${rdev%:*} ${rdev#*:} \
&& [ -e /lib/init/rw/rootdev ]
then
rootdev=/lib/init/rw/rootdev
else
rootfatal=yes
fi
fi
fi
fi
#
# Bother, said Pooh.
#
if [ "$rootfatal" = yes ]
then
log_failure_msg "The device node $rootdev for the root filesystem is missing or incorrect
or there is no entry for the root filesystem listed in /etc/fstab.
The system is also unable to create a temporary node in /lib/init/rw.
This means you have to fix the problem manually."
log_warning_msg "A maintenance shell will now be started.
CONTROL-D will terminate this shell and restart the system."
# Start a single user shell on the console
if ! sulogin $CONSOLE
then
log_failure_msg "Attempt to start maintenance shell failed.
Will restart in 5 seconds."
sleep 5
fi
[ "$VERBOSE" = no ] || log_action_msg "Will now restart"
reboot -f
fi
# See if we're on AC Power. If not, we're not gonna run our
# check. If on_ac_power (in /usr/) is unavailable, behave as
# before and check all file systems needing it.
# Disabled AC power check until fsck can be told to only check the
# file system if it is corrupt when running on battery. (bug #526398)
# if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
# then
# on_ac_power >/dev/null 2>&1
# if [ "$?" -eq 1 ]
# then
# log_warning_msg "On battery power, so skipping file system check."
# rootcheck=no
# fi
# fi
#
# See if we want to check the root file system.
#
FSCKCODE=0
if [ -f /fastboot ] || grep -s -w -i "fastboot" /proc/cmdline
then
[ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping root file system check."
rootcheck=no
fi
if [ "$rootcheck" = yes ]
then
#
# Ensure that root is quiescent and read-only before fsck'ing.
#
# mount -n -o remount,ro / would be the correct syntax but
# mount can get confused when there is a "bind" mount defined
# in fstab that bind-mounts "/" somewhere else.
#
# So we use mount -n -o remount,ro $rootdev / but that can
# fail on older kernels on sparc64/alpha architectures due
# to a bug in sys_mount().
#
# As a compromise we try both.
#
if \
! mount -n -o remount,ro $rootdev / \
&& ! mount -n -o remount,ro -t dummytype $rootdev / 2>/dev/null \
&& ! mount -n -o remount,ro / 2>/dev/null
then
log_failure_msg "Cannot check root file system because it is not mounted read-only."
rootcheck=no
fi
fi
#
# The actual checking is done here.
#
if [ "$rootcheck" = yes ]
then
if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline
then
force="-f"
else
force=""
fi
if [ "$FSCKFIX" = yes ]
then
fix="-y"
else
fix="-a"
fi
spinner="-C"
case "$TERM" in
dumb|network|unknown|"")
spinner="" ;;
esac
# This Linux/s390 special case should go away.
if [ "${KERNEL}:${MACHINE}" = Linux:s390 ]
then
spinner=""
fi
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Checking root file system"
if [ "$roottype" = "ext2" -o "$roottype" = "ext3" -o "$roottype" = "ext4" ] && usplash_running; then
PROGRESS_FILE=`mktemp -p /lib/init/rw` || PROGRESS_FILE=/lib/init/rw/checkroot_fsck
set -m
logsave -s $FSCK_LOGFILE fsck -C3 $force $fix -t $roottype $rootdev >/dev/console 2>&1 3>$PROGRESS_FILE &
set +m
usplash_progress "$PROGRESS_FILE"
rm -f $PROGRESS_FILE
else
splash_start_indefinite
logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
FSCKCODE=$?
splash_stop_indefinite
fi
if [ "$FSCKCODE" = 0 ]
then
log_action_end_msg 0
else
log_action_end_msg 1 "code $FSCKCODE"
fi
else
splash_start_indefinite
log_daemon_msg "Will now check root file system"
logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
FSCKCODE=$?
log_end_msg $FSCKCODE
splash_stop_indefinite
fi
fi
#
# If there was a failure, drop into single-user mode.
#
# NOTE: "failure" is defined as exiting with a return code of
# 4 or larger. A return code of 1 indicates that file system
# errors were corrected but that the boot may proceed. A return
# code of 2 or 3 indicates that the system should immediately reboot.
#
if [ "$FSCKCODE" -gt 3 ]
then
# Surprise! Re-directing from a HERE document (as in "cat << EOF")
# does not work because the root is currently read-only.
log_failure_msg "An automatic file system check (fsck) of the root filesystem failed.
A manual fsck must be performed, then the system restarted.
The fsck should be performed in maintenance mode with the
root filesystem mounted in read-only mode."
log_warning_msg "The root filesystem is currently mounted in read-only mode.
A maintenance shell will now be started.
After performing system maintenance, press CONTROL-D
to terminate the maintenance shell and restart the system."
# Start a single user shell on the console
if ! sulogin $CONSOLE
then
log_failure_msg "Attempt to start maintenance shell failed.
Will restart in 5 seconds."
sleep 5
fi
[ "$VERBOSE" = no ] || log_action_msg "Will now restart"
reboot -f
elif [ "$FSCKCODE" -gt 1 ]
then
log_failure_msg "The file system check corrected errors on the root partition
but requested that the system be restarted."
log_warning_msg "The system will be restarted in 5 seconds."
sleep 5
[ "$VERBOSE" = no ] || log_action_msg "Will now restart"
reboot -f
fi
#
# Remount root to final mode (rw or ro).
#
# See the comments above at the previous "mount -o remount"
# for an explanation why we try this twice.
#
if ! mount -n -o remount,$rootopts,$rootmode $fstabroot / 2>/dev/null
then
mount -n -o remount,$rootopts,$rootmode /
fi
#
# We only create/modify /etc/mtab if the location where it is
# stored is writable. If /etc/mtab is a symlink into /proc/
# then it is not writable.
#
INIT_MTAB_FILE=no
MTAB_PATH="$(readlink -f /etc/mtab || :)"
case "$MTAB_PATH" in
/proc/*)
;;
/*)
if touch "$MTAB_PATH" >/dev/null 2>&1
then
:> "$MTAB_PATH"
rm -f ${MTAB_PATH}~
INIT_MTAB_FILE=yes
fi
;;
"")
[ -L /etc/mtab ] && MTAB_PATH="$(readlink /etc/mtab)"
if [ "$MTAB_PATH" ]
then
log_failure_msg "Cannot initialize ${MTAB_PATH}."
else
log_failure_msg "Cannot initialize /etc/mtab."
fi
;;
*)
log_failure_msg "Illegal mtab location '${MTAB_PATH}'."
;;
esac
if [ "$INIT_MTAB_FILE" = yes ]
then
[ "$roottype" != none ] &&
mount -f -o $rootopts -t $roottype $fstabroot /
fi
#
# Remove /lib/init/rw/rootdev if we created it.
#
rm -f /lib/init/rw/rootdev
}
do_status () {
# If / is read-write or swap is enabled, this script have done
# its job.
rootrw=false
swapon=false
if [ -f /etc/mtab ] ; then
if grep " / " /etc/mtab |grep -q rw ; then
rootrw=true
fi
fi
if [ -f /proc/swaps ] ; then
if [ "$(cat /proc/swaps |grep -v ^Filename)" ] ; then
swapon=true
fi
fi
if [ true = "$rootrw" ] || [ true = "$swapon" ] ; then
return 0
else
return 4
fi
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
do_status
exit $?
;;
*)
echo "Usage: checkroot.sh [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[ portmapnu W+A #!/bin/sh
#
# start/stop portmap daemon.
### BEGIN INIT INFO
# Provides: portmap
# Required-Start: $network $local_fs
# Required-Stop: $network $local_fs
# Default-Start: S 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: The RPC portmapper
# Description: Portmap is a server that converts RPC (Remote
# Procedure Call) program numbers into DARPA
# protocol port numbers. It must be running in
# order to make RPC calls. Services that use
# RPC include NFS and NIS.
### END INIT INFO
test -f /sbin/portmap || exit 0
. /lib/lsb/init-functions
OPTIONS=""
if [ -f /etc/default/portmap ]; then
. /etc/default/portmap
elif [ -f /etc/portmap.conf ]; then
. /etc/portmap.conf
fi
case "$1" in
start)
log_begin_msg "Starting portmap daemon..."
pid=$( pidofproc -p /var/run/portmap.pid /sbin/portmap )
if [ -n "$pid" ] ; then
log_begin_msg "Already running."
log_end_msg 0
exit 0
fi
start-stop-daemon --start --quiet --oknodo --exec /sbin/portmap -- $OPTIONS
log_end_msg $?
if [ -f /var/run/portmap.upgrade-state ]; then
log_begin_msg "Restoring old RPC service information..."
sleep 1 # needs a short pause or pmap_set won't work. :(
pmap_set /var/run/portmap.state
start-stop-daemon --stop --quiet --oknodo --exec /sbin/portmap
log_end_msg $?
;;
force-reload)
$0 restart
;;
restart)
$0 stop
$0 start
;;
status)
status_of_proc -p /var/run/portmap.pid /sbin/portmap portmap && exit 0 || exit $?
;;
*)
log_success_msg "Usage: /etc/init.d/portmap {start|stop|force-reload|restart|status}"
exit 1
;;
esac
exit 0
PK +#Y[y) ) exim4nu W+A #! /bin/sh
# /etc/init.d/exim4
#
# Written by Miquel van Smoorenburg .
# Modified for Debian GNU/Linux by Ian Murdock .
# Modified for exim by Tim Cutts
# Modified for exim4 by Andreas Metzler
# and Marc Haber
### BEGIN INIT INFO
# Provides: exim4
# Required-Start: $remote_fs $syslog $named $network $time
# Required-Stop: $remote_fs $syslog $named $network
# Should-Start: postgresql mysql clamav-daemon greylist spamassassin
# Should-Stop: postgresql mysql clamav-daemon greylist spamassassin
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: exim Mail Transport Agent
# Description: exim is a Mail Transport agent
### END INIT INFO
set -e
test -x /usr/lib/exim4/exim4 || exit 0
. /lib/lsb/init-functions
if [ -n "$EX4DEBUG" ]; then
echo "now debugging $0 $@"
set -x
fi
LANG=C
export LANG
#read default file
QUEUERUNNER='combined'
QUEUEINTERVAL='30m'
UPEX4OPTS=''
PIDFILE="/var/run/exim4/exim.pid"
QRPIDFILE="/var/run/exim4/eximqr.pid"
[ -f /etc/default/exim4 ] && . /etc/default/exim4
upex4conf() {
UPEX4CONF="update-exim4.conf"
OLDIFS="$IFS"
IFS=:
for p in $PATH; do
if [ -x "$p/$UPEX4CONF" ]; then
IFS="$OLDIFS"
$p/$UPEX4CONF $UPEX4OPTS
return 0
fi
done
IFS="$OLDIFS"
}
# Exit if exim runs from /etc/inetd.conf
if [ -f /etc/inetd.conf ] && grep -E -q '^[[:space:]]*((\*|[[:alnum:].-]+):)?smtp[[:space:]]' /etc/inetd.conf
then
upex4conf
exit 0
fi
DAEMON="/usr/sbin/exim4"
NAME="exim4"
# this is from madduck on IRC, 2006-07-06
# There should be a better possibility to give daemon error messages
# and/or to log things
log()
{
case "$1" in
[[:digit:]]*) success=$1; shift;;
*) :;;
esac
log_action_begin_msg "$1"; shift
log_action_end_msg ${success:-0} "$*"
}
start_exim()
{
[ -e /var/run/exim4 ] || \
install -d -oDebian-exim -gDebian-exim -m750 /var/run/exim4
case ${QUEUERUNNER} in
combined)
start_daemon -p "$PIDFILE" \
"$DAEMON" -bd "-q${QFLAGS}${QUEUEINTERVAL}" \
${COMMONOPTIONS} \
${QUEUERUNNEROPTIONS} \
${SMTPLISTENEROPTIONS}
log_progress_msg "exim4"
;;
separate)
start_daemon -p "$PIDFILE" \
"$DAEMON" -bd \
${COMMONOPTIONS} \
${SMTPLISTENEROPTIONS}
log_progress_msg "exim4_listener"
start_daemon -p "$QRPIDFILE" \
"$DAEMON" -oP $QRPIDFILE \
"-q${QFLAGS}${QUEUEINTERVAL}" \
${COMMONOPTIONS} \
${QUEUERUNNEROPTIONS}
log_progress_msg "exim4_queuerunner"
;;
queueonly)
start_daemon -p "$QRPIDFILE" \
"$DAEMON" -oP $QRPIDFILE \
"-q${QFLAGS}${QUEUEINTERVAL}" \
${COMMONOPTIONS} \
${QUEUERUNNEROPTIONS}
log_progress_msg "exim4_queuerunner"
;;
no|ppp)
start_daemon -p "$PIDFILE" \
"$DAEMON" -bd \
${COMMONOPTIONS} \
${SMTPLISTENEROPTIONS}
log_progress_msg "exim4_listener"
;;
nodaemon)
;;
esac
}
stop_exim()
{
# we try to kill eximqr and exim SMTP listener, no matter what
# ${QUEUERUNNER} is set to, we could have switched since starting.
if [ -f "$QRPIDFILE" ]; then
killproc -p "$QRPIDFILE" "$DAEMON"
log_progress_msg "exim4_queuerunner"
fi
if [ -f "$PIDFILE" ]; then
killproc -p "$PIDFILE" "$DAEMON"
log_progress_msg "exim4_listener"
fi
}
reload_exim()
{
case ${QUEUERUNNER} in
combined|no|ppp)
killproc -p "$PIDFILE" "$DAEMON" -HUP
log_progress_msg "exim4"
;;
separate)
killproc -p "$PIDFILE" "$DAEMON" -HUP
log_progress_msg "exim4_listener"
killproc -p "$QRPIDFILE" "$DAEMON" -HUP
log_progress_msg "exim4_queuerunner"
;;
esac
}
kill_all_exims()
{ SIG="${1:-TERM}"
for pid in $(pidof $NAME); do
if [ "$(readlink /proc/$pid/root)" = "/" ]; then
kill -$SIG $pid
fi
done
}
status()
{
# the exit value of this function reflects the status of the SMTP
# service. Output shows the status of the queue runner as well.
SMTPNAME="SMTP listener daemon"
QRNAME="separate queue runner daemon"
if [ "${QUEUERUNNER}" = "combined" ]; then
SMTPNAME="combined SMTP listener and queue runner daemon"
fi
log_action_begin_msg "checking $QRNAME"
if pidofproc -p "$QRPIDFILE" >/dev/null; then
log_action_end_msg 0 "running"
else
if [ -e "$QRPIDFILE" ]; then
log_action_end_msg 1 "$QRNAME failed"
else
log_action_end_msg 0 "not running"
fi
fi
log_action_begin_msg "checking $SMTPNAME"
if pidofproc -p "$PIDFILE" >/dev/null; then
log_action_end_msg 0 "running"
exit 0
else
if [ -e "$PIDFILE" ]; then
log_action_end_msg 1 "$SMTPNAME failed"
exit 1
else
log_action_end_msg 0 "not running"
exit 3
fi
fi
}
# check for valid configuration file
isconfigvalid()
{
if ! $DAEMON -bV > /dev/null ; then
log 1 "Warning! Invalid configuration file for $NAME. Exiting."
exit 1
fi
}
# check for non-empty paniclog
warn_paniclog()
{
if [ -s "/var/log/exim4/paniclog" ]; then
if [ -z "$E4BCD_PANICLOG_NOISE" ] || grep -vq "$E4BCD_PANICLOG_NOISE" /var/log/exim4/paniclog; then
log_failure_msg "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken"
fi
fi
}
case "$1" in
start)
log_daemon_msg "Starting MTA"
# regenerate exim4.conf
upex4conf
isconfigvalid
start_exim
log_end_msg 0
warn_paniclog
;;
stop)
log_daemon_msg "Stopping MTA"
stop_exim
log_end_msg 0
warn_paniclog
;;
restart)
log_daemon_msg "Stopping MTA for restart"
# regenerate exim4.conf
upex4conf
isconfigvalid
stop_exim
log_end_msg 0
sleep 2
log_daemon_msg "Restarting MTA"
start_exim
log_end_msg 0
warn_paniclog
;;
reload|force-reload)
log_daemon_msg "Reloading $NAME configuration files"
# regenerate exim4.conf
upex4conf
isconfigvalid
reload_exim
log_end_msg 0
warn_paniclog
;;
status)
status
;;
what)
exiwhat
;;
force-stop)
kill_all_exims $2
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status|what|force-stop}"
exit 1
;;
esac
exit 0
# vim:tabstop=2:expandtab:shiftwidth=2
PK +#Y[Re e bootmisc.shnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: bootmisc
# Required-Start: $remote_fs
# Required-Stop:
# Should-Start: udev
# Default-Start: S
# Default-Stop:
# Short-Description: Miscellaneous things to be done during bootup.
# Description: Some cleanup. Note, it need to run after mountnfs-bootclean.sh.
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
. /lib/init/vars.sh
do_start () {
#
# If login delaying is enabled then create the flag file
# which prevents logins before startup is complete
#
case "$DELAYLOGIN" in
Y*|y*)
echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin
;;
esac
# Create /var/run/utmp so we can login.
: > /var/run/utmp
if grep -q ^utmp: /etc/group
then
chmod 664 /var/run/utmp
chgrp utmp /var/run/utmp
fi
# Set pseudo-terminal access permissions.
if [ ! -e /dev/.udev ] && [ -c /dev/ttyp0 ]
then
chmod -f 666 /dev/tty[p-za-e][0-9a-f]
chown -f root:tty /dev/tty[p-za-e][0-9a-f]
fi
# Remove bootclean's flag files.
# Don't run bootclean again after this!
rm -f /tmp/.clean /var/run/.clean /var/lock/.clean
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: bootmisc.sh [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[迨 dhcpv6_hack.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: dhcpv6_hack
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: dhcp v6 key creation.
# Description: Create dhcp v6 key.
### END INIT INFO
DHCP6CCTLKEY=/etc/wide-dhcpv6/dhcp6cctlkey
case "$1" in
start|"")
# The key mustn\'t be world readable
umask 066
echo "Generating ${DHCP6CCTLKEY}..." >&2
dd if=/dev/random bs=32 count=1 2>/dev/null | uuencode -m ${DHCP6CCTLKEY} | head -n 2 | tail -n 1 > ${DHCP6CCTLKEY}
umask 022
/usr/sbin/update-rc.d dhcpv6_hack.sh remove >/dev/null 2>&1
;;
*)
echo "Usage: dhcpv6_hack [start]" >&2
exit 3
;;
esac
:
PK +#Y[
cG_ _ umountnfs.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: umountnfs
# Required-Start:
# Required-Stop: umountfs
# Should-Stop: $network $portmap nfs-common
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Unmount all network filesystems except the root fs.
# Description: Also unmounts all virtual filesystems (proc,
# devpts, usbfs, sysfs) that are not mounted at the
# top level.
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
KERNEL="$(uname -s)"
RELEASE="$(uname -r)"
. /lib/init/vars.sh
. /lib/lsb/init-functions
case "${KERNEL}:${RELEASE}" in
Linux:[01].*|Linux:2.[01].*)
FLAGS=""
;;
Linux:2.[23].*|Linux:2.4.?|Linux:2.4.?-*|Linux:2.4.10|Linux:2.4.10-*)
FLAGS="-f"
;;
*)
FLAGS="-f -l"
;;
esac
do_stop () {
# Write a reboot record to /var/log/wtmp before unmounting
halt -w
# Remove bootclean flag files (precaution against symlink attacks)
rm -f /tmp/.clean /var/lock/.clean /var/run/.clean
#
# Make list of points to unmount in reverse order of their creation
#
exec 9<&0 &2
exit 3
;;
stop|"")
do_stop
;;
*)
echo "Usage: umountnfs.sh [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[
umountrootnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: umountroot
# Required-Start:
# Required-Stop:
# Should-Stop: halt reboot kexec
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Mount the root filesystem read-only.
### END INIT INFO
PATH=/sbin:/bin
. /lib/init/vars.sh
. /lib/lsb/init-functions
do_stop () {
[ "$VERBOSE" = no ] || log_action_begin_msg "Mounting root filesystem read-only"
# These directories must exist on the root filesystem as they are
# targets for system mountpoints. We've just unmounted all other
# filesystems, so either they are mounted now (in which case the
# mount point exists) or we can make the mountpoint.
for dir in /proc /sys /var/run /var/lock; do
mkdir -p $dir || true
done
MOUNT_FORCE_OPT=
[ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f
# This:
# mount -n -o remount,ro /
# will act on a bind mount of / if there is one.
# See #339023 and the comment in checkroot.sh
mount $MOUNT_FORCE_OPT -n -o remount,ro -t dummytype dummydev / 2>/dev/null \
|| mount $MOUNT_FORCE_OPT -n -o remount,ro dummydev / 2>/dev/null \
|| mount $MOUNT_FORCE_OPT -n -o remount,ro /
ES=$?
[ "$VERBOSE" = no ] || log_action_end_msg $ES
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:
PK +#Y[fu u rcSnu W+A #! /bin/sh
#
# rcS
#
# Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order
#
exec /etc/init.d/rc S
PK +#Y[vw skeletonnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: skeleton
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
### END INIT INFO
# Author: Foo Bar
#
# Please remove the "Author" lines above and replace them
# with your own name if you copy and modify this script.
# Do NOT "set -e"
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="Description of the service"
NAME=daemonexecutablename
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS="--options args"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present
# and status_of_proc is working.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
|| return 1
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
$DAEMON_ARGS \
|| return 2
# Add code here, if necessary, that waits for the process to be ready
# to handle requests from services started subsequently which depend
# on this one. As a last resort, sleep for some time.
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
RETVAL="$?"
[ "$RETVAL" = 2 ] && return 2
# Wait for children to finish too if this is a daemon that forks
# and if the daemon is only ever run from this initscript.
# If the above conditions are not satisfied then add some other code
# that waits for the process to drop all resources that could be
# needed by services started subsequently. A last resort is to
# sleep for some time.
start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
[ "$?" = 2 ] && return 2
# Many daemons don't delete their pidfiles when they exit.
rm -f $PIDFILE
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
#
# If the daemon can reload its configuration without
# restarting (for example, when it is sent a SIGHUP),
# then implement that here.
#
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
return 0
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
#reload|force-reload)
#
# If do_reload() is not implemented then leave this commented out
# and leave 'force-reload' as an alias for 'restart'.
#
#log_daemon_msg "Reloading $DESC" "$NAME"
#do_reload
#log_end_msg $?
#;;
restart|force-reload)
#
# If the "reload" option is implemented then remove the
# 'force-reload' alias
#
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
#echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:
PK +#Y[, sendsigsnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: sendsigs
# Required-Start:
# Required-Stop: umountnfs
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Kill all remaining processes.
# Description:
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
. /lib/lsb/init-functions
# Make it possible to see who the misbehaving processes are
report_unkillable() {
if [ -x /usr/bin/pstree ] ; then
echo "Currently running processes (pstree):"
pstree
elif [ -x /bin/ps ] ; then
echo "Currently running processes (ps):"
ps -ef
fi
}
do_stop () {
OMITPIDS=
# The /var/run/sendsigs.omit file is used to be compatible
# with Ubuntu.
for omitfile in /var/run/sendsigs.omit /lib/init/rw/sendsigs.omit; do
if [ -e $omitfile ]; then
for pid in $(cat $omitfile); do
OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
done
fi
done
# Load sendsigs.omit.d/packagename files too, to make it
# possible for scripts that need to modify the list of pids at
# run time without race conditions.
if [ -d /lib/init/rw/sendsigs.omit.d/ ]; then
for pidfile in /lib/init/rw/sendsigs.omit.d/*; do
[ -f "$pidfile" ] || continue
for pid in $(cat $pidfile); do
OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
done
done
fi
# Upstart jobs have their own "stop on" clauses that sends
# SIGTERM/SIGKILL just like this, so if they're still running,
# they're supposed to be
if [ -x /sbin/initctl ]; then
for pid in $(initctl list | sed -n -e "/process [0-9]/s/.*process //p"); do
OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
done
fi
# Flush the kernel I/O buffer before we start to kill
# processes, to make sure the IO of already stopped services to
# not slow down the remaining processes to a point where they
# are accidentily killed with SIGKILL because they did not
# manage to shut down in time.
sync
# Kill all processes.
log_action_begin_msg "Asking all remaining processes to terminate"
killall5 -15 $OMITPIDS # SIGTERM
log_action_end_msg 0
alldead=""
for seq in 1 2 3 4 5 6 7 8 9 10; do
# use SIGCONT/signal 18 to check if there are
# processes left. No need to check the exit code
# value, because either killall5 work and it make
# sense to wait for processes to die, or it fail and
# there is nothing to wait for.
# did an upstart job start since we last polled initctl? check
# again on each loop and add any new jobs (e.g., plymouth) to
# the list. If we did miss one starting up, this beats waiting
# 10 seconds before shutting down.
if [ -x /sbin/initctl ]; then
for pid in $(initctl list | sed -n -e "/process [0-9]/s/.*process //p"); do
OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
done
fi
if killall5 -18 $OMITPIDS ; then
:
else
alldead=1
break
fi
sleep 1
done
if [ -z "$alldead" ] ; then
report_unkillable
log_action_begin_msg "Killing all remaining processes"
killall5 -9 $OMITPIDS # SIGKILL
log_action_end_msg 1
else
log_action_begin_msg "All processes ended within $seq seconds."
log_action_end_msg 0
fi
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:
PK +#Y[q% cronnu W+A #!/bin/sh
# Start/stop the cron daemon.
#
### BEGIN INIT INFO
# Provides: cron
# Required-Start: $remote_fs $syslog $time
# Required-Stop: $remote_fs $syslog $time
# Should-Start: $named slapd autofs ypbind nscd nslcd
# Should-Stop: $named slapd autofs ypbind nscd nslcd
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Regular background program processing daemon
# Description: cron is a standard UNIX program that runs user-specified
# programs at periodic scheduled times. vixie cron adds a
# number of features to the basic UNIX cron, including better
# security and more powerful configuration options.
### END INIT INFO
test -f /usr/sbin/cron || exit 0
PIDFILE=/var/run/crond.pid
# In some systems the pidfile might be (incorrectly) set to /etc
# if this pidfile is present, use it instead.
[ -e /etc/cron.pid ] && PIDFILE=/etc/crond.pid
[ -r /etc/default/cron ] && . /etc/default/cron
. /lib/lsb/init-functions
# Read the system's locale and set cron's locale. This is only used for
# setting the charset of mails generated by cron. To provide locale
# information to tasks running under cron, see /etc/pam.d/cron.
#
# We read /etc/environment, but warn about locale information in
# there because it should be in /etc/default/locale.
parse_environment ()
{
for ENV_FILE in /etc/environment /etc/default/locale; do
[ -r "$ENV_FILE" ] || continue
[ -s "$ENV_FILE" ] || continue
for var in LANG LANGUAGE LC_ALL LC_CTYPE; do
value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2`
[ -n "$value" ] && eval export $var=$value
if [ -n "$value" ] && [ "$ENV_FILE" = /etc/environment ]; then
log_warning_msg "/etc/environment has been deprecated for locale information; use /etc/default/locale for $var=$value instead"
fi
done
done
# Get the timezone set.
if [ -z "$TZ" -a -e /etc/timezone ]; then
TZ=`cat /etc/timezone`
fi
}
# Parse the system's environment
if [ "$READ_ENV" = "yes" ] ; then
export LANG LC_ALL LC_CTYPE TZ LC_COLLATE
parse_environment
LC_COLLATE=C # Force collation sequence since ASCII is expected in regexps
fi
case "$1" in
start) log_daemon_msg "Starting periodic command scheduler" "cron"
start-stop-daemon --start --quiet --pidfile $PIDFILE --name cron --startas /usr/sbin/cron -- $LSBNAMES $EXTRA_OPTS
log_end_msg $?
;;
stop) log_daemon_msg "Stopping periodic command scheduler" "cron"
start-stop-daemon --stop --quiet --pidfile $PIDFILE --name cron
log_end_msg $?
;;
restart) log_daemon_msg "Restarting periodic command scheduler" "cron"
start-stop-daemon --stop --retry 5 --quiet --pidfile $PIDFILE --name cron
start-stop-daemon --start --quiet --pidfile $PIDFILE --name cron --startas /usr/sbin/cron -- $LSBNAMES $EXTRA_OPTS
log_end_msg $?
;;
reload|force-reload) log_daemon_msg "Reloading configuration files for periodic command scheduler" "cron"
# cron reloads automatically
log_end_msg 0
;;
status)
log_action_begin_msg "Checking periodic command scheduler"
if pidofproc -p "$PIDFILE" >/dev/null; then
log_action_end_msg 0 "running"
exit 0
else
if [ -e "$PIDFILE" ]; then
log_action_end_msg 1 "failed to start"
exit 1
else
log_action_end_msg 0 "not running"
exit 3
fi
fi
;;
*) log_action_msg "Usage: /etc/init.d/cron {start|stop|status|restart|reload|force-reload}"
exit 2
;;
esac
exit 0
PK +#Y[e nginxnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
### END INIT INFO
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/nginx
NAME=nginx
DESC=nginx
test -x $DAEMON || exit 0
# Include nginx defaults if available
if [ -f /etc/default/nginx ] ; then
. /etc/default/nginx
fi
set -e
. /lib/lsb/init-functions
test_nginx_config() {
if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1
then
return 0
else
$DAEMON -t $DAEMON_OPTS
return $?
fi
}
case "$1" in
start)
echo -n "Starting $DESC: "
test_nginx_config
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS || true
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON || true
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON || true
sleep 1
test_nginx_config
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS || true
echo "$NAME."
;;
reload)
echo -n "Reloading $DESC configuration: "
test_nginx_config
start-stop-daemon --stop --signal HUP --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON || true
echo "$NAME."
;;
configtest)
echo -n "Testing $DESC configuration: "
if test_nginx_config
then
echo "$NAME."
else
exit $?
fi
;;
status)
status_of_proc -p /var/run/$NAME.pid "$DAEMON" nginx && exit 0 || exit $?
;;
*)
echo "Usage: $NAME {start|stop|restart|reload|force-reload|status|configtest}" >&2
exit 1
;;
esac
exit 0
PK +#Y[) procpsnu W+A #! /bin/sh
# /etc/init.d/procps: Set kernel variables from /etc/sysctl.conf
#
# written by Elrond
### BEGIN INIT INFO
# Provides: procps
# Required-Start: mountkernfs $local_fs
# Required-Stop:
# Should-Start: udev module-init-tools
# Default-Start: S
# Default-Stop:
# Short-Description: Configure kernel parameters at boottime
# Description: Loads kernel parameters that are specified in /etc/sysctl.conf
### END INIT INFO
PATH=/sbin:/bin
SYSCTL=/sbin/sysctl
test -x $SYSCTL || exit 0
. /lib/lsb/init-functions
# Comment this out for sysctl to print every item changed
QUIET_SYSCTL="-q"
# Check for existance of the default file and exit if not there,
# Closes #52839 for the boot-floppy people
if [ -f /etc/default/rcS ] ; then
. /etc/default/rcS
fi
set -e
case "$1" in
start|restart|force-reload)
log_action_begin_msg "Setting kernel variables "
STATUS=0
for file in /etc/sysctl.conf /etc/sysctl.d/*.conf ; do
if [ -r "$file" ] ; then
if [ "$VERBOSE" = "yes" ] ; then
log_action_cont_msg " $file"
fi
$SYSCTL $QUIET_SYSCTL -p "$file" || STATUS=$?
fi
done
log_action_end_msg $STATUS
;;
stop)
;;
*)
echo "Usage: /etc/init.d/procps {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
PK +#Y[m m ssh_key_hack.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: ssh_key_hack
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: ssh keys creation.
# Description: Create ssh keys.
### END INIT INFO
case "$1" in
start|"")
rm -f /etc/ssh/ssh_host_*
/usr/bin/ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
/usr/bin/ssh-keygen -t dsa -N '' -f /etc/ssh/ssh_host_dsa_key
/usr/bin/ssh-keygen -t rsa1 -N '' -f /etc/ssh/ssh_host_key
/usr/sbin/update-rc.d ssh_key_hack.sh remove >/dev/null 2>&1
;;
*)
echo "Usage: ssh_key_hack [start]" >&2
exit 3
;;
esac
:
PK +#Y[p apache2nu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: apache2
# Required-Start: $local_fs $remote_fs $network $syslog $named
# Required-Stop: $local_fs $remote_fs $network $syslog $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: Start/stop apache2 web server
### END INIT INFO
set -e
SCRIPTNAME="${0##*/}"
SCRIPTNAME="${SCRIPTNAME##[KS][0-9][0-9]}"
if [ -n "$APACHE_CONFDIR" ] ; then
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then
DIR_SUFFIX="${APACHE_CONFDIR##/etc/apache2-}"
else
DIR_SUFFIX=
fi
elif [ "${SCRIPTNAME##apache2-}" != "$SCRIPTNAME" ] ; then
DIR_SUFFIX="-${SCRIPTNAME##apache2-}"
APACHE_CONFDIR=/etc/apache2$DIR_SUFFIX
else
DIR_SUFFIX=
APACHE_CONFDIR=/etc/apache2
fi
if [ -z "$APACHE_ENVVARS" ] ; then
APACHE_ENVVARS=$APACHE_CONFDIR/envvars
fi
export APACHE_CONFDIR APACHE_ENVVARS
ENV="env -i LANG=C PATH=/usr/local/bin:/usr/bin:/bin"
if [ "$APACHE_CONFDIR" != /etc/apache2 ] ; then
ENV="$ENV APACHE_CONFDIR=$APACHE_CONFDIR"
fi
if [ "$APACHE_ENVVARS" != "$APACHE_CONFDIR/envvars" ] ; then
ENV="$ENV APACHE_ENVVARS=$APACHE_ENVVARS"
fi
#edit /etc/default/apache2 to change this.
HTCACHECLEAN_RUN=auto
HTCACHECLEAN_MODE=daemon
HTCACHECLEAN_SIZE=300M
HTCACHECLEAN_DAEMON_INTERVAL=120
HTCACHECLEAN_PATH=/var/cache/apache2$DIR_SUFFIX/mod_disk_cache
HTCACHECLEAN_OPTIONS=""
APACHE_HTTPD=$(. $APACHE_ENVVARS && echo $APACHE_HTTPD)
if [ -z "$APACHE_HTTPD" ] ; then
APACHE_HTTPD=/usr/sbin/apache2
fi
if [ ! -x $APACHE_HTTPD ] ; then
echo "No apache MPM package installed"
exit 0
fi
. /lib/lsb/init-functions
test -f /etc/default/rcS && . /etc/default/rcS
if [ -f /etc/default/apache2$DIR_SUFFIX ] ; then
. /etc/default/apache2$DIR_SUFFIX
elif [ -f /etc/default/apache2 ] ; then
. /etc/default/apache2
fi
APACHE2CTL="$ENV /usr/sbin/apache2ctl"
HTCACHECLEAN="$ENV /usr/sbin/htcacheclean"
PIDFILE=$(. $APACHE_ENVVARS && echo $APACHE_PID_FILE)
if [ -z "$PIDFILE" ] ; then
echo ERROR: APACHE_PID_FILE needs to be defined in $APACHE_ENVVARS >&2
exit 2
fi
check_htcacheclean() {
[ "$HTCACHECLEAN_MODE" = "daemon" ] || return 1
[ "$HTCACHECLEAN_RUN" = "yes" ] && return 0
MODSDIR=$(. $APACHE_ENVVARS && echo $APACHE_MODS_ENABLED)
[ "$HTCACHECLEAN_RUN" = "auto" \
-a -e ${MODSDIR:-$APACHE_CONFDIR/mods-enabled}/disk_cache.load ] && \
return 0
return 1
}
start_htcacheclean() {
if [ ! -d "$HTCACHECLEAN_PATH" ] ; then
echo "... directory $HTCACHECLEAN_PATH does not exist!" >&2
return 1
fi
$HTCACHECLEAN $HTCACHECLEAN_OPTIONS -d$HTCACHECLEAN_DAEMON_INTERVAL \
-i -p$HTCACHECLEAN_PATH -l$HTCACHECLEAN_SIZE
}
stop_htcacheclean() {
pkill -P 1 -f "htcacheclean.* -p$HTCACHECLEAN_PATH " 2> /dev/null || echo ...not running
}
pidof_apache() {
# if there is actually an apache2 process whose pid is in PIDFILE,
# print it and return 0.
if [ -e "$PIDFILE" ]; then
if pidof apache2 | tr ' ' '\n' | grep -w $(cat $PIDFILE); then
return 0
fi
fi
return 1
}
apache_stop() {
if $APACHE2CTL configtest > /dev/null 2>&1; then
# if the config is ok than we just stop normaly
$APACHE2CTL stop 2>&1 | grep -v 'not running' >&2 || true
else
# if we are here something is broken and we need to try
# to exit as nice and clean as possible
PID=$(pidof_apache) || true
if [ "${PID}" ]; then
# in this case it is everything nice and dandy and we kill apache2
echo
log_warning_msg "The apache2$DIR_SUFFIX configtest failed, so we are trying to kill it manually. This is almost certainly suboptimal, so please make sure your system is working as you'd expect now!"
kill $PID
elif [ "$(pidof apache2)" ]; then
if [ "$VERBOSE" != no ]; then
echo " ... failed!"
echo "You may still have some apache2 processes running. There are"
echo "processes named 'apache2' which do not match your pid file,"
echo "and in the name of safety, we've left them alone. Please review"
echo "the situation by hand."
fi
return 1
fi
fi
}
apache_wait_stop() {
# running ?
PIDTMP=$(pidof_apache) || true
if kill -0 "${PIDTMP:-}" 2> /dev/null; then
PID=$PIDTMP
fi
apache_stop
# wait until really stopped
if [ -n "${PID:-}" ]; then
i=0
while kill -0 "${PID:-}" 2> /dev/null; do
if [ $i = '60' ]; then
break;
else
if [ $i = '0' ]; then
echo -n " ... waiting "
else
echo -n "."
fi
i=$(($i+1))
sleep 1
fi
done
fi
}
case $1 in
start)
log_daemon_msg "Starting web server" "apache2"
if $APACHE2CTL start; then
if check_htcacheclean ; then
log_progress_msg htcacheclean
start_htcacheclean || log_end_msg 1
fi
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
if check_htcacheclean ; then
log_daemon_msg "Stopping web server" "htcacheclean"
stop_htcacheclean
log_progress_msg "apache2"
else
log_daemon_msg "Stopping web server" "apache2"
fi
if apache_wait_stop; then
log_end_msg 0
else
log_end_msg 1
fi
;;
graceful-stop)
if check_htcacheclean ; then
log_daemon_msg "Stopping web server" "htcacheclean"
stop_htcacheclean
log_progress_msg "apache2"
else
log_daemon_msg "Stopping web server" "apache2"
fi
if $APACHE2CTL graceful-stop; then
log_end_msg 0
else
log_end_msg 1
fi
;;
reload | force-reload | graceful)
if ! $APACHE2CTL configtest > /dev/null 2>&1; then
$APACHE2CTL configtest || true
log_end_msg 1
exit 1
fi
log_daemon_msg "Reloading web server config" "apache2"
if pidof_apache > /dev/null ; then
if $APACHE2CTL graceful $2 ; then
log_end_msg 0
else
log_end_msg 1
fi
fi
;;
restart)
if ! $APACHE2CTL configtest > /dev/null 2>&1; then
$APACHE2CTL configtest || true
log_end_msg 1
exit 1
fi
if check_htcacheclean ; then
log_daemon_msg "Restarting web server" "htcacheclean"
stop_htcacheclean
log_progress_msg apache2
else
log_daemon_msg "Restarting web server" "apache2"
fi
PID=$(pidof_apache) || true
if ! apache_wait_stop; then
log_end_msg 1 || true
fi
if $APACHE2CTL start; then
if check_htcacheclean ; then
start_htcacheclean || log_end_msg 1
fi
log_end_msg 0
else
log_end_msg 1
fi
;;
start-htcacheclean)
log_daemon_msg "Starting htcacheclean"
start_htcacheclean || log_end_msg 1
log_end_msg 0
;;
stop-htcacheclean)
log_daemon_msg "Stopping htcacheclean"
stop_htcacheclean
log_end_msg 0
;;
status)
PID=$(pidof_apache) || true
if [ -n "$PID" ]; then
echo "Apache2$DIR_SUFFIX is running (pid $PID)."
exit 0
else
echo "Apache2$DIR_SUFFIX is NOT running."
if [ -e "$PIDFILE" ]; then
exit 1
else
exit 3
fi
fi
;;
*)
log_success_msg "Usage: /etc/init.d/apache2$DIR_SUFFIX {start|stop|graceful-stop|restart|reload|force-reload|start-htcacheclean|stop-htcacheclean|status}"
exit 1
;;
esac
PK +#Y[
;+ + bootlogsnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: bootlogs
# Required-Start: hostname $local_fs
# Required-Stop:
# Should-Start: $x-display-manager gdm kdm xdm ldm sdm wdm nodm
# Default-Start: 1 2 3 4 5
# Default-Stop:
# Short-Description: Log file handling to be done during bootup.
# Description: Various things that don't need to be done particularly
# early in the boot, just before getty is run.
### END INIT INFO
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
. /lib/init/vars.sh
do_start () {
# Update motd
uname -snrvm > /var/run/motd
[ -f /etc/motd.tail ] && cat /etc/motd.tail >> /var/run/motd
# Save kernel messages in /var/log/dmesg
if which dmesg >/dev/null 2>&1
then
[ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg
dmesg -s 524288 > /var/log/dmesg
chgrp adm /var/log/dmesg || :
elif [ -c /dev/klog ]
then
[ -f /var/log/dmesg ] && savelog -q -p -c 5 /var/log/dmesg
dd if=/dev/klog of=/var/log/dmesg &
sleep 1
kill $!
[ -f /var/log/dmesg ] && { chgrp adm /var/log/dmesg || : ; }
fi
#
# Save udev log in /var/log/udev
#
if [ -e /dev/.udev.log ]
then
mv -f /dev/.udev.log /var/log/udev
fi
}
do_status () {
if [ -f /var/run/motd ] && [ ! -f /dev/.udev.log ] ; then
return 0
else
return 4
fi
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
status)
do_status
exit $?
;;
*)
echo "Usage: bootlogs [start|stop|status]" >&2
exit 3
;;
esac
:
PK +#Y[_ udev-mtabnu W+A #!/bin/sh -e
### BEGIN INIT INFO
# Provides: udev-mtab
# Required-Start: udev $local_fs
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Add to mtab the entry for /dev.
### END INIT INFO
PATH="/sbin:/bin"
case "$1" in
start) ;;
stop|restart|force-reload) exit 0 ;;
*) echo "Usage: $0 {start|stop|restart|force-reload}" >&2; exit 1 ;;
esac
# copy the rules generated before / was mounted read-write
for file in /dev/.udev/tmp-rules--*; do
dest=${file##*tmp-rules--}
[ "$dest" = '*' ] && break
cat $file >> /etc/udev/rules.d/$dest
rm -f $file
done
# if it's not, it's probably a symlink to /proc/mounts
[ -w /etc/mtab ] || exit 0
# defaults
tmpfs_size="10M"
udev_root="/dev/"
if [ -e /etc/udev/udev.conf ]; then
. /etc/udev/udev.conf
fi
# strip the trailing slash
udev_root=${udev_root%/}
if mountpoint -q $udev_root; then
if ! grep -E --quiet --no-messages "^[^ ]+ +$udev_root +" /etc/mtab; then
mtabline="$(grep -E --no-messages "^[^ ]+ +$udev_root +(dev)?tmpfs +" /proc/mounts || true)"
if [ "$mtabline" ]; then
echo "$mtabline" >> /etc/mtab
fi
fi
fi
exit 0
PK +#Y[}{q
checkfs.shnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: checkfs
# Required-Start: checkroot
# Required-Stop:
# Should-Start: mtab
# Default-Start: S
# Default-Stop:
# X-Interactive: true
# Short-Description: Check all filesystems.
### END INIT INFO
# Include /usr/bin in path to find on_ac_power if /usr/ is on the root
# partition.
PATH=/sbin:/bin:/usr/bin
FSCK_LOGFILE=/var/log/fsck/checkfs
[ "$FSCKFIX" ] || FSCKFIX=no
. /lib/init/vars.sh
. /lib/lsb/init-functions
. /lib/init/splash-functions-base
. /lib/init/usplash-fsck-functions.sh
. /lib/init/swap-functions.sh
do_start () {
# See if we're on AC Power. If not, we're not gonna run our
# check. If on_ac_power (in /usr/) is unavailable, behave as
# before and check all file systems needing it.
# Disabled AC power check until fsck can be told to only check the
# file system if it is corrupt when running on battery. (bug #526398)
# if which on_ac_power >/dev/null 2>&1
# then
# on_ac_power >/dev/null 2>&1
# if [ $? -eq 1 ]
# then
# [ "$VERBOSE" = no ] || log_success_msg "Running on battery power, so skipping file system check."
# BAT=yes
# fi
# fi
BAT=""
fscheck="yes"
if [ -f /fastboot ] || grep -s -w -i "fastboot" /proc/cmdline
then
[ "$fscheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check."
fscheck=no
fi
#
# Check the rest of the file systems.
#
if [ "$fscheck" = yes ] && [ ! "$BAT" ] && [ "$FSCKTYPES" != "none" ]
then
# Execute swapon command again, in case there are lvm
# or md swap partitions. fsck can suck RAM.
swaponagain 'lvm and md'
if [ -f /forcefsck ] || grep -s -w -i "forcefsck" /proc/cmdline
then
force="-f"
else
force=""
fi
if [ "$FSCKFIX" = yes ]
then
fix="-y"
else
fix="-a"
fi
spinner="-C"
case "$TERM" in
dumb|network|unknown|"")
spinner=""
;;
esac
[ "$(uname -m)" = s390 ] && spinner="" # This should go away
FSCKTYPES_OPT=""
[ "$FSCKTYPES" ] && FSCKTYPES_OPT="-t $FSCKTYPES"
handle_failed_fsck() {
log_failure_msg "File system check failed.
A log is being saved in ${FSCK_LOGFILE} if that location is writable.
Please repair the file system manually."
log_warning_msg "A maintenance shell will now be started.
CONTROL-D will terminate this shell and resume system boot."
# Start a single user shell on the console
if ! sulogin $CONSOLE
then
log_failure_msg "Attempt to start maintenance shell failed.
Continuing with system boot in 5 seconds."
sleep 5
fi
}
if [ "$VERBOSE" = no ]
then
log_action_begin_msg "Checking file systems"
if usplash_running; then
PROGRESS_FILE=`mktemp` || exit 1
set -m
logsave -s $FSCK_LOGFILE fsck -C3 -R -A $fix $force $FSCKTYPES_OPT >/dev/console 2>&1 3>$PROGRESS_FILE &
set +m
usplash_progress "$PROGRESS_FILE"
rm -f $PROGRESS_FILE
else
splash_start_indefinite
logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT
FSCKCODE=$?
splash_stop_indefinite
fi
if [ "$FSCKCODE" -gt 1 ]
then
log_action_end_msg 1 "code $FSCKCODE"
handle_failed_fsck
else
log_action_end_msg 0
fi
else
if [ "$FSCKTYPES" ]
then
log_action_msg "Will now check all file systems of types $FSCKTYPES"
else
log_action_msg "Will now check all file systems"
fi
splash_start_indefinite
logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT
FSCKCODE=$?
splash_stop_indefinite
if [ "$FSCKCODE" -gt 1 ]
then
handle_failed_fsck
else
log_success_msg "Done checking file systems.
A log is being saved in ${FSCK_LOGFILE} if that location is writable."
fi
fi
fi
rm -f /fastboot /forcefsck 2>/dev/null
}
case "$1" in
start|"")
do_start
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
# No-op
;;
*)
echo "Usage: checkfs.sh [start|stop]" >&2
exit 3
;;
esac
:
PK +#Y[C wide-dhcpv6-clientnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: wide-dhcpv6-client
# Required-Start: $syslog $network $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start/Stop WIDE DHCPv6 client
# Description: (empty)
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DHCP6CBIN=/usr/sbin/dhcp6c
DHCP6CPID=/var/run/dhcp6c.pid
NAME="dhcp6c"
DESC="WIDE DHCPv6 client"
. /lib/lsb/init-functions
test -x $DHCP6CBIN || exit 0
if [ ! -f /etc/default/wide-dhcpv6-client ]; then
log_failure_msg \
"/etc/default/wide-dhcpv6-client does not exist! - Aborting..."
log_failure_msg \
"Run 'dpkg-reconfigure wide-dhcpv6-client' to fix the problem."
exit 3
else
. /etc/default/wide-dhcpv6-client
fi
[ "X$INTERFACES" != "X" ] || exit 0
# single arg is -v for messages, -q for none
check_status()
{
if [ ! -r "$DHCP6CPID" ]; then
test "$1" != -v || echo "$NAME is not running."
return 3
fi
if read pid < "$DHCP6CPID" && ps -p "$pid" > /dev/null 2>&1; then
test "$1" != -v || echo "$NAME is running."
return 0
else
test "$1" != -v || echo "$NAME is not running but $DHCP6CPID exists."
return 1
fi
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --pidfile $DHCP6CPID \
--oknodo --exec $DHCP6CBIN -- -Pdefault $INTERFACES
sleep 2
if check_status -q; then
log_end_msg 0
else
log_end_msg 1
exit 1
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --quiet --pidfile $DHCP6CPID --oknodo
log_end_msg $?
rm -f $DHCP6CPID
;;
restart|force-reload)
$0 stop
sleep 2
$0 start
if [ "$?" != "0" ]; then
exit 1
fi
;;
status)
echo "Status of $NAME: "
check_status -v
exit "$?"
;;
*)
echo "Usage: $0 (start|stop|restart|force-reload|status)"
exit 1
esac
exit 0
PK +#Y[k(1 1 haltnu W+A #! /bin/sh
### BEGIN INIT INFO
# Provides: halt
# Required-Start:
# Required-Stop:
# Default-Start:
# Default-Stop: 0
# Short-Description: Execute the halt command.
# Description:
### END INIT INFO
NETDOWN=yes
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/default/halt ] && . /etc/default/halt
. /lib/lsb/init-functions
do_stop () {
if [ "$INIT_HALT" = "" ]
then
case "$HALT" in
[Pp]*)
INIT_HALT=POWEROFF
;;
[Hh]*)
INIT_HALT=HALT
;;
*)
INIT_HALT=POWEROFF
;;
esac
fi
# See if we need to cut the power.
if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
then
/etc/init.d/ups-monitor poweroff
fi
# Don't shut down drives if we're using RAID.
hddown="-h"
if grep -qs '^md.*active' /proc/mdstat
then
hddown=""
fi
# If INIT_HALT=HALT don't poweroff.
poweroff="-p"
if [ "$INIT_HALT" = "HALT" ]
then
poweroff=""
fi
# Make it possible to not shut down network interfaces,
# needed to use wake-on-lan
netdown="-i"
if [ "$NETDOWN" = "no" ]; then
netdown=""
fi
log_action_msg "Will now halt"
halt -d -f $netdown $poweroff $hddown
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:
PK +#Y[1M! M! clamav-freshclamnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: clamav-freshclam
# Required-Start: $remote_fs $syslog
# Should-Start: clamav-daemon
# Required-Stop: $remote_fs $syslog
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: ClamAV virus database updater
# Description: Clam AntiVirus virus database updater
### END INIT INFO
DAEMON=/usr/bin/freshclam
NAME=freshclam
DESC="ClamAV virus database updater"
[ -x $DAEMON ] || exit 0
CLAMAV_CONF_FILE=/etc/clamav/clamd.conf
FRESHCLAM_CONF_FILE=/etc/clamav/freshclam.conf
PIDFILE=/var/run/clamav/freshclam.pid
[ -f /var/lib/clamav/interface ] && INTERFACE=`cat /var/lib/clamav/interface`
status_of_proc () {
local pidfile daemon name status
pidfile=
OPTIND=1
while getopts p: opt ; do
case "$opt" in
p) pidfile="$OPTARG";;
esac
done
shift $(($OPTIND - 1))
if [ -n "$pidfile" ]; then
pidfile="-p $pidfile"
fi
daemon="$1"
name="$2"
status="0"
pidofproc $pidfile $daemon >/dev/null || status="$?"
if [ "$status" = 0 ]; then
log_success_msg "$name is running"
return 0
else
log_failure_msg "$name is not running"
return $status
fi
}
to_lower()
{
word="$1"
lcword=$(echo "$word" | tr A-Z a-z)
echo "$lcword"
}
is_true()
{
var="$1"
lcvar=$(to_lower "$var")
[ 'true' = "$lcvar" ] || [ 'yes' = "$lcvar" ] || [ 1 = "$lcvar" ]
return $?
}
is_false()
{
var="$1"
lcvar=$(to_lower "$var")
[ 'false' = "$lcvar" ] || [ 'no' = "$lcvar" ] || [ 0 = "$lcvar" ]
return $?
}
ucf_cleanup()
{
# This only does something if I've fucked up before
# Not entirely impossible :(
configfile=$1
if [ `grep "$configfile" /var/lib/ucf/hashfile | wc -l` -gt 1 ]; then
grep -v "$configfile" /var/lib/ucf/hashfile > /var/lib/ucf/hashfile.tmp
grep "$configfile" /var/lib/ucf/hashfile | tail -n 1 >> /var/lib/ucf/hashfile.tmp
mv /var/lib/ucf/hashfile.tmp /var/lib/ucf/hashfile
fi
}
add_to_ucf()
{
configfile=$1
ucffile=$2
if ! grep -q "$configfile" /var/lib/ucf/hashfile; then
md5sum $configfile >> /var/lib/ucf/hashfile
cp $configfile $ucffile
fi
}
ucf_upgrade_check()
{
configfile=$1
sourcefile=$2
ucffile=$3
if [ -f "$configfile" ]; then
add_to_ucf $configfile $ucffile
ucf --three-way --debconf-ok "$sourcefile" "$configfile"
else
[ -d /var/lib/ucf/cache ] || mkdir -p /var/lib/ucf/cache
cp $sourcefile $configfile
add_to_ucf $configfile $ucffile
fi
}
slurp_config()
{
CLAMAVCONF="$1"
if [ -e "$CLAMAVCONF" ]; then
for variable in `egrep -v '^[[:space:]]*(#|$)' "$CLAMAVCONF" | awk '{print $1}'`; do
case "$variable" in
DatabaseMirror)
if [ -z "$DatabaseMirror" ]; then
for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$value $i"
done
else
continue
fi
;;
DatabaseCustomURL)
if [ -z "$DatabaseCustomURL" ]; then
for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$value $i"
done
else
continue
fi
;;
IncludePUA)
if [ -z "$IncludePUA" ]; then
for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$i $value"
done
else
continue
fi
;;
ExcludePUA)
if [ -z "$ExcludePUA" ]; then
for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$i $value"
done
else
continue
fi
;;
ExtraDatabase)
if [ -z "$ExtraDatabase" ]; then
for i in `grep ^$variable $CLAMAVCONF | awk '{print $2}'`; do
value="$value $i"
done
else
continue
fi
;;
VirusEvent|OnUpdateExecute|OnErrorExecute|RejectMsg)
value=`grep ^$variable $CLAMAVCONF | head -n1 | sed -e s/$variable\ //`
;;
*)
value=`grep "^$variable[[:space:]]" $CLAMAVCONF | head -n1 | awk '{print $2}'`
;;
esac
if [ -z "$value" ]; then
export "$variable"="true"
elif [ "$value" != "$variable" ]; then
export "$variable"="$value"
else
export "$variable"="true"
fi
unset value
done
fi
}
make_dir()
{
DIR=$1
if [ -d "$DIR" ]; then
return 0;
fi
[ -n "$User" ] || User=clamav
mkdir -p -m 0755 "$DIR"
chown "$User" "$DIR"
[ -x /sbin/restorecon ] && /sbin/restorecon "$DIR"
}
# Debconf Functions
isdigit ()
{
case $1 in
[[:digit:]]*)
ISDIGIT=1
;;
*)
ISDIGIT=0
;;
esac
}
inputdigit ()
{
ISDIGIT=0
while [ "$ISDIGIT" = '0' ]; do
db_input "$1" "$2" || true
if ! db_go; then
return 30
fi
db_get $2 || true
isdigit $RET
if [ "$ISDIGIT" = '0' ]; then
db_input critical clamav-base/numinfo || true
db_go
fi
done
return 0
}
StateGeneric()
{
PRIO=$1
QUESTION=$2
NEXT=$3
LAST=$4
db_input $PRIO $QUESTION || true
if db_go; then
STATE=$NEXT
else
STATE=$LAST
fi
}
StateGenericDigit()
{
PRIO=$1
QUESTION=$2
NEXT=$3
LAST=$4
inputdigit $PRIO $QUESTION || true
if db_go; then
STATE=$NEXT
else
STATE=$LAST
fi
}
. /lib/lsb/init-functions
slurp_config "$FRESHCLAM_CONF_FILE"
[ -n "$PidFile" ] && PIDFILE="$PidFile"
[ -n "$DataBaseDirectory" ] || DataBaseDirectory=/var/run/clamav
make_dir "$DataBaseDirectory"
make_dir $(dirname "$PidFile")
if [ -f "$PIDFILE" ]; then
PID=`pidofproc -p $PIDFILE $DAEMON`
RUNNING=$?
else
PID=`pidofproc $DAEMON`
RUNNING=$?
fi
handle_iface()
{
OPTIND=1
if [ "$1" = "stop" ] && [ "$RUNNING" != 0 ]; then
return 1
elif [ "$1" = "start" ] && [ "$RUNNING" = 0 ]; then
return 1
else
return 0
fi
IS_UP=0
MATCH=0
for inet in $INTERFACE; do
route | grep -q "$inet" && IS_UP=`expr "$IS_UP" + 1`
[ "$inet" = "$IFACE" ] && MATCH=1
done
if [ -n "$INTERFACE" ]; then # Want if-up.d handling
if [ -n "$IFACE" ]; then # Called by if-up.d - for us
if [ "$MATCH" = '1' ]; then # IFACE is ours
if [ "$IS_UP" = '1' ]; then # and is only one up
return 0
else # Either not up, or others are up
return 1
fi
else # IFACE is not ours
return 1
fi
else # Not called by if-up.d && $1='(stop|start)'
return 1
fi
else # No if-up.d handling - just return
return 0
fi
}
handle_iface $1 || exit 0
[ -z "$UpdateLogFile" ] && UpdateLogFile=/var/log/clamav/freshclam.log
[ -z "$DatabaseDirectory" ] && DatabaseDirectory=/var/lib/clamav/
[ -n "$DatabaseOwner" ] || DatabaseOwner=clamav
case "$1" in
no-daemon)
su "$DatabaseOwner" -p -s /bin/sh -c "freshclam -l $UpdateLogFile --datadir $DatabaseDirectory"
;;
start)
OPTIND=1
log_daemon_msg "Starting $DESC" "$NAME"
# If user wants it run from cron, we only accept no-daemon and stop
if [ -f /etc/cron.d/clamav-freshclam ]; then
log_warning_msg "Not starting $NAME - cron option selected"
log_warning_msg "Run the init script with the 'no-daemon' option"
log_end_msg 255
exit 0
fi
start-stop-daemon --start -o -c "$DatabaseOwner" --exec $DAEMON -- -d --quiet
log_end_msg $?
;;
stop)
OPTIND=1
log_daemon_msg "Stopping $DESC" "$NAME"
if [ -n "$PID" ]; then
kill -15 -"$PID"
ret=$?
sleep 1
if kill -0 "$PID" 2>/dev/null; then
ret=$?
log_progress_msg "Waiting . "
cnt=0
while kill -0 "$PID" 2>/dev/null; do
ret=$?
cnt=`expr "$cnt" + 1`
if [ "$cnt" -gt 15 ]; then
kill -9 "$PID"
ret=$?
break
fi
sleep 2
log_progress_msg ". "
done
fi
else
killproc -p $PIDFILE $DAEMON
ret=$?
fi
log_end_msg $ret
;;
restart|force-reload)
$0 stop
$0 start
;;
reload-log)
OPTIND=1
log_daemon_msg "Reloading $DESC" "$NAME"
if [ "$RUNNING" = 0 ] && [ -n "$PID" ]; then
kill -HUP $PID
fi
log_end_msg $?
;;
skip)
;;
status)
status_of_proc "$DAEMON" "$NAME"
exit $?
;;
*)
log_failure_msg "Usage: $0 {no-daemon|start|stop|restart|force-reload|reload-log|skip|status}" >&2
exit 1
;;
esac
exit 0
PK +#Y[wB console-screen.shnu W+A #!/bin/sh
### BEGIN INIT INFO
# Provides: console-screen
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Description: Set console screen modes and fonts
# Short-Description: Prepare console
### END INIT INFO
# Don't set 'set -e' for production use. -- amck, 2010-01-11
# set -e
#
# This is the boot script for the `console-tools' package.
#
# It loads parameters from /etc/console-tools/config, maybe loads
# default screen-font, screen font-map, and application charset-map,
# and maybe start "vcstime"
#
# (c) 1997 Yann Dirson
if [ -r /etc/console-tools/config ] ; then
. /etc/console-tools/config
fi
if [ -d /etc/console-tools/config.d ]; then
for i in `run-parts --list /etc/console-tools/config.d `; do
. $i
done
fi
. /lib/lsb/init-functions
PATH=/sbin:/bin:/usr/sbin:/usr/bin
SETFONT="/usr/bin/consolechars"
SETFONT_OPT=""
CHARSET="/usr/bin/charset"
VCSTIME="/usr/sbin/vcstime"
# Different device name for 2.6 kernels and devfs
if [ `uname -r | cut -f 2 -d .` = 6 ] && [ -e /dev/.devfsd ]; then
VCSTIME_OPT="-2 /dev/vcsa0"
else
VCSTIME_OPT=""
fi
# set DEVICE_PREFIX depending on devfs/udev
if [ -d /dev/vc ]; then
DEVICE_PREFIX="/dev/vc/"
else
DEVICE_PREFIX="/dev/tty"
fi
ENV_FILE=''
[ -r /etc/environment ] && ENV_FILE="/etc/environment"
[ -r /etc/default/locale ] && ENV_FILE="/etc/default/locale"
[ "$ENV_FILE" ] && CHARMAP=$(set -a && . "$ENV_FILE" && locale charmap)
if test "$CHARMAP" = "UTF-8" ; then
UNICODE_MODE=yes
fi
unicode_start_stop ()
{
vc=$1
if [ -n "$UNICODE_MODE" -a -z "`eval echo \\$CONSOLE_MAP_vc$vc`" ]; then
action=unicode_start
else
action=unicode_stop
fi
if [ "${CONSOLE_FONT}" ]; then
$action "${CONSOLE_FONT}" < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
else
$action < ${DEVICE_PREFIX}$vc > ${DEVICE_PREFIX}$vc 2> /dev/null || true
fi
}
reset_vga_palette ()
{
if [ -f /proc/fb ]; then
# They have a framebuffer device.
# That means we have work to do...
echo -n "]R"
fi
}
setup_fonts ()
{
# be sure the main program is installed
[ -x "${SETFONT}" ] || return 0
VT="no"
# If we can't access the console, quit
CONSOLE_TYPE=`fgconsole 2>/dev/null` || return 0
if [ ! $CONSOLE_TYPE = "serial" ] ; then
if [ "x" != "x`readlink /proc/self/fd/0 | grep -e /dev/vc \
-e '/dev/tty[^p]' -e /dev/console`" ] ; then
VT="yes"
reset_vga_palette
fi
fi
[ $VT = "no" ] && return 0
# start vcstime
if [ "${DO_VCSTIME}" = "yes" -a -x ${VCSTIME} ] ; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console"
${VCSTIME} ${VCSTIME_OPT} &
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
# Default to Unicode mode for new VTs?
if [ -f /sys/module/vt/parameters/default_utf8 ]; then
if [ -n "$UNICODE_MODE" ]; then
echo 1
else
echo 0
fi > /sys/module/vt/parameters/default_utf8
fi
# Try to be cleverer and run for all consoles, but this is run
# _before_ getty and so only one console running. So,
# Set for the first 6 VCs (as they are allocated in /etc/inittab)
NUM_CONSOLES=`fgconsole --next-available`
NUM_CONSOLES=$(($NUM_CONSOLES - 1))
[ ${NUM_CONSOLES} -eq 1 ] && NUM_CONSOLES=6
# Global default font+sfm
if [ "${SCREEN_FONT}" ]
then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font"
SCREEN_FONT="-f ${SCREEN_FONT}"
# maybe use an external SFM
[ "${SCREEN_FONT_MAP}" ] && SCREEN_FONT_MAP="-u ${SCREEN_FONT_MAP}"
i=1
while [ $i -le $NUM_CONSOLES ]
do
unicode_start_stop $i
if ! ${SETFONT} --tty=${DEVICE_PREFIX}$i ${SETFONT_OPT} ${SCREEN_FONT} ${SCREEN_FONT_MAP} ; then
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
break
elif [ "$i" -eq "$NUM_CONSOLES" ]; then
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
i=$(($i + 1))
done
fi
# Per-VC font+sfm
VCS="`set | grep '^SCREEN_FONT_vc[0-9]*=' | sed -e 's/^SCREEN_FONT_vc//' -e 's/=.*//'`"
if [ "${VCS}" ]
then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC fonts"
for vc in ${VCS}
do
# extract FONTNAME info from variable setting
eval font=\$SCREEN_FONT_vc$vc
# eventually find an associated SFM
eval sfm=\${SCREEN_FONT_MAP_vc${vc}}
[ "$sfm" ] && sfm="-u $sfm"
${SETFONT} --tty=${DEVICE_PREFIX}$vc ${SETFONT_OPT} -f $font $sfm
done
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
}
setup_keymaps() {
# Global ACM
[ "${APP_CHARSET_MAP}" ] && ${CHARSET} G0 ${APP_CHARSET_MAP}
# Per-VC ACMs
VCS="`set | grep '^APP_CHARSET_MAP_vc[0-9]*=' | sed -e 's/^APP_CHARSET_MAP_vc//' -e 's/=.*//'`"
if [ "${VCS}" ]
then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACMs"
for vc in ${VCS}
do
# extract FONTNAME info from variable setting
eval acm=\$APP_CHARSET_MAP_vc$vc
${CHARSET} --tty="${DEVICE_PREFIX}$vc" G0 "$acm"
done
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
}
setup_screensaver() {
# screensaver stuff
setterm_args=""
if [ "$BLANK_TIME" ]; then
setterm_args="$setterm_args -blank $BLANK_TIME"
fi
if [ "$BLANK_DPMS" ]; then
setterm_args="$setterm_args -powersave $BLANK_DPMS"
fi
if [ "$POWERDOWN_TIME" ]; then
setterm_args="$setterm_args -powerdown $POWERDOWN_TIME"
fi
if [ "$setterm_args" ]; then
setterm $setterm_args
fi
}
setup_keyboard() {
# Keyboard rate and delay
KBDRATE_ARGS=""
if [ -n "$KEYBOARD_RATE" ]; then
KBDRATE_ARGS="-r $KEYBOARD_RATE"
fi
if [ -n "$KEYBOARD_DELAY" ]; then
KBDRATE_ARGS="$KBDRATE_ARGS -d $KEYBOARD_DELAY"
fi
if [ -n "$KBDRATE_ARGS" ]; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting keyboard rate and delay"
kbdrate -s $KBDRATE_ARGS
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
fi
# Inform gpm if present, of potential changes.
if [ -f /var/run/gpm.pid ]; then
kill -WINCH `cat /var/run/gpm.pid` 2> /dev/null
fi
# Allow user to remap keys on the console
if [ -r /etc/console-tools/remap ]
then
dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/console-tools/remap | loadkeys --quiet
fi
# Set LEDS here
if [ "$LEDS" != "" ]
then
i=1
while [ $i -le $NUM_CONSOLES ]
do
setleds -D $LEDS < $DEVICE_PREFIX$i
i=$(($i + 1))
done
fi
}
case "$1" in
start|reload|restart|force-reload|*)
# Changing the fonts make usplash exit. Avoid this.
if pidof usplash ; then
log_action_msg "Setting console screen modes"
setup_keymaps
setup_screensaver
setup_keyboard
else
log_action_msg "Setting console screen modes and fonts"
setup_fonts
setup_keymaps
setup_screensaver
setup_keyboard
fi
;;
stop)
;;
esac
PK +#Y[/