mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
Update Debian 6.0 example /etc/finit.conf and /etc/finit.d
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Executable
+65
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: keyboard-setup
|
||||
# Required-Start: mountkernfs
|
||||
# Required-Stop:
|
||||
# Should-Start: keymap udev
|
||||
# X-Start-Before: checkroot
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# X-Interactive: true
|
||||
# Short-Description: Set preliminary keymap
|
||||
# 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
|
||||
|
||||
set -e
|
||||
|
||||
# This script is not used by keyboard-configuration. It is used
|
||||
# jointly by console-setup and console-setup-mini
|
||||
|
||||
test -f /bin/setupcon || exit 0
|
||||
|
||||
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
|
||||
|
||||
case "$1" in
|
||||
stop)
|
||||
# keyboard-setup isn't a daemon
|
||||
;;
|
||||
start|force-reload|restart|reload)
|
||||
case `readlink /proc/self/fd/2` in
|
||||
/dev/tty[0-9]*|/dev/vc/[0-9]*|/dev/console)
|
||||
log_action_begin_msg "Setting preliminary keymap"
|
||||
if setupcon -k; then
|
||||
log_action_end_msg 0
|
||||
else
|
||||
log_action_end_msg $?
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo 'Usage: /etc/init.d/keyboard-setup {start|reload|restart|force-reload|stop}'
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
Executable
+81
@@ -0,0 +1,81 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: acpid
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# X-Start-Before: kdm gdm xdm hal
|
||||
# X-Stop-After: kdm gdm xdm hal
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop:
|
||||
# Short-Description: Start the Advanced Configuration and Power Interface daemon
|
||||
# Description: Provide a socket for X11, hald and others to multiplex
|
||||
# kernel ACPI events.
|
||||
### END INIT INFO
|
||||
|
||||
set -e
|
||||
|
||||
ACPID="/usr/sbin/acpid"
|
||||
DEFAULTS="/etc/default/acpid"
|
||||
|
||||
# Check for daemon presence
|
||||
[ -x "$ACPID" ] || exit 0
|
||||
|
||||
OPTIONS=""
|
||||
MODULES=""
|
||||
# Include acpid defaults if available
|
||||
[ -r "$DEFAULTS" ] && . "$DEFAULTS"
|
||||
|
||||
# Get lsb functions
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# As the name says. If the kernel supports modules, it'll try to load
|
||||
# the ones listed in "MODULES".
|
||||
load_modules() {
|
||||
[ -f /proc/modules ] || return 0
|
||||
if [ "$MODULES" = "all" ]; then
|
||||
MODULES="$(sed -rn 's#^(/lib/modules/[^/]+/)?kernel/(drivers|ubuntu)/acpi/([^/]+/)*(.*)\.ko:.*#\4#p' "/lib/modules/$(uname -r)/modules.dep")"
|
||||
fi
|
||||
|
||||
if [ -z "$MODULES" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
log_begin_msg "Loading ACPI kernel modules..."
|
||||
# work around a bug in initramfs which leaks this env var Launchpad #291619
|
||||
# and a bug in modprobe --all --quiet which doesn't load all modules and
|
||||
# exits with non-zero exit status Debian #504088
|
||||
unset MODPROBE_OPTIONS
|
||||
modprobe --all --use-blacklist $MODULES 2>/dev/null
|
||||
log_end_msg $?
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
load_modules || true
|
||||
log_begin_msg "Starting ACPI services..."
|
||||
start-stop-daemon --start --quiet --oknodo --exec "$ACPID" -- $OPTIONS
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_begin_msg "Stopping ACPI services..."
|
||||
start-stop-daemon --stop --quiet --oknodo --retry 2 --exec "$ACPID"
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_begin_msg "Reloading ACPI services..."
|
||||
start-stop-daemon --stop --signal 1 --exec "$ACPID"
|
||||
log_end_msg $?
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$ACPID" acpid
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: /etc/init.d/acpid {start|stop|restart|reload|force-reload|status}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
Executable
+259
@@ -0,0 +1,259 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: kbd
|
||||
# Required-Start: $remote_fs
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# X-Interactive: true
|
||||
# Description: Set console screen modes and fonts
|
||||
# Short-Description: Prepare console
|
||||
### END INIT INFO
|
||||
|
||||
# This is the boot script for the `kbd' package.
|
||||
# It loads parameters from /etc/kbd/config and maybe loads
|
||||
# default font and map.
|
||||
# (c) 1997 Yann Dirson
|
||||
|
||||
PKG=kbd
|
||||
if [ -r /etc/$PKG/config ]; then
|
||||
. /etc/$PKG/config
|
||||
fi
|
||||
|
||||
if [ -d /etc/$PKG/config.d ]; then
|
||||
for i in `run-parts --list /etc/$PKG/config.d `; do
|
||||
. $i
|
||||
done
|
||||
fi
|
||||
|
||||
# do some magic with the variables for compatibility with the config
|
||||
# file of console-tools
|
||||
for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed 's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
|
||||
do
|
||||
eval [ '"'\${SCREEN_FONT$vc}'"' ] && eval CONSOLE_FONT$vc=\${CONSOLE_FONT$vc:-\${SCREEN_FONT$vc}}
|
||||
eval [ '"'\${SCREEN_FONT_MAP$vc}'"' ] && eval FONT_MAP$vc=\${FONT_MAP$vc:-\${SCREEN_FONT_MAP$vc}}
|
||||
eval [ '"'\${APP_CHARSET_MAP$vc}'"' ] && eval CONSOLE_MAP$vc=\${CONSOLE_MAP$vc:-\${APP_CHARSET_MAP$vc}}
|
||||
done
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
SETFONT_OPT="-v"
|
||||
|
||||
if which setupcon >/dev/null
|
||||
then
|
||||
HAVE_SETUPCON=yes
|
||||
fi
|
||||
|
||||
# set DEVICE_PREFIX depending on devfs/udev
|
||||
if [ -d /dev/vc ]; then
|
||||
DEVICE_PREFIX="/dev/vc/"
|
||||
else
|
||||
DEVICE_PREFIX="/dev/tty"
|
||||
fi
|
||||
|
||||
# determine the system charmap
|
||||
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 [ "$CHARMAP" = "UTF-8" -a -z "$CONSOLE_MAP" ]
|
||||
then
|
||||
UNICODE_MODE=yes
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
setup ()
|
||||
{
|
||||
# be sure the main program is installed
|
||||
which setfont >/dev/null || return
|
||||
|
||||
VT="no"
|
||||
# If we can't access the console, quit
|
||||
CONSOLE_TYPE=`fgconsole 2>/dev/null` || return
|
||||
|
||||
if [ ! $CONSOLE_TYPE = "serial" ]; then
|
||||
readlink /proc/self/fd/0 | grep -q -e /dev/vc -e '/dev/tty[^p]' -e /dev/console
|
||||
if [ $? -eq 0 ]; then
|
||||
VT="yes"
|
||||
reset_vga_palette
|
||||
fi
|
||||
fi
|
||||
|
||||
[ $VT = "no" ] && return
|
||||
|
||||
# start vcstime
|
||||
if [ "${DO_VCSTIME}" = "yes" ] && which vcstime >/dev/null; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Starting clock on text console"
|
||||
vcstime &
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
if [ -d /etc/init ] && which initctl >/dev/null; then
|
||||
# Upstart
|
||||
LIST_CONSOLES=`cd /etc/init; find -name 'tty*.conf' -printf '%f ' | sed -e 's/[^0-9 ]//g'`
|
||||
else
|
||||
# traditional SysV init
|
||||
LIST_CONSOLES=`sed -e '/^ *#/d' /etc/inittab | grep -e '\<tty[0-9]*\>' | awk -F: '{printf "%s ", $1}'`
|
||||
fi
|
||||
|
||||
# Global default font+map
|
||||
if [ -z "${HAVE_SETUPCON}" -a "${CONSOLE_FONT}" ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up general console font"
|
||||
sfm="${FONT_MAP}" && [ "$sfm" ] && sfm="-u $sfm"
|
||||
acm="${CONSOLE_MAP}" && [ "$acm" ] && acm="-m $acm"
|
||||
|
||||
# Set for the first 6 VCs (as they are allocated in /etc/inittab)
|
||||
for vc in $LIST_CONSOLES
|
||||
do
|
||||
if ! ( unicode_start_stop $vc \
|
||||
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm ${CONSOLE_FONT} $acm )
|
||||
then
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$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
|
||||
|
||||
# Per-VC font+sfm
|
||||
PERVC_FONTS="`set | grep "^CONSOLE_FONT_vc[0-9]*=" | tr -d \' `"
|
||||
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_FONTS}" ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC fonts"
|
||||
for font in ${PERVC_FONTS}
|
||||
do
|
||||
# extract VC and FONTNAME info from variable setting
|
||||
vc=`echo $font | cut -b16- | cut -d= -f1`
|
||||
eval font=\$CONSOLE_FONT_vc$vc
|
||||
# eventually find an associated SFM
|
||||
eval sfm=\${FONT_MAP_vc${vc}}
|
||||
[ "$sfm" ] && sfm="-u $sfm"
|
||||
if ! ( unicode_start_stop $vc \
|
||||
&& setfont -C ${DEVICE_PREFIX}$vc ${SETFONT_OPT} $sfm $font )
|
||||
then
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
|
||||
# Per-VC ACMs
|
||||
PERVC_ACMS="`set | grep "^CONSOLE_MAP_vc[0-9]*=" | tr -d \' `"
|
||||
if [ -z "${HAVE_SETUPCON}" -a "${PERVC_ACMS}" ]; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_begin_msg "Setting up per-VC ACM's"
|
||||
for acm in ${PERVC_ACMS}
|
||||
do
|
||||
# extract VC and ACM_FONTNAME info from variable setting
|
||||
vc=`echo $acm | cut -b15- | cut -d= -f1`
|
||||
eval acm=\$CONSOLE_MAP_vc$vc
|
||||
if ! setfont -C "${DEVICE_PREFIX}$vc" ${SETFONT_OPT} -m "$acm"; then
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 1
|
||||
break
|
||||
fi
|
||||
done
|
||||
[ "$VERBOSE" != "no" ] && log_action_end_msg 0
|
||||
fi
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
# 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 -s WINCH `cat /var/run/gpm.pid` 2> /dev/null
|
||||
fi
|
||||
|
||||
# Allow user to remap keys on the console
|
||||
if [ -z "${HAVE_SETUPCON}" -a -r /etc/$PKG/remap ]; then
|
||||
dumpkeys < ${DEVICE_PREFIX}1 | sed -f /etc/$PKG/remap | loadkeys --quiet
|
||||
fi
|
||||
|
||||
# Set LEDS here
|
||||
if [ -n "$LEDS" ]; then
|
||||
for i in $LIST_CONSOLES
|
||||
do
|
||||
setleds -D $LEDS < $DEVICE_PREFIX$i
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start|reload|restart|force-reload)
|
||||
if [ -n "$HAVE_SETUPCON" ]
|
||||
then
|
||||
log_action_msg "Setting console screen modes"
|
||||
else
|
||||
log_action_msg "Setting console screen modes and fonts"
|
||||
fi
|
||||
setup
|
||||
[ -z "$HAVE_SETUPCON" ] || log_action_msg "Skipping font and keymap setup (handled by console-setup)"
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
setup
|
||||
;;
|
||||
esac
|
||||
|
||||
:
|
||||
|
||||
+33
-7
@@ -1,12 +1,38 @@
|
||||
# Simple Debian finit.conf
|
||||
# Sample Debian finit.conf
|
||||
user admin
|
||||
host testbed
|
||||
|
||||
# Devices to fsck at boot
|
||||
check /dev/vda1
|
||||
|
||||
# Linux kernel modules to load
|
||||
module button
|
||||
module evdev
|
||||
module loop
|
||||
module psmouse
|
||||
user admin
|
||||
host testbed
|
||||
|
||||
# Runlevel to start after bootstrap, runlevel 'S'
|
||||
runlevel 2
|
||||
|
||||
# Network bringup script
|
||||
network service networking start
|
||||
service /sbin/klogd -n -- Kernel logging server
|
||||
service /sbin/syslogd -n -- Syslog server
|
||||
service /usr/sbin/sshd -D -- OpenSSH server
|
||||
service /usr/sbin/gdm -- GNOME Display Manager
|
||||
|
||||
# Virtual consoles to start getty on
|
||||
tty /dev/tty1
|
||||
tty /dev/tty2
|
||||
tty /dev/tty3
|
||||
|
||||
# Alternative method instead of runparts
|
||||
#run [S] /etc/init.d/keyboard-setup start -- Setting up preliminary keymap
|
||||
#run [S] /etc/init.d/acpid start -- Starting ACPI Daemon
|
||||
#run [S] /etc/init.d/kbd start -- Preparing console
|
||||
#run [2] /etc/init.d/networking start -- Start networking
|
||||
|
||||
# Services to be monitored and respawned as needed
|
||||
service [2345] /sbin/klogd -n -- Kernel logging server
|
||||
service [2345] /sbin/syslogd -n -- Syslog server
|
||||
service [2345] /usr/sbin/sshd -D -- OpenSSH server
|
||||
service [3] /usr/sbin/gdm -- GNOME Display Manager
|
||||
|
||||
# By default Finit looks for /etc/finit.d
|
||||
# runparts /etc/finit.d
|
||||
|
||||
Reference in New Issue
Block a user