From a12dbdc6c93a7d63591610378e3e570b7c7d2143 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Sun, 2 Mar 2008 21:13:21 +0000 Subject: Don't check for root in prefix. --- init.d.Linux/clock | 136 -------------------------------------------- init.d.Linux/clock.in | 136 ++++++++++++++++++++++++++++++++++++++++++++ init.d.Linux/consolefont | 78 ------------------------- init.d.Linux/consolefont.in | 78 +++++++++++++++++++++++++ init.d.Linux/keymaps | 69 ---------------------- init.d.Linux/keymaps.in | 69 ++++++++++++++++++++++ init.d.Linux/modules | 50 ---------------- init.d.Linux/modules.in | 50 ++++++++++++++++ init.d.Linux/mtab | 29 ---------- init.d.Linux/mtab.in | 30 ++++++++++ init.d.Linux/numlock | 41 ------------- init.d.Linux/numlock.in | 42 ++++++++++++++ init.d.Linux/procfs | 88 ---------------------------- init.d.Linux/procfs.in | 89 +++++++++++++++++++++++++++++ init.d.Linux/sysctl | 18 ------ init.d.Linux/sysctl.in | 18 ++++++ 16 files changed, 512 insertions(+), 509 deletions(-) delete mode 100755 init.d.Linux/clock create mode 100644 init.d.Linux/clock.in delete mode 100755 init.d.Linux/consolefont create mode 100644 init.d.Linux/consolefont.in delete mode 100755 init.d.Linux/keymaps create mode 100644 init.d.Linux/keymaps.in delete mode 100755 init.d.Linux/modules create mode 100644 init.d.Linux/modules.in delete mode 100644 init.d.Linux/mtab create mode 100644 init.d.Linux/mtab.in delete mode 100755 init.d.Linux/numlock create mode 100644 init.d.Linux/numlock.in delete mode 100644 init.d.Linux/procfs create mode 100644 init.d.Linux/procfs.in delete mode 100644 init.d.Linux/sysctl create mode 100644 init.d.Linux/sysctl.in (limited to 'init.d.Linux') diff --git a/init.d.Linux/clock b/init.d.Linux/clock deleted file mode 100755 index 691f321..0000000 --- a/init.d.Linux/clock +++ /dev/null @@ -1,136 +0,0 @@ -#!/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 nouml novps 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/clock.in b/init.d.Linux/clock.in new file mode 100644 index 0000000..ea7ad2b --- /dev/null +++ b/init.d.Linux/clock.in @@ -0,0 +1,136 @@ +#!/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 noprefix nouml novps 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 b/init.d.Linux/consolefont deleted file mode 100755 index 7bf6bfc..0000000 --- a/init.d.Linux/consolefont +++ /dev/null @@ -1,78 +0,0 @@ -#!/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 nouml novps 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/consolefont.in b/init.d.Linux/consolefont.in new file mode 100644 index 0000000..37f1fee --- /dev/null +++ b/init.d.Linux/consolefont.in @@ -0,0 +1,78 @@ +#!/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 noprefix nouml novps 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 b/init.d.Linux/keymaps deleted file mode 100755 index b09137d..0000000 --- a/init.d.Linux/keymaps +++ /dev/null @@ -1,69 +0,0 @@ -#!/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 nouml novps 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/keymaps.in b/init.d.Linux/keymaps.in new file mode 100644 index 0000000..827b550 --- /dev/null +++ b/init.d.Linux/keymaps.in @@ -0,0 +1,69 @@ +#!/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 noprefix nouml novps 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 b/init.d.Linux/modules deleted file mode 100755 index c3064d1..0000000 --- a/init.d.Linux/modules +++ /dev/null @@ -1,50 +0,0 @@ -#!/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 novps -} - -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= 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}" - eval args=\$module_$(shell_var "${x}")_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/modules.in b/init.d.Linux/modules.in new file mode 100644 index 0000000..825ca49 --- /dev/null +++ b/init.d.Linux/modules.in @@ -0,0 +1,50 @@ +#!/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 noprefix novps +} + +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= 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}" + eval args=\$module_$(shell_var "${x}")_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 b/init.d.Linux/mtab deleted file mode 100644 index abb9492..0000000 --- a/init.d.Linux/mtab +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 -} - -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/mtab.in b/init.d.Linux/mtab.in new file mode 100644 index 0000000..cd3e1b9 --- /dev/null +++ b/init.d.Linux/mtab.in @@ -0,0 +1,30 @@ +#!/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 b/init.d.Linux/numlock deleted file mode 100755 index 6327361..0000000 --- a/init.d.Linux/numlock +++ /dev/null @@ -1,41 +0,0 @@ -#!/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 -} - -_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/numlock.in b/init.d.Linux/numlock.in new file mode 100644 index 0000000..5f9d55d --- /dev/null +++ b/init.d.Linux/numlock.in @@ -0,0 +1,42 @@ +#!/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 noprefix +} + +_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 b/init.d.Linux/procfs deleted file mode 100644 index 9e55d88..0000000 --- a/init.d.Linux/procfs +++ /dev/null @@ -1,88 +0,0 @@ -#!/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 -} - -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/procfs.in b/init.d.Linux/procfs.in new file mode 100644 index 0000000..4087863 --- /dev/null +++ b/init.d.Linux/procfs.in @@ -0,0 +1,89 @@ +#!/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 noprefix +} + +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 b/init.d.Linux/sysctl deleted file mode 100644 index 0a49040..0000000 --- a/init.d.Linux/sysctl +++ /dev/null @@ -1,18 +0,0 @@ -#!/sbin/runscript -# Copyright 2007-2008 Roy Marples -# All rights reserved. Released under the 2-clause BSD license. - -depend() -{ - use hostname - before bootmisc logger - keyword novps -} - -start() -{ - [ -e /etc/sysctl.conf ] || return 0 - ebegin "Configuring kernel parameters" - sysctl -p /etc/sysctl.conf >/dev/null - eend $? -} diff --git a/init.d.Linux/sysctl.in b/init.d.Linux/sysctl.in new file mode 100644 index 0000000..be0b539 --- /dev/null +++ b/init.d.Linux/sysctl.in @@ -0,0 +1,18 @@ +#!/sbin/runscript +# Copyright 2007-2008 Roy Marples +# All rights reserved. Released under the 2-clause BSD license. + +depend() +{ + use hostname + before bootmisc logger + keyword noprefix novps +} + +start() +{ + [ -e /etc/sysctl.conf ] || return 0 + ebegin "Configuring kernel parameters" + sysctl -p /etc/sysctl.conf >/dev/null + eend $? +} -- cgit v1.2.3