From 55eb3794fb4ad563102d5ab30c1d5337a599b2e5 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Tue, 25 Mar 2008 14:06:05 +0000 Subject: Rework our folder structure so that we don't have OS specific dirs, making it easier to share init and conf files per OS. --- init.d.Linux/.gitignore | 8 --- init.d.Linux/Makefile | 7 --- init.d.Linux/clock.in | 136 -------------------------------------------- init.d.Linux/consolefont.in | 78 ------------------------- init.d.Linux/keymaps.in | 69 ---------------------- init.d.Linux/modules.in | 59 ------------------- init.d.Linux/mtab.in | 30 ---------- init.d.Linux/numlock.in | 42 -------------- init.d.Linux/procfs.in | 89 ----------------------------- init.d.Linux/sysctl.in | 18 ------ 10 files changed, 536 deletions(-) delete mode 100644 init.d.Linux/.gitignore delete mode 100644 init.d.Linux/Makefile delete mode 100644 init.d.Linux/clock.in delete mode 100644 init.d.Linux/consolefont.in delete mode 100644 init.d.Linux/keymaps.in delete mode 100644 init.d.Linux/modules.in delete mode 100644 init.d.Linux/mtab.in delete mode 100644 init.d.Linux/numlock.in delete mode 100644 init.d.Linux/procfs.in delete mode 100644 init.d.Linux/sysctl.in (limited to 'init.d.Linux') diff --git a/init.d.Linux/.gitignore b/init.d.Linux/.gitignore deleted file mode 100644 index 44127b44..00000000 --- a/init.d.Linux/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -clock -consolefont -keymaps -modules -mtab -numlock -procfs -sysctl diff --git a/init.d.Linux/Makefile b/init.d.Linux/Makefile deleted file mode 100644 index 8a8ba0dd..00000000 --- a/init.d.Linux/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -DIR= ${INITDIR} -SRCS= clock.in consolefont.in keymaps.in modules.in mtab.in numlock.in \ - procfs.in sysctl.in -BIN=${OBJS} - -MK= ../mk -include ${MK}/scripts.mk diff --git a/init.d.Linux/clock.in b/init.d.Linux/clock.in deleted file mode 100644 index 0bb71980..00000000 --- a/init.d.Linux/clock.in +++ /dev/null @@ -1,136 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -extra_commands="save show" - -description="Sets the local clock to UTC or Local Time." -description_save="Saves the current time in the BIOS." -description_show="Displays the current time in the BIOS." - -clock_adjfile=${clock_adjfile:-${CLOCK_ADJFILE}} -clock_args=${clock_args:-${CLOCK_OPTS}} -clock_systohc=${clock_systohc:-${CLOCK_SYSTOHC}} - -clock=${clock:-${CLOCK:-UTC}} -if [ "${clock}" = "UTC" ]; then - utc="UTC" - utc_cmd="--utc" -else - utc="Local Time" - utc_cmd="--localtime" -fi - -depend() -{ - if yesno ${clock_adjfile}; then - use root - else - before * - fi - keyword noopenvz noprefix nouml novserver noxenu -} - -setupopts() -{ - case "$(uname -m)" in - s390*) - utc="s390" - ;; - *) - if [ -e /proc/devices ] && \ - grep -q " cobd$" /proc/devices - then - utc="coLinux" - fi - ;; - esac - - case "${utc}" in - UTC|Local" "Time);; - *) unset utc_cmd;; - esac -} - -# hwclock doesn't always return non zero on error -_hwclock() -{ - local err="$(hwclock "$@" 2>&1 >/dev/null)" - - [ -z "${err}" ] && return 0 - echo "${err}" >&2 - return 1 -} - -start() -{ - local retval=0 errstr="" - setupopts - - if [ -z "${utc_cmd}" ]; then - ewarn "Not setting clock for ${utc} system" - return 0 - fi - - ebegin "Setting system clock using the hardware clock [${utc}]" - if [ -e /proc/modules -a ! -e /dev/rtc ]; then - modprobe -q rtc || modprobe -q genrtc - fi - - if [ -e /etc/adjtime ] && yesno ${clock_adjfile}; then - _hwclock --adjust ${utc_cmd} - retval=$((${retval} + $?)) - fi - - # If setting UTC, don't bother to run hwclock when first booting - # as that's the default - if [ "${PREVLEVEL}" != "N" -o \ - "${utc_cmd}" != "--utc" -o \ - -n "${clock_args}" ]; - then - _hwclock --hctosys ${utc_cmd} ${clock_args} - retval=$((${retval} + $?)) - fi - - eend ${retval} "Failed to set the system clock" - - return 0 -} - -stop() -{ - # Don't tweak the hardware clock on LiveCD halt. - [ -n "${CDBOOT}" ] && return 0 - yesno ${clock_systohc} || return 0 - - local retval=0 errstr="" - setupopts - - [ -z "${utc_cmd}" ] && return 0 - - ebegin "Setting hardware clock using the system clock" "[${utc}]" - - if ! yesno "${clock_adjfile}"; then - # Some implementations don't handle adjustments - if LC_ALL=C hwclock --help | grep -q "\-\-noadjfile"; then - utc_cmd="${utc_cmd} --noadjfile" - fi - fi - - _hwclock --systohc ${utc_cmd} ${clock_args} - retval=$? - - eend ${retval} "Failed to sync clocks" -} - -save() -{ - clock_systohc="yes" - stop -} - -show() -{ - setupopts - hwclock --show "${utc_cmd}" ${clock_args} -} diff --git a/init.d.Linux/consolefont.in b/init.d.Linux/consolefont.in deleted file mode 100644 index a30961e4..00000000 --- a/init.d.Linux/consolefont.in +++ /dev/null @@ -1,78 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -description="Sets a font for the consoles." - -depend() -{ - need localmount - need keymaps # sets up terminal encoding scheme - after hotplug - keyword noopenvz noprefix nouml novserver noxenu -} - -start() -{ - # Forget about any font until we are successful - rm -rf "${RC_LIBDIR}"/console - - ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} - consolefont=${consolefont:-${CONSOLEFONT}} - unicodemap=${unicodemap:-${UNICODEMAP}} - consoletranslation=${consoletranslation:-${CONSOLETRANSLATION}} - - if [ -z "${consolefont}" ]; then - ebegin "Using the default console font" - eend 0 - return 0 - fi - - if [ "${ttyn}" = 0 ]; then - ebegin "Skipping font setup (rc_tty_number == 0)" - eend 0 - return 0 - fi - - local x= param= sf_param= retval=0 ttydev= - - # Get additional parameters - if [ -n "${consoletranslation}" ]; then - param="${param} -m ${consoletranslation}" - fi - if [ -n "${unicodemap}" ]; then - param="${param} -u ${unicodemap}" - fi - - # Set the console font - ebegin "Setting user font" - [ -d /dev/vc ] \ - && ttydev=/dev/vc/ \ - || ttydev=/dev/tty - - x=1 - while [ ${x} -le ${ttyn} ]; do - setfont ${consolefont} ${param} -C ${ttydev}${x} >/dev/null - retval=$((${retval} + $?)) - x=$((${x} + 1)) - done - eend ${retval} - - # Store the last font so we can use it ASAP on boot - if [ ${retval} -eq 0 -a -w "${RC_LIBDIR}" ]; then - mkdir -p "${RC_LIBDIR}"/console - - for font in /usr/share/consolefonts/"${consolefont}".*; do - : - done - cp "${font}" "${RC_LIBDIR}"/console - echo "${font##*/}" > "${RC_LIBDIR}"/console/font - if yesno ${unicode:-${UNICODE}}; then - cp /dev/null "${RC_LIBDIR}"/console/unicode - else - rm -f "${RC_LIBDIR}"/console/unicode - fi - fi - - return ${retval} -} diff --git a/init.d.Linux/keymaps.in b/init.d.Linux/keymaps.in deleted file mode 100644 index 2079e049..00000000 --- a/init.d.Linux/keymaps.in +++ /dev/null @@ -1,69 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -description="Applies a keymap for the consoles." - -ttyn=${rc_tty_number:-${RC_TTY_NUMBER:-12}} -unicode=${unicode:-${UNICODE}} -keymap=${keymap:-${KEYMAP}} -extended_keymaps=${extended_keymaps:-${EXTENDED_KEYMAPS}} -windowskeys=${windowskeys:-${SET_WINDOWSKEYS}} -fix_euro=${fix_euro:-${FIX_EURO}} -dumpkeys_charset=${dumpkeys_charset:-${DUMPKEYS_CHARSET}} - -depend() -{ - need localmount - keyword noopenvz noprefix nouml novserver noxenu -} - -start() -{ - if [ -z "${keymap}" ]; then - eerror "You need to setup keymap in /etc/conf.d/keymaps first" - return 1 - fi - - local ttydev= n= - [ -d /dev/vc ] \ - && ttydev=/dev/vc/ \ - || ttydev=/dev/tty - - # Force linux keycodes for PPC. - if [ -f /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes ]; then - echo 1 > /proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes - fi - - ebegin "Loading key mappings" - local loadkeys_uni= wkeys= - yesno ${unicode} && loadkeys_uni="--unicode" - yesno ${windowskeys} && wkeys="windowkeys" - loadkeys -q ${loadkeys_uni} ${wkeys} ${keymap} ${extended_keymaps} - eend $? "Error loading key mappings" || return $? - - if yesno ${fix_euro}; then - # Fix some fonts displaying the Euro, #173528. - echo "altgr keycode 18 = U+20AC" | loadkeys -q - fi - - # Set terminal encoding to either ASCII or UNICODE. - # See utf-8(7) for more information. - local termencoding="%@" termmsg="ASCII" kmode="-a" - if yesno ${unicode}; then - dumpkeys ${dumpkeys_charset:+-c} \ - ${dumpkeys_charset} | loadkeys --unicode - termencoding="%G" - termmsg="UTF-8" - kmode="-u" - fi - - ebegin "Setting terminal encoding to" ${termmsg} - n=1 - while [ ${n} -le "${ttyn}" ]; do - printf "\033%s" "${termencoding}" >"${ttydev}${n}" - kbd_mode "${kmode}" -C "${ttydev}${n}" - n=$((${n} + 1)) - done - eend 0 -} diff --git a/init.d.Linux/modules.in b/init.d.Linux/modules.in deleted file mode 100644 index 1a0c7458..00000000 --- a/init.d.Linux/modules.in +++ /dev/null @@ -1,59 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -description="Loads a user defined list of kernel modules." - -depend() -{ - use isapnp - keyword noopenvz noprefix novserver -} - -start() -{ - # Should not fail if kernel do not have module - # support compiled in ... - [ ! -f /proc/modules ] && return 0 - - local KV=$(uname -r) - local KV_MAJOR=${KV%%.*} - local x=${KV#*.} - local KV_MINOR=${x%%.*} - x=${KV#*.*.} - local KV_MICRO=${x%%-*} - - local list= x= xx= y= args= cnt=0 - for x in "${KV}" \ - ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \ - ${KV_MAJOR}.${KV_MINOR} \ - ; do - eval list=\$modules_$(shell_var "${x}") - [ -n "${list}" ] && break - done - [ -z "${list}" ] && list=${modules} - - for x in ${list}; do - ebegin "Loading module ${x}" - xx=$(shell_var "${x}") - for y in "${KV}" \ - ${KV_MAJOR}.${KV_MINOR}.${KV_MICRO} \ - ${KV_MAJOR}.${KV_MINOR} \ - ; do - eval args=\$module_${xx}_args_$(shell_var "${y}") - [ -n "${args}" ] && break - done - done - [ -z "${args}" ] && eval args=\$module_${xx}_args - eval modprobe -q "${x}" "${args}" - eend $? "Failed to load ${x}" && cnt=$((${cnt} + 1)) - done - einfo "Autoloaded ${cnt} module(s)" - - # Just in case a sysadmin prefers generic symbolic links in - # /lib/modules/boot for boot time modules we will load these modules - [ -n "$(modprobe -l -t boot)" ] && modprobe -a -t boot \* 2>/dev/null - - # Above test clobbers the return - return 0 -} diff --git a/init.d.Linux/mtab.in b/init.d.Linux/mtab.in deleted file mode 100644 index a0f14b1e..00000000 --- a/init.d.Linux/mtab.in +++ /dev/null @@ -1,30 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -description="Update /etc/mtab to match what the kernel knows about" - -depend() -{ - need root - keyword noprefix -} - -start() -{ - ebegin "Updating /etc/mtab" - if ! echo 2>/dev/null >/etc/mtab; then - ewend 1 "/etc/mtab is not updateable" - return 0 - fi - - # With / as tmpfs we cannot umount -at tmpfs in localmount as that - # makes / readonly and dismounts all tmpfs even if in use which is - # not good. Luckily, umount uses /etc/mtab instead of /proc/mounts - # which allows this hack to work. - grep -v "^[^ ]* / tmpfs " /proc/mounts > /etc/mtab - - # Remove stale backups - rm -f /etc/mtab~ /etc/mtab~~ - eend 0 -} diff --git a/init.d.Linux/numlock.in b/init.d.Linux/numlock.in deleted file mode 100644 index 1a71367e..00000000 --- a/init.d.Linux/numlock.in +++ /dev/null @@ -1,42 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -description="Turns numlock on for the consoles." - -ttyn=${rc_tty_number:-${RC_TTY_NUMBER}:-12} - -depend() -{ - need localmount - keyword noopenvz noprefix novserver -} - -_setleds() -{ - [ -z "$1" ] && return 1 - - local dev=/dev/tty t= i=1 retval=0 - [ -d /dev/vc ] && dev=/dev/vc/ - - while [ ${i} -le ${ttyn} ]; do - setleds -D "$1"num < ${dev}${i} || retval=1 - i=$((${i} + 1)) - done - - return ${retval} -} - -start() -{ - ebegin "Enabling numlock on ttys" - _setleds + - eend $? "Failed to enable numlock" -} - -stop() -{ - ebegin "Disabling numlock on ttys" - _setleds - - eend $? "Failed to disable numlock" -} diff --git a/init.d.Linux/procfs.in b/init.d.Linux/procfs.in deleted file mode 100644 index a30fd92c..00000000 --- a/init.d.Linux/procfs.in +++ /dev/null @@ -1,89 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -description="Mounts misc filesystems in /proc." - -depend() -{ - need localmount - keyword noopenvz noprefix novserver -} - -start() -{ - # Make sure we insert usbcore if its a module - if [ -f /proc/modules -a ! -d /proc/bus/usb ]; then - modprobe -q usbcore - fi - - [ -e /proc/filesystems ] || return 0 - - # Check what USB fs the kernel support. Currently - # 2.5+ kernels, and later 2.4 kernels have 'usbfs', - # while older kernels have 'usbdevfs'. - if [ -d /proc/bus/usb -a ! -e /proc/bus/usb/devices ]; then - local usbfs=$(grep -Fow usbfs /proc/filesystems || - grep -Fow usbdevfs /proc/filesystems) - if [ -n "${usbfs}" ]; then - ebegin "Mounting USB device filesystem (${usbfs})" - local usbgid="$(getent group usb | \ - sed -e 's/.*:.*:\(.*\):.*/\1/')" - mount -t ${usbfs} \ - -o ${usbgid:+devmode=0664,devgid=${usbgid},}noexec,nosuid \ - usbfs /proc/bus/usb - eend $? - fi - fi - - # Setup Kernel Support for the NFS daemon status - if [ -d /proc/fs/nfsd ] && ! mountinfo -q /proc/fs/nfsd; then - if grep -qs nfsd /proc/filesystems; then - ebegin "Mounting nfsd filesystem" - mount -t nfsd -o nodev,noexec,nosuid \ - nfsd /proc/fs/nfsd - eend $? - fi - fi - - # Setup Kernel Support for miscellaneous Binary Formats - if [ -d /proc/sys/fs/binfmt_misc ] && ! mountinfo -q /proc/sys/fs/binfmt_misc; then - if grep -qs binfmt_misc /proc/filesystems; then - ebegin "Mounting misc binary format filesystem" - mount -t binfmt_misc -o nodev,noexec,nosuid \ - binfmt_misc /proc/sys/fs/binfmt_misc - eend $? - fi - fi - - # Setup Kernel Support for securityfs - if [ -d /sys/kernel/security ] && ! mountinfo -q /sys/kernel/security; then - if grep -qs securityfs /proc/filesystems; then - ebegin "Mounting security filesystem" - mount -t securityfs -o nodev,noexec,nosuid \ - securityfs /sys/kernel/security - eend $? - fi - fi - - # Setup Kernel Support for debugfs - if [ -d /sys/kernel/debug ] && ! mountinfo -q /sys/kernel/debug; then - if grep -qs debugfs /proc/filesystems; then - ebegin "Mounting debug filesystem" - mount -t debugfs -o nodev,noexec,nosuid \ - debugfs /sys/kernel/debug - eend $? - fi - fi - - # Setup Kernel Support for SELinux - if [ -d /selinux ] && ! mountinfo -q /selinux; then - if grep -qs selinuxfs /proc/filesystems; then - ebegin "Mounting SELinux filesystem" - mount -t selinuxfs selinuxfs /selinux - eend $? - fi - fi - - return 0 -} diff --git a/init.d.Linux/sysctl.in b/init.d.Linux/sysctl.in deleted file mode 100644 index ad6b2a92..00000000 --- a/init.d.Linux/sysctl.in +++ /dev/null @@ -1,18 +0,0 @@ -#!@PREFIX@/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -depend() -{ - use hostname - before bootmisc logger - keyword noopenvz noprefix novserver -} - -start() -{ - [ -e /etc/sysctl.conf ] || return 0 - ebegin "Configuring kernel parameters" - sysctl -p /etc/sysctl.conf >/dev/null - eend $? -} -- cgit v1.2.3