Add some stuff

This commit is contained in:
Diogo Cordeiro
2020-09-16 16:11:26 +01:00
parent 88dd2cf9f1
commit 2c67b5490e
1376 changed files with 68542 additions and 0 deletions

View File

@@ -0,0 +1,156 @@
#!/bin/sh
# ----------------------------------------------------------------------
# Copyright (c) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
# NOVELL (All rights reserved)
# Copyright (c) 2008, 2009 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, contact Novell, Inc.
# ----------------------------------------------------------------------
# Authors:
# Steve Beattie <steve.beattie@canonical.com>
# Kees Cook <kees@ubuntu.com>
#
# /etc/init.d/apparmor
#
# Note: "Required-Start: $local_fs" implies that the cache may not be available
# yet when /var is on a remote filesystem. The worst consequence this should
# have is slowing down the boot.
#
### BEGIN INIT INFO
# Provides: apparmor
# Required-Start: $local_fs
# Required-Stop: umountfs
# Default-Start: S
# Default-Stop:
# Short-Description: AppArmor initialization
# Description: AppArmor init script. This script loads all AppArmor profiles.
### END INIT INFO
APPARMOR_FUNCTIONS=/lib/apparmor/rc.apparmor.functions
# Functions needed by rc.apparmor.functions
. /lib/lsb/init-functions
aa_action() {
STRING=$1
shift
$*
rc=$?
if [ $rc -eq 0 ] ; then
aa_log_success_msg $"$STRING "
else
aa_log_failure_msg $"$STRING "
fi
return $rc
}
aa_log_action_start() {
log_action_begin_msg $@
}
aa_log_action_end() {
log_action_end_msg $@
}
aa_log_success_msg() {
log_success_msg $@
}
aa_log_warning_msg() {
log_warning_msg $@
}
aa_log_failure_msg() {
log_failure_msg $@
}
aa_log_skipped_msg() {
if [ -n "$1" ]; then
log_warning_msg "${1}: Skipped."
fi
}
aa_log_daemon_msg() {
log_daemon_msg $@
}
aa_log_end_msg() {
log_end_msg $@
}
# Source AppArmor function library
if [ -f "${APPARMOR_FUNCTIONS}" ]; then
. ${APPARMOR_FUNCTIONS}
else
aa_log_failure_msg "Unable to find AppArmor initscript functions"
exit 1
fi
usage() {
echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"
}
test -x ${PARSER} || exit 0 # by debian policy
# LSM is built-in, so it is either there or not enabled for this boot
test -d /sys/module/apparmor || exit 0
# do not perform start/stop/reload actions when running from liveCD
test -d /rofs/etc/apparmor.d && exit 0
rc=255
case "$1" in
start)
if [ -x /usr/bin/systemd-detect-virt ] && \
systemd-detect-virt --quiet --container && \
! is_container_with_internal_policy; then
aa_log_daemon_msg "Not starting AppArmor in container"
aa_log_end_msg 0
exit 0
fi
apparmor_start
rc=$?
;;
restart|reload|force-reload)
if [ -x /usr/bin/systemd-detect-virt ] && \
systemd-detect-virt --quiet --container && \
! is_container_with_internal_policy; then
aa_log_daemon_msg "Not starting AppArmor in container"
aa_log_end_msg 0
exit 0
fi
apparmor_restart
rc=$?
;;
stop)
aa_log_daemon_msg "Leaving AppArmor profiles loaded"
cat >&2 <<EOM
No profiles have been unloaded.
Unloading profiles will leave already running processes permanently
unconfined, which can lead to unexpected situations.
To set a process to complain mode, use the command line tool
'aa-complain'. To really tear down all profiles, run 'aa-teardown'."
EOM
;;
status)
apparmor_status
rc=$?
;;
*)
usage
rc=1
;;
esac
exit $rc

View File

@@ -0,0 +1,122 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: apport
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: automatic crash report generation
### END INIT INFO
DESC="automatic crash report generation"
NAME=apport
AGENT=/usr/share/apport/apport
SCRIPTNAME=/etc/init.d/$NAME
# Exit if the package is not installed
[ -x "$AGENT" ] || exit 0
# read default file
enabled=1
[ -e /etc/default/$NAME ] && . /etc/default/$NAME || true
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /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
[ -e /var/crash ] || mkdir -p /var/crash
chmod 1777 /var/crash
# check for kernel crash dump, convert it to apport report
if [ -e /var/crash/vmcore ] || [ -n "`ls /var/crash | egrep ^[0-9]{12}$`" ];then
/usr/share/apport/kernel_crashdump || true
fi
# check for incomplete suspend/resume or hibernate
if [ -e /var/lib/pm-utils/status ]; then
/usr/share/apport/apportcheckresume || true
rm -f /var/lib/pm-utils/status
rm -f /var/lib/pm-utils/resume-hang.log
fi
# Old compatibility mode, switch later to second one
if true; then
echo "|$AGENT %p %s %c %d %P %E" > /proc/sys/kernel/core_pattern
else
echo "|$AGENT -p%p -s%s -c%c -d%d -P%P -E%E" > /proc/sys/kernel/core_pattern
fi
echo 2 > /proc/sys/fs/suid_dumpable
}
#
# 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
echo 0 > /proc/sys/fs/suid_dumpable
# Check for a hung resume. If we find one try and grab everything
# we can to aid in its discovery.
if [ -e /var/lib/pm-utils/status ]; then
ps -wwef >/var/lib/pm-utils/resume-hang.log
fi
if [ "`dd if=/proc/sys/kernel/core_pattern count=1 bs=1 2>/dev/null`" != "|" ]; then
return 1
else
echo "core" > /proc/sys/kernel/core_pattern
fi
}
case "$1" in
start)
# don't start in containers
grep -zqs '^container=' /proc/1/environ && exit 0
[ "$enabled" = "1" ] || [ "$force_start" = "1" ] || exit 0
[ "$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)
# don't stop in containers
grep -zqs '^container=' /proc/1/environ && exit 0
[ "$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
;;
restart|force-reload)
$0 stop || true
$0 start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@@ -0,0 +1,48 @@
#! /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 <rmurray@debian.org>
#
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

View File

@@ -0,0 +1,46 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: console-setup.sh
# Required-Start: $remote_fs
# Required-Stop:
# Should-Start: console-screen kbd
# Default-Start: 2 3 4 5
# Default-Stop:
# X-Interactive: true
# Short-Description: Set console font and keymap
### END INIT INFO
if [ -f /bin/setupcon ]; then
case "$1" in
stop|status)
# console-setup isn't a daemon
;;
start|force-reload|restart|reload)
if [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
else
log_action_begin_msg () {
echo -n "$@... "
}
log_action_end_msg () {
if [ "$1" -eq 0 ]; then
echo done.
else
echo failed.
fi
}
fi
log_action_begin_msg "Setting up console font and keymap"
if /lib/console-setup/console-setup.sh; then
log_action_end_msg 0
else
log_action_end_msg $?
fi
;;
*)
echo 'Usage: /etc/init.d/console-setup {start|reload|restart|force-reload|stop|status}'
exit 3
;;
esac
fi

View File

@@ -0,0 +1,92 @@
#!/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: $network $named slapd autofs ypbind nscd nslcd winbind sssd
# Should-Stop: $network $named slapd autofs ypbind nscd nslcd winbind sssd
# 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
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="cron daemon"
NAME=cron
DAEMON=/usr/sbin/cron
PIDFILE=/var/run/crond.pid
SCRIPTNAME=/etc/init.d/"$NAME"
test -f $DAEMON || exit 0
. /lib/lsb/init-functions
[ -r /etc/default/cron ] && . /etc/default/cron
# 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
parse_environment
fi
case "$1" in
start) log_daemon_msg "Starting periodic command scheduler" "cron"
start_daemon -p $PIDFILE $DAEMON $EXTRA_OPTS
log_end_msg $?
;;
stop) log_daemon_msg "Stopping periodic command scheduler" "cron"
killproc -p $PIDFILE $DAEMON
RETVAL=$?
[ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
log_end_msg $RETVAL
;;
restart) log_daemon_msg "Restarting periodic command scheduler" "cron"
$0 stop
$0 start
;;
reload|force-reload) log_daemon_msg "Reloading configuration files for periodic command scheduler" "cron"
# cron reloads automatically
log_end_msg 0
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
;;
*) log_action_msg "Usage: /etc/init.d/cron {start|stop|status|restart|reload|force-reload}"
exit 2
;;
esac
exit 0

View File

@@ -0,0 +1,53 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: cryptdisks
# Required-Start: checkroot cryptdisks-early
# Required-Stop: umountroot cryptdisks-early
# Should-Start: udev mdadm-raid lvm2
# Should-Stop: udev mdadm-raid lvm2
# X-Start-Before: checkfs
# X-Stop-After: umountfs
# X-Interactive: true
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Setup remaining encrypted block devices.
# Description:
### END INIT INFO
set -e
if [ -r /lib/cryptsetup/cryptdisks-functions ]; then
. /lib/cryptsetup/cryptdisks-functions
else
exit 0
fi
INITSTATE="remaining"
DEFAULT_LOUD="yes"
case "$CRYPTDISKS_ENABLE" in
[Nn]*)
exit 0
;;
esac
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart|reload|force-reload)
do_stop
do_start
;;
force-start)
FORCE_START="yes"
do_start
;;
*)
echo "Usage: cryptdisks {start|stop|restart|reload|force-reload|force-start}"
exit 1
;;
esac

View File

@@ -0,0 +1,53 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: cryptdisks-early
# Required-Start: checkroot
# Required-Stop: umountroot
# Should-Start: udev mdadm-raid
# Should-Stop: udev mdadm-raid
# X-Start-Before: lvm2
# X-Stop-After: lvm2 umountfs
# X-Interactive: true
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Setup early encrypted block devices.
# Description:
### END INIT INFO
set -e
if [ -r /lib/cryptsetup/cryptdisks-functions ]; then
. /lib/cryptsetup/cryptdisks-functions
else
exit 0
fi
INITSTATE="early"
DEFAULT_LOUD=""
case "$CRYPTDISKS_ENABLE" in
[Nn]*)
exit 0
;;
esac
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart|reload|force-reload)
do_stop
do_start
;;
force-start)
FORCE_START="yes"
do_start
;;
*)
echo "Usage: cryptdisks-early {start|stop|restart|reload|force-reload|force-start}"
exit 1
;;
esac

View File

@@ -0,0 +1,129 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: dbus
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: D-Bus systemwide message bus
# Description: D-Bus is a simple interprocess messaging system, used
# for sending messages between applications.
### END INIT INFO
# -*- coding: utf-8 -*-
# Debian init.d script for D-BUS
# Copyright © 2003 Colin Walters <walters@debian.org>
# Copyright © 2005 Sjoerd Simons <sjoerd@debian.org>
set -e
DAEMON=/usr/bin/dbus-daemon
UUIDGEN=/usr/bin/dbus-uuidgen
UUIDGEN_OPTS=--ensure
NAME=dbus
DAEMONUSER=messagebus
PIDDIR=/var/run/dbus
PIDFILE=$PIDDIR/pid
DESC="system message bus"
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
# Source defaults file; edit that file to configure this script.
PARAMS=""
if [ -e /etc/default/dbus ]; then
. /etc/default/dbus
fi
create_machineid() {
# Create machine-id file
if [ -x $UUIDGEN ]; then
$UUIDGEN $UUIDGEN_OPTS
fi
}
start_it_up()
{
if [ ! -d $PIDDIR ]; then
mkdir -p $PIDDIR
chown $DAEMONUSER $PIDDIR
chgrp $DAEMONUSER $PIDDIR
fi
if ! mountpoint -q /proc/ ; then
log_failure_msg "Can't start $DESC - /proc is not mounted"
return
fi
if [ -e $PIDFILE ]; then
if $0 status > /dev/null ; then
log_success_msg "$DESC already started; not starting."
return
else
log_success_msg "Removing stale PID file $PIDFILE."
rm -f $PIDFILE
fi
fi
create_machineid
# Force libnss-systemd to avoid trying to communicate via D-Bus, which
# is never going to work well from within dbus-daemon. systemd
# special-cases this internally, but we might need to do the same when
# booting with sysvinit if libnss-systemd is still installed.
# (Workaround for #940971)
export SYSTEMD_NSS_BYPASS_BUS=1
log_daemon_msg "Starting $DESC" "$NAME"
start-stop-daemon --start --quiet --pidfile $PIDFILE \
--exec $DAEMON -- --system $PARAMS
log_end_msg $?
}
shut_it_down()
{
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --stop --retry 5 --quiet --oknodo --pidfile $PIDFILE \
--user $DAEMONUSER
# We no longer include these arguments so that start-stop-daemon
# can do its job even given that we may have been upgraded.
# We rely on the pidfile being sanely managed
# --exec $DAEMON -- --system $PARAMS
log_end_msg $?
rm -f $PIDFILE
}
reload_it()
{
create_machineid
log_action_begin_msg "Reloading $DESC config"
dbus-send --print-reply --system --type=method_call \
--dest=org.freedesktop.DBus \
/ org.freedesktop.DBus.ReloadConfig > /dev/null
# hopefully this is enough time for dbus to reload it's config file.
log_action_end_msg $?
}
case "$1" in
start)
start_it_up
;;
stop)
shut_it_down
;;
reload|force-reload)
reload_it
;;
restart)
shut_it_down
start_it_up
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/$NAME {start|stop|reload|restart|force-reload|status}" >&2
exit 2
;;
esac

View File

@@ -0,0 +1,120 @@
#!/bin/sh
# hwclock.sh Set and adjust the CMOS clock.
#
# Version: @(#)hwclock.sh 2.00 14-Dec-1998 miquels@cistron.nl
#
# Patches:
# 2000-01-30 Henrique M. Holschuh <hmh@rcm.org.br>
# - 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.
# 2012-02-16 Roger Leigh <rleigh@debian.org>
# - Use the UTC/LOCAL setting in /etc/adjtime rather than
# the UTC setting in /etc/default/rcS. Additionally
# source /etc/default/hwclock to permit configuration.
### BEGIN INIT INFO
# Provides: hwclock
# Required-Start: mountdevsubfs
# Required-Stop: mountdevsubfs
# Should-Stop: umountfs
# Default-Start: S
# X-Start-Before: checkroot
# Default-Stop: 0 6
# Short-Description: Sync hardware and system clock time.
### END INIT INFO
# These defaults are user-overridable in /etc/default/hwclock
BADYEAR=no
HWCLOCKACCESS=yes
HWCLOCKPARS=
HCTOSYS_DEVICE=rtc0
# We only want to use the system timezone or else we'll get
# potential inconsistency at startup.
unset TZ
hwclocksh()
{
[ ! -x /sbin/hwclock ] && return 0
[ ! -r /etc/default/rcS ] || . /etc/default/rcS
[ ! -r /etc/default/hwclock ] || . /etc/default/hwclock
. /lib/lsb/init-functions
verbose_log_action_msg() { [ "$VERBOSE" = no ] || log_action_msg "$@"; }
case "$BADYEAR" in
no|"") BADYEAR="" ;;
yes) BADYEAR="--badyear" ;;
*) log_action_msg "unknown BADYEAR setting: \"$BADYEAR\""; return 1 ;;
esac
case "$1" in
start)
# If the admin deleted the hwclock config, create a blank
# template with the defaults.
if [ -w /etc ] && [ ! -f /etc/adjtime ] && [ ! -e /etc/adjtime ]; then
printf "0.0 0 0.0\n0\nUTC\n" > /etc/adjtime
fi
if [ -d /run/udev ] || [ -d /dev/.udev ]; then
return 0
fi
if [ "$HWCLOCKACCESS" != no ]; then
log_action_msg "Setting the system clock"
# Just for reporting.
if sed '3!d' /etc/adjtime | grep -q '^UTC$'; then
UTC="--utc"
else
UTC=
fi
# 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 $HWCLOCKPARS $BADYEAR; 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 [ "$HWCLOCKACCESS" != no ]; then
log_action_msg "Saving the system clock"
if /sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --systohc $HWCLOCKPARS $BADYEAR; then
verbose_log_action_msg "Hardware Clock updated to `date`"
fi
else
verbose_log_action_msg "Not saving System Clock"
fi
;;
show)
if [ "$HWCLOCKACCESS" != no ]; then
/sbin/hwclock --rtc=/dev/$HCTOSYS_DEVICE --show $HWCLOCKPARS $BADYEAR
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 "$@"

View File

@@ -0,0 +1,98 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: irqbalance
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: daemon to balance interrupts for SMP systems
### END INIT INFO
# irqbalance init script
# August 2003
# Eric Dorland
# Based on spamassassin init script
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/irqbalance
NAME=irqbalance
SNAME=irqbalance
DESC="SMP IRQ Balancer"
PIDFILE="/run/$NAME.pid"
PNAME="irqbalance"
DOPTIONS=""
# Defaults - don't touch, edit /etc/default/
OPTIONS=""
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
test -f /etc/default/irqbalance && . /etc/default/irqbalance
# Beware: irqbalance tries to read and handle environment variables
# directly itself, but since start-stop-daemon clears the env
# we convert the variables to commandline arguments here...
# (Note: in the daemon an option is enabled even if its set to
# e.g. the empty string or 0 or whatever. To disable it should not
# be exported at all!)
# Warning: this will need to be maintained and updated on upgrades
# to new upstream release which might introduce new ones!
if [ ! -z ${IRQBALANCE_ONESHOT+x} ]; then
DOPTIONS="--oneshot"
fi
if [ ! -z ${IRQBALANCE_ARGS+x} ]; then
OPTIONS="$OPTIONS $IRQBALANCE_ARGS"
fi
case "$1" in
start)
log_begin_msg "Starting $DESC: $NAME"
pid=$( pidofproc -p $PIDFILE $DAEMON )
if [ -n "$pid" ] ; then
log_begin_msg ". Already running"
log_end_msg 0
exit 0
fi
mkdir -p /run/irqbalance
start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- --pid=$PIDFILE $OPTIONS $DOPTIONS
log_end_msg $?
;;
stop)
log_begin_msg "Stopping $DESC: $NAME"
start-stop-daemon --stop --quiet --oknodo --exec $DAEMON
rm -f $PIDFILE
log_end_msg $?
;;
restart|force-reload)
log_begin_msg "Restarting $DESC: $NAME"
start-stop-daemon --stop --retry 5 --quiet --oknodo --exec $DAEMON
rm -f $PIDFILE
mkdir -p /run/irqbalance
start-stop-daemon --start --quiet --oknodo --exec $DAEMON -- --pid=$PIDFILE $OPTIONS $DOPTIONS
log_end_msg $?
;;
status)
if [ -z "${IRQBALANCE_ONESHOT+x}" ]; then
status_of_proc $DAEMON $NAME
else
echo "Irqbalance setup to run in oneshot mode."
fi
;;
*)
N=/etc/init.d/$SNAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,48 @@
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: iscsid
# Required-Start: $network $local_fs
# Required-Stop: $network $local_fs sendsigs
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: iSCSI initiator daemon (iscsid)
# Description: The iSCSI initiator daemon takes care of
# monitoring iSCSI connections to targets. It is
# also the daemon providing the interface for the
# iscisadm tool to talk to when administering iSCSI
# connections.
### END INIT INFO
# Author: Christian Seiler <christian@iwakd.de>
DESC="iSCSI initiator daemon"
DAEMON=/sbin/iscsid
PIDFILE=/run/iscsid.pid
OMITDIR=/run/sendsigs.omit.d
do_start_prepare() {
if ! /lib/open-iscsi/startup-checks.sh ; then
exit 1
fi
}
do_start_cleanup() {
ln -sf $PIDFILE $OMITDIR
}
do_stop_override() {
# Don't stop iscsid if we're on initramfs or we had some
# excluded sessions. We could actually stop it, it's not
# required for the kernel to continue working with active
# sessions, but it also doesn't hurt to leave it running.
if [ -f /etc/iscsi/iscsi.initramfs ] ||
( [ -f /run/open-iscsi/shutdown-keep-sessions ] && [ -n "$(cat /run/open-iscsi/shutdown-keep-sessions)" ] )
then
return
fi
do_stop "$@"
}

View File

@@ -0,0 +1,50 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: keyboard-setup.sh
# Required-Start: mountkernfs
# Required-Stop:
# X-Start-Before: checkroot
# Default-Start: S
# Default-Stop:
# X-Interactive: true
# Short-Description: Set the console keyboard layout
# Description: Set the console keyboard as early as possible
# so during the file systems checks the administrator
# can interact. At this stage of the boot process
# only the ASCII symbols are supported.
### END INIT INFO
if [ -f /bin/setupcon ]; then
case "$1" in
stop|status)
# console-setup isn't a daemon
;;
start|force-reload|restart|reload)
if [ -f /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
else
log_action_begin_msg () {
echo -n "$@... "
}
log_action_end_msg () {
if [ "$1" -eq 0 ]; then
echo done.
else
echo failed.
fi
}
fi
log_action_begin_msg "Setting up keyboard layout"
if /lib/console-setup/keyboard-setup.sh; then
log_action_end_msg 0
else
log_action_end_msg $?
fi
;;
*)
echo 'Usage: /etc/init.d/keyboard-setup {start|reload|restart|force-reload|stop|status}'
exit 3
;;
esac
fi

View File

@@ -0,0 +1,92 @@
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: kmod
# Required-Start:
# Required-Stop:
# Should-Start: checkroot
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Load the modules listed in /etc/modules.
# Description: Load the modules listed in /etc/modules.
### END INIT INFO
# Silently exit if the kernel does not support modules.
[ -f /proc/modules ] || exit 0
[ -x /sbin/modprobe ] || exit 0
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions
PATH='/sbin:/bin'
case "$1" in
start)
;;
stop|restart|reload|force-reload)
log_warning_msg "Action '$1' is meaningless for this init script"
exit 0
;;
*)
log_success_msg "Usage: $0 start"
exit 1
esac
load_module() {
local module args
module="$1"
args="$2"
if [ "$VERBOSE" != no ]; then
log_action_msg "Loading kernel module $module"
modprobe $module $args || true
else
modprobe $module $args > /dev/null 2>&1 || true
fi
}
modules_files() {
local modules_load_dirs='/etc/modules-load.d /run/modules-load.d /usr/local/lib/modules-load.d /usr/lib/modules-load.d /lib/modules-load.d'
local processed=' '
local add_etc_modules=true
for dir in $modules_load_dirs; do
[ -d $dir ] || continue
for file in $(run-parts --list --regex='\.conf$' $dir 2> /dev/null || true); do
local base=${file##*/}
if echo -n "$processed" | grep -qF " $base "; then
continue
fi
if [ "$add_etc_modules" -a -L $file \
-a "$(readlink -f $file)" = /etc/modules ]; then
add_etc_modules=
fi
processed="$processed$base "
echo $file
done
done
if [ "$add_etc_modules" ]; then
echo /etc/modules
fi
}
if [ "$VERBOSE" = no ]; then
log_action_begin_msg 'Loading kernel modules'
fi
files=$(modules_files)
if [ "$files" ] ; then
grep -h '^[^#]' $files |
while read module args; do
[ "$module" ] || continue
load_module "$module" "$args"
done
fi
if [ "$VERBOSE" = no ]; then
log_action_end_msg 0
fi

View File

@@ -0,0 +1,33 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: lvm2 lvm
# Required-Start: mountdevsubfs
# Required-Stop:
# Should-Start: udev mdadm-raid cryptdisks-early multipath-tools-boot
# Should-Stop: umountroot mdadm-raid
# X-Start-Before: checkfs mountall
# X-Stop-After: umountfs
# Default-Start: S
# Default-Stop:
### END INIT INFO
SCRIPTNAME=/etc/init.d/lvm2
. /lib/lsb/init-functions
[ -x /sbin/vgchange ] || exit 0
case "$1" in
start)
log_action_begin_msg "Setting up LVM Volume Groups"
/sbin/lvm vgchange -aay --sysinit >/dev/null
log_action_end_msg "$?"
;;
stop|restart|force-reload|status)
;;
*)
echo "Usage: $SCRIPTNAME start" >&2
exit 3
;;
esac

View File

@@ -0,0 +1,22 @@
#!/bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: lvm2-lvmpolld
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: LVM2 poll daemon
### END INIT INFO
DESC="LVM2 poll daemon"
DAEMON=/sbin/lvmpolld
DAEMON_ARGS="-t 60"
PIDFILE=/run/lvmpolld.pid
do_start_prepare() {
mkdir -m 0700 -p /run/lvm
}

View File

@@ -0,0 +1,109 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: multipath-tools
# Required-Start: udev $local_fs $remote_fs $syslog
# Required-Stop: udev $local_fs $remote_fs $syslog
# Should-Start: iscsi
# Should-Stop: iscsi
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: multipath daemon
# Description:
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin/:/usr/bin
DAEMON=/sbin/multipathd
NAME=multipathd
DESC="multipath daemon"
syspath=/sys/block
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
if [ -f /etc/default/multipath-tools ] ; then
. /etc/default/multipath-tools
fi
teardown_slaves()
{
cd $1;
if [ -d "slaves" ]; then
for slave in slaves/*;
do
if [ "$slave" = "slaves/*" ]; then
read dev < $1/dev
tablename=$(dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p")
if ! [ -z $tablename ]; then
log_daemon_msg "Root is on a multipathed device, multipathd can not be stopped"
DONT_STOP_MPATHD=1
fi
else
local_slave=`readlink -f $slave`;
teardown_slaves $local_slave;
fi
done
else
read dev < $1/dev
tablename=$(dmsetup table --target multipath | sed -n "s/\(.*\): .* $dev .*/\1/p")
if ! [ -z $tablename ]; then
log_daemon_msg "Root is on a multipathed device, multipathd can not be stopped"
DONT_STOP_MPATHD=1
fi
fi
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
modprobe -a scsi_dh_alua scsi_dh_emc scsi_dh_rdac dm-multipath 2> /dev/null || true
start-stop-daemon --oknodo --start --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
log_end_msg $?
;;
stop)
DONT_STOP_MPATHD=0
root_dev=$(awk '{ if ($1 !~ /^[ \t]*#/ && $1 ~ /\// && $2 == "/") { print $1; }}' /etc/mtab)
if [ -n "$root_dev" ]; then
dm_num=$(dmsetup info -c --noheadings -o minor $root_dev 2>/dev/null)
else
dm_num=
fi
if [ $? -ne 0 -o -z "$dm_num" ]; then
# Looks like we couldn't find a device mapper root device
# But we shouldn't bail out here, otherwise the stop target and the
# upgrade processes will break. See DBUG #674733
:
else
root_dm_device="dm-$dm_num"
[ -d "$syspath/$root_dm_device" ] && teardown_slaves $syspath/$root_dm_device
fi
if [ x$DONT_STOP_MPATHD = x0 ]; then
log_daemon_msg "Stopping $DESC" "$NAME"
start-stop-daemon --oknodo --stop --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON
log_end_msg $?
fi
;;
status)
status_of_proc -p /var/run/$NAME.pid $DAEMON $NAME && exit 0 || exit $?
;;
reload|force-reload)
log_daemon_msg "Reloading $DESC" "$NAME"
start-stop-daemon --stop --signal 1 --quiet --pidfile /var/run/$NAME.pid --exec $DAEMON
log_end_msg $?
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
*)
N=/etc/init.d/multipath-tools
echo "Usage: $N {start|stop|status|restart|reload|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,116 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: open-iscsi iscsi
# Required-Start: $network $local_fs iscsid
# Required-Stop: $network $local_fs iscsid sendsigs
# Default-Start: S
# Default-Stop: 0 1 6
# Short-Description: Login to default iSCSI targets
# Description: Login to default iSCSI targets at boot and log out
# of all iSCSI targets at shutdown.
### END INIT INFO
PATH=/sbin:/bin
DAEMON=/sbin/iscsid
ADM=/sbin/iscsiadm
PIDFILE=/run/iscsid.pid
NAMEFILE=/etc/iscsi/initiatorname.iscsi
CONFIGFILE=/etc/iscsi/iscsid.conf
OMITDIR=/run/sendsigs.omit.d
[ -x "$DAEMON" ] || exit 0
. /lib/lsb/init-functions
# Include defaults if available
if [ -f /etc/default/open-iscsi ]; then
. /etc/default/open-iscsi
fi
if [ ! -d /sys/class/ ]; then
log_failure_msg "iSCSI requires a mounted sysfs, not started."
exit 0
fi
RETVAL=0
start() {
if ! [ -s $PIDFILE ] || ! kill -0 `sed -n 1p $PIDFILE` >/dev/null ; then
log_failure_msg "iSCSI initiator daemon not started: not logging in to default targets"
exit 1
fi
starttargets
# activate LVM, mount filesystems, etc.
/lib/open-iscsi/activate-storage.sh
}
starttargets() {
log_daemon_msg "Setting up iSCSI targets"
echo
$ADM -m node --loginall=automatic
log_end_msg 0
}
stoptargets() {
log_daemon_msg "Disconnecting iSCSI targets"
sync
# only logout if daemon is running, iscsiadm hangs otherwise
if [ -s $PIDFILE ] && kill -0 `sed -n 1p $PIDFILE` >/dev/null ; then
/lib/open-iscsi/logout-all.sh
fi
log_end_msg 0
}
stop() {
# Call umountiscsi.sh to unmount iSCSI devices first (always do
# that, regardless of whether root is on iSCSI, umountiscsi.sh
# will exclude it - and even if that shouldn't work, the mount
# point will be busy)
log_daemon_msg "Umounting iSCSI filesystems"
/lib/open-iscsi/umountiscsi.sh
umount_exit_status=$?
log_end_msg $umount_exit_status
if [ $umount_exit_status -ne 0 ]; then
log_failure_msg "Couldn't unmount all iSCSI devices. not logging out from any target."
exit 1
fi
stoptargets
}
restart() {
stop
start
}
restarttargets() {
stoptargets
starttargets
}
status() {
#XXX FIXME: what to do here?
#status iscsid
# list active sessions
echo Current active iSCSI sessions:
$ADM -m session
}
case "$1" in
start|starttargets|stop|stoptargets|restart|restarttargets|status)
$1
;;
force-reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit $RETVAL

View File

@@ -0,0 +1,89 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: plymouth
# Required-Start: udev $remote_fs $all
# Required-Stop: $remote_fs
# Should-Start: $x-display-manager
# Should-Stop: $x-display-manager
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: Stop plymouth during boot and start it on shutdown
### END INIT INFO
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
NAME="plymouth"
DESC="Boot splash manager"
test -x /sbin/plymouthd || exit 0
if [ -r "/etc/default/${NAME}" ]
then
. "/etc/default/${NAME}"
fi
. /lib/lsb/init-functions
set -e
SPLASH="true"
for ARGUMENT in $(cat /proc/cmdline)
do
case "${ARGUMENT}" in
splash*)
SPLASH="true"
;;
nosplash*|plymouth.enable=0)
SPLASH="false"
;;
esac
done
case "${1}" in
start)
case "${SPLASH}" in
true)
/bin/plymouth quit --retain-splash
;;
esac
;;
stop)
case "${SPLASH}" in
true)
if ! plymouth --ping
then
/sbin/plymouthd --mode=shutdown
fi
RUNLEVEL="$(/sbin/runlevel | cut -d " " -f 2)"
case "${RUNLEVEL}" in
0)
TEXT="Shutting down system..."
;;
6)
TEXT="Restarting system..."
;;
esac
/bin/plymouth message --text="${TEXT}"
/bin/plymouth --show-splash
;;
esac
;;
restart|force-reload)
;;
*)
echo "Usage: ${0} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,47 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: plymouth-log
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Inform plymouth that /var/log is writable
### END INIT INFO
PATH="/sbin:/bin:/usr/sbin:/usr/bin"
NAME="plymouth-log"
DESC="Boot splash manager (write log file)"
test -x /bin/plymouth || exit 0
if [ -r "/etc/default/${NAME}" ]
then
. "/etc/default/${NAME}"
fi
. /lib/lsb/init-functions
set -e
case "${1}" in
start)
if plymouth --ping
then
/bin/plymouth update-root-fs --read-write
fi
;;
stop|restart|force-reload)
;;
*)
echo "Usage: ${0} {start|stop|restart|force-reload}" >&2
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,34 @@
#! /bin/sh
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: procps
# Required-Start: mountkernfs $local_fs
# Required-Stop:
# Should-Start: udev module-init-tools
# X-Start-Before: $network
# 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
#
# written by Elrond <Elrond@Wunder-Nett.org>
DESC="Setting kernel variables"
DAEMON=/sbin/sysctl
PIDFILE=none
# Comment this out for sysctl to print every item changed
QUIET_SYSCTL="-q"
do_start_cmd() {
STATUS=0
$DAEMON $QUIET_SYSCTL --system || STATUS=$?
return $STATUS
}
do_stop() { return 0; }
do_status() { return 0; }

View File

@@ -0,0 +1,156 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rsyncd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Should-Start: $named autofs
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: fast remote file copy program daemon
# Description: rsync is a program that allows files to be copied to and
# from remote machines in much the same way as rcp.
# This provides rsyncd daemon functionality.
### END INIT INFO
set -e
# /etc/init.d/rsync: start and stop the rsync daemon
DAEMON=/usr/bin/rsync
RSYNC_ENABLE=false
RSYNC_OPTS=''
RSYNC_DEFAULTS_FILE=/etc/default/rsync
RSYNC_CONFIG_FILE=/etc/rsyncd.conf
RSYNC_PID_FILE=/var/run/rsync.pid
RSYNC_NICE_PARM=''
RSYNC_IONICE_PARM=''
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
if [ -s $RSYNC_DEFAULTS_FILE ]; then
. $RSYNC_DEFAULTS_FILE
case "x$RSYNC_ENABLE" in
xtrue|xfalse) ;;
xinetd) exit 0
;;
*) log_failure_msg "Value of RSYNC_ENABLE in $RSYNC_DEFAULTS_FILE must be either 'true' or 'false';"
log_failure_msg "not starting rsync daemon."
exit 1
;;
esac
case "x$RSYNC_NICE" in
x[0-9]|x1[0-9]) RSYNC_NICE_PARM="--nicelevel $RSYNC_NICE";;
x) ;;
*) log_warning_msg "Value of RSYNC_NICE in $RSYNC_DEFAULTS_FILE must be a value between 0 and 19 (inclusive);"
log_warning_msg "ignoring RSYNC_NICE now."
;;
esac
case "x$RSYNC_IONICE" in
x-c[123]*) RSYNC_IONICE_PARM="$RSYNC_IONICE";;
x) ;;
*) log_warning_msg "Value of RSYNC_IONICE in $RSYNC_DEFAULTS_FILE must be -c1, -c2 or -c3;"
log_warning_msg "ignoring RSYNC_IONICE now."
;;
esac
fi
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
rsync_start() {
if [ ! -s "$RSYNC_CONFIG_FILE" ]; then
log_failure_msg "missing or empty config file $RSYNC_CONFIG_FILE"
log_end_msg 1
exit 0
fi
# See ionice(1)
if [ -n "$RSYNC_IONICE_PARM" ] && [ -x /usr/bin/ionice ] &&
/usr/bin/ionice "$RSYNC_IONICE_PARM" true 2>/dev/null; then
/usr/bin/ionice "$RSYNC_IONICE_PARM" -p$$ > /dev/null 2>&1
fi
if start-stop-daemon --start --quiet --background \
--pidfile $RSYNC_PID_FILE --make-pidfile \
$RSYNC_NICE_PARM --exec $DAEMON \
-- --no-detach --daemon --config "$RSYNC_CONFIG_FILE" $RSYNC_OPTS
then
rc=0
sleep 1
if ! kill -0 $(cat $RSYNC_PID_FILE) >/dev/null 2>&1; then
log_failure_msg "rsync daemon failed to start"
rc=1
fi
else
rc=1
fi
if [ $rc -eq 0 ]; then
log_end_msg 0
else
log_end_msg 1
rm -f $RSYNC_PID_FILE
fi
} # rsync_start
case "$1" in
start)
if "$RSYNC_ENABLE"; then
log_daemon_msg "Starting rsync daemon" "rsync"
if [ -s $RSYNC_PID_FILE ] && kill -0 $(cat $RSYNC_PID_FILE) >/dev/null 2>&1; then
log_progress_msg "apparently already running"
log_end_msg 0
exit 0
fi
rsync_start
else
if [ -s "$RSYNC_CONFIG_FILE" ]; then
[ "$VERBOSE" != no ] && log_warning_msg "rsync daemon not enabled in $RSYNC_DEFAULTS_FILE, not starting..."
fi
fi
;;
stop)
log_daemon_msg "Stopping rsync daemon" "rsync"
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $RSYNC_PID_FILE
RETVAL="$?"
log_end_msg $RETVAL
if [ $RETVAL != 0 ]
then
exit 1
fi
rm -f $RSYNC_PID_FILE
;;
reload|force-reload)
log_warning_msg "Reloading rsync daemon: not needed, as the daemon"
log_warning_msg "re-reads the config file whenever a client connects."
;;
restart)
set +e
if $RSYNC_ENABLE; then
log_daemon_msg "Restarting rsync daemon" "rsync"
if [ -s $RSYNC_PID_FILE ] && kill -0 $(cat $RSYNC_PID_FILE) >/dev/null 2>&1; then
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile $RSYNC_PID_FILE
else
log_warning_msg "rsync daemon not running, attempting to start."
rm -f $RSYNC_PID_FILE
fi
rsync_start
else
if [ -s "$RSYNC_CONFIG_FILE" ]; then
[ "$VERBOSE" != no ] && log_warning_msg "rsync daemon not enabled in $RSYNC_DEFAULTS_FILE, not starting..."
fi
fi
;;
status)
status_of_proc -p $RSYNC_PID_FILE "$DAEMON" rsync
exit $? # notreached due to set -e
;;
*)
echo "Usage: /etc/init.d/rsync {start|stop|reload|force-reload|restart|status}"
exit 1
esac
exit 0

View File

@@ -0,0 +1,129 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: rsyslog
# Required-Start: $remote_fs $time
# Required-Stop: umountnfs $time
# X-Stop-After: sendsigs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: enhanced syslogd
# Description: Rsyslog is an enhanced multi-threaded syslogd.
# It is quite compatible to stock sysklogd and can be
# used as a drop-in replacement.
### END INIT INFO
#
# Author: Michael Biebl <biebl@debian.org>
#
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin
DESC="enhanced syslogd"
NAME=rsyslog
RSYSLOGD=rsyslogd
DAEMON=/usr/sbin/rsyslogd
PIDFILE=/run/rsyslogd.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
# Define LSB log_* functions.
. /lib/lsb/init-functions
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# other if daemon could not be started or a failure occured
start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- $RSYSLOGD_OPTIONS
}
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# other if daemon could not be stopped or a failure occurred
start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --exec $DAEMON
}
#
# Tell rsyslogd to close all open files
#
do_rotate() {
start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE --exec $DAEMON
}
create_xconsole() {
XCONSOLE=/dev/xconsole
if [ "$(uname -s)" != "Linux" ]; then
XCONSOLE=/run/xconsole
ln -sf $XCONSOLE /dev/xconsole
fi
if [ ! -e $XCONSOLE ]; then
mknod -m 640 $XCONSOLE p
chown root:adm $XCONSOLE
[ -x /sbin/restorecon ] && /sbin/restorecon $XCONSOLE
fi
}
sendsigs_omit() {
OMITDIR=/run/sendsigs.omit.d
mkdir -p $OMITDIR
ln -sf $PIDFILE $OMITDIR/rsyslog
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$RSYSLOGD"
create_xconsole
do_start
case "$?" in
0) sendsigs_omit
log_end_msg 0 ;;
1) log_progress_msg "already started"
log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
;;
stop)
log_daemon_msg "Stopping $DESC" "$RSYSLOGD"
do_stop
case "$?" in
0) log_end_msg 0 ;;
1) log_progress_msg "already stopped"
log_end_msg 0 ;;
*) log_end_msg 1 ;;
esac
;;
rotate)
log_daemon_msg "Closing open files" "$RSYSLOGD"
do_rotate
log_end_msg $?
;;
restart|force-reload)
$0 stop
$0 start
;;
try-restart)
$0 status >/dev/null 2>&1 && $0 restart
;;
status)
status_of_proc -p $PIDFILE $DAEMON $RSYSLOGD && exit 0 || exit $?
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|rotate|restart|force-reload|try-restart|status}" >&2
exit 3
;;
esac
:

View File

@@ -0,0 +1,49 @@
#!/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
# Description: Cleans up the screen session directory and fixes its
# permissions if needed.
### END INIT INFO
set -e
test -f /usr/bin/screen || exit 0
SCREENDIR=/run/screen
case "$1" in
start)
if test -L $SCREENDIR || ! test -d $SCREENDIR; then
rm -f $SCREENDIR
mkdir $SCREENDIR
chown root:utmp $SCREENDIR
[ -x /sbin/restorecon ] && /sbin/restorecon $SCREENDIR
fi
find $SCREENDIR -type p -delete
# 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 1777 $SCREENDIR
fi
;;
stop|restart|reload|force-reload)
;;
esac
exit 0

View File

@@ -0,0 +1,162 @@
#! /bin/sh
### BEGIN INIT INFO
# Provides: sshd
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: OpenBSD Secure Shell server
### END INIT INFO
set -e
# /etc/init.d/ssh: start and stop the OpenBSD "secure shell(tm)" daemon
test -x /usr/sbin/sshd || exit 0
( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2>/dev/null || exit 0
umask 022
if test -f /etc/default/ssh; then
. /etc/default/ssh
fi
. /lib/lsb/init-functions
if [ -n "$2" ]; then
SSHD_OPTS="$SSHD_OPTS $2"
fi
# Are we running from init?
run_by_init() {
([ "$previous" ] && [ "$runlevel" ]) || [ "$runlevel" = S ]
}
check_for_no_start() {
# forget it if we're trying to start, and /etc/ssh/sshd_not_to_be_run exists
if [ -e /etc/ssh/sshd_not_to_be_run ]; then
if [ "$1" = log_end_msg ]; then
log_end_msg 0 || true
fi
if ! run_by_init; then
log_action_msg "OpenBSD Secure Shell server not in use (/etc/ssh/sshd_not_to_be_run)" || true
fi
exit 0
fi
}
check_dev_null() {
if [ ! -c /dev/null ]; then
if [ "$1" = log_end_msg ]; then
log_end_msg 1 || true
fi
if ! run_by_init; then
log_action_msg "/dev/null is not a character device!" || true
fi
exit 1
fi
}
check_privsep_dir() {
# Create the PrivSep empty dir if necessary
if [ ! -d /run/sshd ]; then
mkdir /run/sshd
chmod 0755 /run/sshd
fi
}
check_config() {
if [ ! -e /etc/ssh/sshd_not_to_be_run ]; then
/usr/sbin/sshd $SSHD_OPTS -t || exit 1
fi
}
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
case "$1" in
start)
check_privsep_dir
check_for_no_start
check_dev_null
log_daemon_msg "Starting OpenBSD Secure Shell server" "sshd" || true
if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
stop)
log_daemon_msg "Stopping OpenBSD Secure Shell server" "sshd" || true
if start-stop-daemon --stop --quiet --oknodo --pidfile /run/sshd.pid --exec /usr/sbin/sshd; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
reload|force-reload)
check_for_no_start
check_config
log_daemon_msg "Reloading OpenBSD Secure Shell server's configuration" "sshd" || true
if start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /run/sshd.pid --exec /usr/sbin/sshd; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
restart)
check_privsep_dir
check_config
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /run/sshd.pid --exec /usr/sbin/sshd
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
try-restart)
check_privsep_dir
check_config
log_daemon_msg "Restarting OpenBSD Secure Shell server" "sshd" || true
RET=0
start-stop-daemon --stop --quiet --retry 30 --pidfile /run/sshd.pid --exec /usr/sbin/sshd || RET="$?"
case $RET in
0)
# old daemon stopped
check_for_no_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --chuid 0:0 --pidfile /run/sshd.pid --exec /usr/sbin/sshd -- $SSHD_OPTS; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
1)
# daemon not running
log_progress_msg "(not running)" || true
log_end_msg 0 || true
;;
*)
# failed to stop
log_progress_msg "(failed to stop)" || true
log_end_msg 1 || true
;;
esac
;;
status)
status_of_proc -p /run/sshd.pid /usr/sbin/sshd sshd && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/ssh {start|stop|reload|force-reload|restart|try-restart|status}" || true
exit 1
esac
exit 0

View File

@@ -0,0 +1,256 @@
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: udev
# Required-Start: mountkernfs
# Required-Stop: umountroot
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Start systemd-udevd, populate /dev and load drivers.
### END INIT INFO
PATH="/sbin:/bin"
NAME="systemd-udevd"
DAEMON="/lib/systemd/systemd-udevd"
DESC="hotplug events dispatcher"
PIDFILE="/run/udev.pid"
CTRLFILE="/run/udev/control"
OMITDIR="/run/sendsigs.omit.d"
# we need to unmount /dev/pts/ and remount it later over the devtmpfs
unmount_devpts() {
if mountpoint -q /dev/pts/; then
umount -n -l /dev/pts/
fi
if mountpoint -q /dev/shm/; then
umount -n -l /dev/shm/
fi
}
# mount a devtmpfs over /dev, if somebody did not already do it
mount_devtmpfs() {
if grep -E -q "^[^[:space:]]+ /dev devtmpfs" /proc/mounts; then
mount -n -o remount,nosuid,size=$tmpfs_size,mode=0755 -t devtmpfs devtmpfs /dev
return
fi
if ! mount -n -o nosuid,size=$tmpfs_size,mode=0755 -t devtmpfs devtmpfs /dev; then
log_failure_msg "udev requires devtmpfs support, not started"
log_end_msg 1
fi
return 0
}
create_dev_makedev() {
if [ -e /sbin/MAKEDEV ]; then
ln -sf /sbin/MAKEDEV /dev/MAKEDEV
else
ln -sf /bin/true /dev/MAKEDEV
fi
}
# shell version of /usr/bin/tty
my_tty() {
[ -x /bin/readlink ] || return 0
[ -e /proc/self/fd/0 ] || return 0
readlink --silent /proc/self/fd/0 || true
}
warn_if_interactive() {
if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then
return
fi
TTY=$(my_tty)
if [ -z "$TTY" -o "$TTY" = "/dev/console" -o "$TTY" = "/dev/null" ]; then
return
fi
printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n"
printf "has been run from an interactive shell.\n"
printf "It will probably not do what you expect, so this script will wait\n"
printf "60 seconds before continuing. Press ^C to stop it.\n"
printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n"
sleep 60
}
make_static_nodes() {
[ -e /lib/modules/$(uname -r)/modules.devname ] || return 0
[ -x /bin/kmod ] || return 0
/bin/kmod static-nodes --format=tmpfiles --output=/proc/self/fd/1 | \
while read type name mode uid gid age arg; do
[ -e $name ] && continue
case "$type" in
c|b|c!|b!) mknod -m $mode $name $type $(echo $arg | sed 's/:/ /') ;;
d|d!) mkdir $name ;;
*) echo "unparseable line ($type $name $mode $uid $gid $age $arg)" >&2 ;;
esac
if [ -x /sbin/restorecon ]; then
/sbin/restorecon $name
fi
done
}
##############################################################################
[ -x $DAEMON ] || exit 0
# defaults
tmpfs_size="10M"
if [ -e /etc/udev/udev.conf ]; then
. /etc/udev/udev.conf
fi
. /lib/lsb/init-functions
if [ ! -e /proc/filesystems ]; then
log_failure_msg "udev requires a mounted procfs, not started"
log_end_msg 1
fi
if ! grep -q '[[:space:]]devtmpfs$' /proc/filesystems; then
log_failure_msg "udev requires devtmpfs support, not started"
log_end_msg 1
fi
if [ ! -d /sys/class/ ]; then
log_failure_msg "udev requires a mounted sysfs, not started"
log_end_msg 1
fi
if [ ! -w /sys ]; then
log_warning_msg "udev does not support containers, not started"
exit 0
fi
if [ -d /sys/class/mem/null -a ! -L /sys/class/mem/null ] || \
[ -e /sys/block -a ! -e /sys/class/block ]; then
log_warning_msg "CONFIG_SYSFS_DEPRECATED must not be selected"
log_warning_msg "Booting will continue in 30 seconds but many things will be broken"
sleep 30
fi
# When modifying this script, do not forget that between the time that the
# new /dev has been mounted and udevadm trigger has been run there will be
# no /dev/null. This also means that you cannot use the "&" shell command.
case "$1" in
start)
if [ ! -e "/run/udev/" ]; then
warn_if_interactive
fi
if [ -w /sys/kernel/uevent_helper ]; then
echo > /sys/kernel/uevent_helper
fi
if ! mountpoint -q /dev/; then
unmount_devpts
mount_devtmpfs
[ -d /proc/1 ] || mount -n /proc
fi
make_static_nodes
# clean up parts of the database created by the initramfs udev
udevadm info --cleanup-db
# set the SELinux context for devices created in the initramfs
[ -x /sbin/restorecon ] && /sbin/restorecon -R /dev
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --start --name $NAME --user root --quiet \
--pidfile $PIDFILE --exec $DAEMON --background --make-pidfile \
--notify-await; then
# prevents udevd to be killed by sendsigs (see #791944)
mkdir -p $OMITDIR
ln -sf $PIDFILE $OMITDIR/$NAME
log_end_msg $?
else
log_warning_msg $?
log_warning_msg "Waiting 15 seconds and trying to continue anyway"
sleep 15
fi
log_action_begin_msg "Synthesizing the initial hotplug events (subsystems)"
if udevadm trigger --type=subsystems --action=add; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
log_action_begin_msg "Synthesizing the initial hotplug events (devices)"
if udevadm trigger --type=devices --action=add; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
create_dev_makedev
# wait for the systemd-udevd childs to finish
log_action_begin_msg "Waiting for /dev to be fully populated"
if udevadm settle; then
log_action_end_msg 0
else
log_action_end_msg 0 'timeout'
fi
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --stop --name $NAME --user root --quiet \
--pidfile $PIDFILE --remove-pidfile --oknodo --retry 5; then
# prevents cryptsetup/dmsetup hangs (see #791944)
rm -f $CTRLFILE
log_end_msg $?
else
log_end_msg $?
fi
;;
restart)
log_daemon_msg "Stopping $DESC" "$NAME"
if start-stop-daemon --stop --name $NAME --user root --quiet \
--pidfile $PIDFILE --remove-pidfile --oknodo --retry 5; then
# prevents cryptsetup/dmsetup hangs (see #791944)
rm -f $CTRLFILE
log_end_msg $?
else
log_end_msg $? || true
fi
log_daemon_msg "Starting $DESC" "$NAME"
if start-stop-daemon --start --name $NAME --user root --quiet \
--pidfile $PIDFILE --exec $DAEMON --background --make-pidfile \
--notify-await; then
# prevents udevd to be killed by sendsigs (see #791944)
mkdir -p $OMITDIR
ln -sf $PIDFILE $OMITDIR/$NAME
log_end_msg $?
else
log_end_msg $?
fi
;;
reload|force-reload)
udevadm control --reload-rules
;;
status)
status_of_proc $DAEMON $NAME && exit 0 || exit $?
;;
*)
echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload|status}" >&2
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,86 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: ufw
# Required-Start: $local_fs
# Required-Stop: $local_fs
# Default-Start: S
# Default-Stop: 1
# Short-Description: start firewall
# Description: Start ufw firewall
### END INIT INFO
set -e
PATH="/sbin:/bin"
[ -d /lib/ufw ] || exit 0
. /lib/lsb/init-functions
for s in "/lib/ufw/ufw-init-functions" "/etc/ufw/ufw.conf" "/etc/default/ufw" ; do
if [ -s "$s" ]; then
. "$s"
else
log_failure_msg "Could not find $s (aborting)"
exit 1
fi
done
error=0
case "$1" in
start)
if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
log_action_begin_msg "Starting firewall:" "ufw"
output=`ufw_start` || error="$?"
if [ "$error" = "0" ]; then
log_action_cont_msg "Setting kernel variables ($IPT_SYSCTL)"
fi
if [ ! -z "$output" ]; then
echo "$output" | while read line ; do
log_action_cont_msg "$line"
done
fi
else
log_action_begin_msg "Skip starting firewall:" "ufw (not enabled)"
fi
log_action_end_msg $error
exit $error
;;
stop)
if [ "$ENABLED" = "yes" ] || [ "$ENABLED" = "YES" ]; then
log_action_begin_msg "Stopping firewall:" "ufw"
output=`ufw_stop` || error="$?"
if [ ! -z "$output" ]; then
log_action_cont_msg "$output"
fi
else
log_action_begin_msg "Skip stopping firewall:" "ufw (not enabled)"
fi
log_action_end_msg $error
exit $error
;;
restart|force-reload)
log_action_begin_msg "Reloading firewall:" "ufw"
output=`ufw_reload` || error="$?"
if [ ! -z "$output" ]; then
log_action_cont_msg "$output"
fi
log_action_end_msg $error
exit $error
;;
status)
output=`ufw_status` || error="$?"
if [ ! -z "$output" ]; then
log_action_cont_msg "$output"
fi
log_action_end_msg $error
exit $error
;;
*)
echo "Usage: /etc/init.d/ufw {start|stop|restart|force-reload|status}"
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,51 @@
#! /bin/sh
#
### BEGIN INIT INFO
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Provides: unattended-upgrade-shutdown-check
# Default-Start: 2 3 4 5
# Default-Stop: 0 6
# Short-Description: Check if unattended upgrades are being applied
# Description: Check if unattended upgrades are being applied
# and wait for them to finish
### END INIT INFO
set -e
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
NAME="unattended-upgrades-shutdown"
DESC="unattended package upgrades shutdown"
SCRIPTNAME="/etc/init.d/$NAME"
SHUTDOWN_HELPER="/usr/share/unattended-upgrades/unattended-upgrade-shutdown"
if [ -x /usr/bin/python3 ]; then
PYTHON=python3
else
PYTHON=python
fi
# 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
. /lib/lsb/init-functions
case "$1" in
start|restart|force-reload|status)
# nothing, just to keep update-rc.d happy (see debian #630732)
;;
stop)
if [ -e $SHUTDOWN_HELPER ]; then
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Checking for running $DESC"
$PYTHON $SHUTDOWN_HELPER
[ "$VERBOSE" != "no" ] && log_action_end_msg $? "$NAME"
fi
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View File

@@ -0,0 +1,62 @@
#! /bin/sh -e
### BEGIN INIT INFO
# Provides: uuidd
# Required-Start: $time $local_fs $remote_fs
# Required-Stop: $time $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: uuidd daemon
# Description: Init script for the uuid generation daemon
### END INIT INFO
#
# Author: "Theodore Ts'o" <tytso@mit.edu>
#
set -e
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/sbin/uuidd
UUIDD_USER=uuidd
UUIDD_GROUP=uuidd
UUIDD_DIR=/run/uuidd
PIDFILE=$UUIDD_DIR/uuidd.pid
test -x $DAEMON || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting uuid generator" "uuidd"
if ! test -d $UUIDD_DIR; then
mkdir -p $UUIDD_DIR
chown -R $UUIDD_USER:$UUIDD_GROUP $UUIDD_DIR
fi
start_daemon -p $PIDFILE $DAEMON
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping uuid generator" "uuidd"
killproc -p $PIDFILE $DAEMON
log_end_msg $?
;;
status)
if pidofproc -p $PIDFILE $DAEMON >/dev/null 2>&1; then
echo "$DAEMON is running";
exit 0;
else
echo "$DAEMON is NOT running";
if test -f $PIDFILE; then exit 2; fi
exit 3;
fi
;;
force-reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: /etc/init.d/uuidd {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0