From: Michael Tremer Date: Wed, 29 Jul 2009 17:23:32 +0000 (+0200) Subject: Replaced sysvinit initscript by upstart events. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60caa2d08e78eb55bc35d7f0ebfedafd41355cc6;p=ipfire-3.x.git Replaced sysvinit initscript by upstart events. --- diff --git a/lfs/initscripts b/lfs/initscripts index 20635f45f..5194017e1 100644 --- a/lfs/initscripts +++ b/lfs/initscripts @@ -39,37 +39,18 @@ CORE = yes EXTRA = no DEBUG = no BUILD_DEPS = -DEPS = coreutils e2fsprogs initd-tools module-init-tools procps sysvinit \ - udev util-linux-ng +DEPS = coreutils e2fsprogs module-init-tools procps sysvinit system-release \ + udev upstart util-linux-ng URL = LICENSE = GPLv2+ -SHORT_DESC = The /etc/init.d scripts. +SHORT_DESC = The set of scripts that initalize the system. define LONG_DESC The initscripts package contains the basic system scripts used to boot \ - your system, change runlevels, and shut the system down cleanly. \ - Initscripts also contains the scripts that activate and \ - deactivate the network interfaces. + your system and shut the system down cleanly. endef -SCRIPTS = \ - checkfs \ - cleanfs \ - halt \ - localnet \ - modules \ - mountfs \ - mountkernfs \ - random \ - reboot \ - sendsignals \ - setclock \ - swap \ - sysctl \ - udev \ - udev_retry - ############################################################################### # Top-level Rules ############################################################################### @@ -97,30 +78,12 @@ $(objects): $(OBJECT): $(objects) @$(PREBUILD) - install -d -m 755 /etc/rc0.d - install -d -m 755 /etc/rc1.d - install -d -m 755 /etc/rc2.d - install -d -m 755 /etc/rc3.d - install -d -m 755 /etc/rc4.d - install -d -m 755 /etc/rc5.d - install -d -m 755 /etc/rc6.d - install -d -m 755 /etc/rcS.d - install -d -m 755 /etc/init.d - install -d -m 755 /etc/init.d/boottemp + install -d -m 755 /etc/init install -d -m 755 /etc/sysconfig - install -d -m 755 /etc/lsb/state - install -d -m 755 /lib/lsb for i in $(DIR_APP)/core/*; do \ - install -v -m 754 $$i /etc/init.d/; \ + install -v -m 644 $$i /etc/init/; \ done - chmod 644 /etc/init.d/ipfire-functions - - install -m 644 $(DIR_APP)/lsb/init-functions /lib/lsb/ - install -m 644 $(DIR_APP)/lsb/manage-functions /lib/lsb/ - install -m 644 $(DIR_APP)/etc/lsb-config /etc/lsb/ - - cd /etc/init.d && install_initd -v $(SCRIPTS) for i in $(DIR_SRC)/src/initscripts/sysconfig/*; do \ install -v -m 644 $$i /etc/sysconfig/; \ diff --git a/lfs/upstart b/lfs/upstart index 43f79afa4..8272a5023 100644 --- a/lfs/upstart +++ b/lfs/upstart @@ -42,8 +42,8 @@ DEBUG = no DEPS = BUILD_DEPS = gettext dbus -LICENSE = GPLv2+ URL = http://upstart.ubuntu.com/ +LICENSE = GPLv2+ SHORT_DESC = An event-driven init system. define LONG_DESC @@ -82,17 +82,15 @@ $(OBJECT): $(objects) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && $(EXTRACTOR) $(DIR_DL)/$(DL_FILE) - cd $(DIR_APP) && ./configure \ + cd $(DIR_APP) && \ + ./configure \ --prefix=/usr \ --sbindir=/sbin \ --sysconfdir=/etc \ - --libdir=/lib - - cd $(DIR_APP) && make $(PARALLELISMFLAGS) CFLAGS="$(CFLAGS)" - cd $(DIR_APP) && make install + --libdir=/lib - # Install Upstart events - cp -vaf $(DIR_SRC)/src/$(PKG_NAME)/* /etc/init/ + cd $(DIR_APP) && make $(PARALLELISMFLAGS) + cd $(DIR_APP) && make install @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/make.sh b/make.sh index 27bdb3bc7..f2ba2c603 100755 --- a/make.sh +++ b/make.sh @@ -1,25 +1,23 @@ #!/bin/bash -############################################################################ -# # -# This file is part of the IPFire Firewall. # -# # -# IPFire is free software; you can redistribute it and/or modify # -# it under the terms of the GNU General Public License as published by # -# the Free Software Foundation; either version 2 of the License, or # -# (at your option) any later version. # -# # -# IPFire 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 IPFire; if not, write to the Free Software # -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -# # -# Copyright (C) 2008 IPFire-Team . # -# # -############################################################################ +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007, 2008, 2009 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# 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, see . # +# # +############################################################################### # NAME="IPFire" # Software name @@ -194,7 +192,6 @@ base_build() { ipfire_make texinfo ipfire_make udev ipfire_make vim - ipfire_make initscripts } ################################################################################ @@ -224,6 +221,7 @@ ipfire_build() { ipfire_make dbus ipfire_make dbus-glib ipfire_make upstart + ipfire_make initscripts ipfire_make openssl ipfire_make perl-xml-parser ipfire_make intltool diff --git a/src/initscripts/core/checkfs b/src/initscripts/core/checkfs deleted file mode 100644 index a5048e6e6..000000000 --- a/src/initscripts/core/checkfs +++ /dev/null @@ -1,105 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/checkfs - -### BEGIN INIT INFO -# Provides: checkfs -# Required-Start: udev swap -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Checks local filesystems before mounting. -# Description: Checks local filesystmes before mounting. -# X-LFS-Default-Start: S30 -# X-LFS-Default-Stop: -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - start) - if [ -f /fastboot ]; then - echo "${INFO}/fastboot found!" - log_success_msg "Will not perform file system checks as requested." - exit 0 - fi - - mount -n -o remount,ro / >/dev/null - if [ ${?} != 0 ] - then - log_failure_msg "Mounting root file system in read-only mode" - echo -e "${FAILURE}FAILURE:\n" - echo -e -n "${FAILURE}Cannot check root filesystem because it " - echo -e "${FAILURE}could not be mounted" - echo -e "${FAILURE}in read-only mode.\n\n" - echo -e -n "${FAILURE}After you press Enter, this system will be " - echo -e "${FAILURE}halted and powered off.\n" - echo -e "${INFO}Press enter to continue...${NORMAL}" - read ENTER - /etc/rc.d/init.d/halt stop - fi - - if [ -f /forcefsck ] - then - echo "${INFO}/forcefsck found!" - log_success_msg "${INFO}Forcing file system checks as requested." - options="-f" - else - options="" - fi - - # Note: -a option used to be -p; but this fails e.g. - # on fsck.minix - fsck ${options} -a -A -C -T - error_value=${?} - - if [ "${error_value}" = 0 ] - then - log_success_msg "Checking file systems..." - elif [ "${error_value}" = 1 ] - then - log_warning_msg "Checking file systems..." - echo -e "${WARNING}WARNING:\n" - echo -e "${WARNING}File system errors were found and have been" - echo -e "${WARNING}corrected. You may want to double-check that" - echo -e "${WARNING}everything was fixed properly.${NORMAL}" - elif [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then - log_warning_msg "Checking file systems..." - echo -e "${WARNING}WARNING:\n" - echo -e "${WARNING}File system errors were found and have been been" - echo -e "${WARNING}corrected, but the nature of the errors require" - echo -e "${WARNING}this system to be rebooted.\n" - echo -e "After you press enter, this system will be rebooted.\n" - echo -e "${INFO}Press Enter to continue...${NORMAL}" - read ENTER - reboot -f - elif [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then - log_failure_msg "Checking file systems..." - echo -e "${FAILURE}FAILURE:\n" - echo -e "${FAILURE}File system errors were encountered that could" - echo -e "${FAILURE}not be fixed automatically. This system cannot" - echo -e "${FAILURE}continue to boot and will therefore be halted" - echo -e "${FAILURE}until those errors are fixed manually by a" - echo -e "${FAILURE}System Administrator.\n" - echo -e "${FAILURE}After you press Enter, this system will be" - echo -e "${FAILURE}halted and powered off.\n" - echo -e "${INFO}Press Enter to continue...${NORMAL}" - read ENTER - /etc/rc.d/init.d/halt stop - elif [ "${error_value}" -ge 16 ]; then - log_failure_msg "Checking file systems..." - echo -e "${FAILURE}FAILURE:\n" - echo -e "${FAILURE}Unexpected Failure running fsck. Exited with error" - echo -e "${FAILURE}code: ${error_value}.${NORMAL}" - exit ${error_value} - fi - ;; - *) - echo "Usage: ${0} {start}" - exit 1 - ;; -esac - -# End /etc/init.d/checkfs diff --git a/src/upstart/checkfs.conf b/src/initscripts/core/checkfs.conf similarity index 85% rename from src/upstart/checkfs.conf rename to src/initscripts/core/checkfs.conf index bb550a873..20829c720 100644 --- a/src/upstart/checkfs.conf +++ b/src/initscripts/core/checkfs.conf @@ -1,22 +1,22 @@ -description "Set sysctls from /etc/sysctl.conf" -author "IPFire Team" +description "Check / filesystem" +author "IPFire Team" -start on started udevtrigger +start on stopped udevtrigger console output script - . /lib/lsb/init-functions + set -e + . /etc/init/functions if [ -f /fastboot ]; then - echo "${INFO}/fastboot found!" + echo "${INFO}/fastboot found!${NORMAL}" log_success_msg "Will not perform file system checks as requested." exit 0 fi mount -n -o remount,ro / >/dev/null - if [ ${?} != 0 ] - then + if [ ${?} != 0 ]; then log_failure_msg "Mounting root file system in read-only mode" echo -e "${FAILURE}FAILURE:\n" echo -e -n "${FAILURE}Cannot check root filesystem because it " @@ -26,7 +26,7 @@ script echo -e "${FAILURE}halted and powered off.\n" echo -e "${INFO}Press enter to continue...${NORMAL}" read ENTER - /sbin/shutdown + ## XXX need to shutdown the system cleanly here fi if [ -f /forcefsck ] @@ -40,14 +40,12 @@ script # Note: -a option used to be -p; but this fails e.g. # on fsck.minix - fsck ${options} -a -A -C -T + true # XXX fsck ${options} -a -A -C -T error_value=${?} - if [ "${error_value}" = 0 ] - then + if [ "${error_value}" = 0 ]; then log_success_msg "Checking file systems..." - elif [ "${error_value}" = 1 ] - then + elif [ "${error_value}" = 1 ]; then log_warning_msg "Checking file systems..." echo -e "${WARNING}WARNING:\n" echo -e "${WARNING}File system errors were found and have been" @@ -62,7 +60,7 @@ script echo -e "After you press enter, this system will be rebooted.\n" echo -e "${INFO}Press Enter to continue...${NORMAL}" read ENTER - reboot -f + ## XXX need to reboot the system here elif [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then log_failure_msg "Checking file systems..." echo -e "${FAILURE}FAILURE:\n" @@ -75,7 +73,7 @@ script echo -e "${FAILURE}halted and powered off.\n" echo -e "${INFO}Press Enter to continue...${NORMAL}" read ENTER - /sbin/shutdown + ## XXX need to shutdown the system here elif [ "${error_value}" -ge 16 ]; then log_failure_msg "Checking file systems..." echo -e "${FAILURE}FAILURE:\n" @@ -83,6 +81,4 @@ script echo -e "${FAILURE}code: ${error_value}.${NORMAL}" exit ${error_value} fi - end script - diff --git a/src/initscripts/core/cleanfs b/src/initscripts/core/cleanfs deleted file mode 100644 index 93b93fed7..000000000 --- a/src/initscripts/core/cleanfs +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/cleanfs - -### BEGIN INIT INFO -# Provides: cleanfs -# Required-Start: $local_fs -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Cleans temporary directories early in the boot process. -# Description: Cleans temporary directories /var/run, /var/lock, and -# /tmp. cleanfs also creates /var/run/utmp and any files -# defined in /etc/sysconfig/createfiles. -# X-LFS-Default-Start: S50 -# X-LFS-Default-Stop: -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -# Function to create files/directory on boot. -create_files() -{ - # Read in the configuration file. - exec 9>&0 < /etc/sysconfig/createfiles - while read name type perm usr grp dtype maj min junk - do - # Ignore comments and blank lines. - case "${name}" in - ""|\#*) continue ;; - esac - - # Ignore existing files. - if [ ! -e "${name}" ] - then - # Create stuff based on its type. - case "${type}" in - dir) - mkdir "${name}" - ;; - file) - :> "${name}" - ;; - dev) - case "${dtype}" in - char) - mknod "${name}" c ${maj} ${min} - ;; - block) - mknod "${name}" b ${maj} ${min} - ;; - pipe) - mknod "${name}" p - ;; - *) - echo -e -n "\n${WARNING}Unknown device type: ${dtype}" - echo -e "${NORMAL}" - ;; - esac - ;; - *) - echo -e "\n${WARNING}Unknown type: ${type}${NORMAL}" - continue - ;; - esac - - # Set up the permissions, too. - chown ${usr}:${grp} "${name}" - chmod ${perm} "${name}" - fi - done - exec 0>&9 9>&- -} - -case "${1}" in - start) - message="Cleaning file systems: " - - message="${message}${INFO} /tmp" - find /tmp -xdev -mindepth 1 ! -name lost+found \ - -delete || failed=1 - - message="${message} /var/lock" - find /var/lock -type f -exec rm -f {} \; || failed=1 - - message="${message} /var/run${NORMAL}" - find /var/run ! -type d ! -name utmp -exec rm -f {} \; || failed=1 - - > /var/run/utmp - if grep -q '^utmp:' /etc/group ; then - chmod 664 /var/run/utmp - chgrp utmp /var/run/utmp - fi - - (exit ${failed}) - evaluate_retval standard - - if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null - then - message="Creating files and directories..." - create_files - evaluate_retval standard - fi - ;; - *) - echo "Usage: ${0} {start}" - exit 1 - ;; -esac - -# End /etc/init.d/cleanfs diff --git a/src/initscripts/core/functions b/src/initscripts/core/functions new file mode 100644 index 000000000..9e7d87e18 --- /dev/null +++ b/src/initscripts/core/functions @@ -0,0 +1,240 @@ +#!/bin/sh +############################################################################### +# # +# IPFire.org - A linux based firewall # +# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# 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, see . # +# # +############################################################################### +# +# Partly based on scripts by DJ Lucas - dj@linuxfromscratch.org +# + +# Distro Information +DISTRO="$(/dev/null; then + # Read in the configuration file. + exec 9>&0 < /etc/sysconfig/modules + + message="${INFO}Loading modules:" + + while read module args; do + # Ignore comments and blank lines. + case "${module}" in + ""|\#*) continue ;; + esac + + # Attempt to load the module, making + # sure to pass any arguments provided. + modprobe ${module} ${args} > /dev/null + + # Print the module name if successful, + # otherwise take note. + if [ ${?} -eq 0 ]; then + message="${message}${NORMAL} ${module}" + else + failedmod="${failedmod} ${module}" + fi + done + + # Print a message about successfully loaded + # modules on the correct line. + log_success_msg "${message}" + + # Print a failure message with a list of any + # modules that may have failed to load. + if [ "${failedmod}" ]; then + log_failure_msg "${FAILURE}Failed to load modules:${failedmod}" + fi + + exec 0>&9 9>&- + + fi + # Set the kernel message level back to it's previous value. + dmesg -n "${prev_msg}" +end script diff --git a/src/initscripts/core/localnet b/src/initscripts/core/localnet deleted file mode 100644 index 6dae531a0..000000000 --- a/src/initscripts/core/localnet +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/localnet - -### BEGIN INIT INFO -# Provides: localnet -# Required-Start: $local_fs -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Starts the local network. -# Description: Sets the hostname of the machine and starts the -# loopback interface. -# X-LFS-Default-Start: S80 -# X-LFS-Default-Stop: S90 -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions -. /etc/sysconfig/network - -case "${1}" in - start) - ip addr add 127.0.0.1/8 label lo dev lo - ip link set lo up - if [ "${?}" = "0" ] - then - log_success_msg "Bringing up the loopback interface..." - else - log_failure_msg "Bringing up the loopback interface..." - fi - - hostname "${HOSTNAME}" - if [ "${?}" = "0" ] - then - log_success_msg "Setting hostname to ${HOSTNAME}..." - else - log_failure_msg "Setting hostname to ${HOSTNAME}..." - fi - - ;; - - stop) - ip link set lo down - if [ "${?}" = "0" ] - then - log_success_msg "Bringing down the loopback interface..." - else - log_failure_msg "Bringing down the loopback interface..." - fi - - ;; - - restart) - ip link set lo down - retval="${?}" - sleep 1 - ip addr add 127.0.0.1/8 label lo dev lo - retval=$(( "${retval}" + "${?}" )) - ip link set lo up - retval=$(( "${retval}" + "${?}" )) - hostname "${HOSTNAME}" - retval=$(( "${retval}" + "${?}" )) - if [ "${retval}" = "0" ] - then - log_success_msg "Restarting local network..." - else - log_failure_msg "Restarting local network..." - fi - ;; - - status) - log_success_msg "Hostname is: ${INFO}$(hostname)${NORMAL}" - ip link show lo - ;; - - *) - echo "Usage: ${0} {start|stop|restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/localnet diff --git a/src/initscripts/core/loopback.conf b/src/initscripts/core/loopback.conf new file mode 100644 index 000000000..d12727cdb --- /dev/null +++ b/src/initscripts/core/loopback.conf @@ -0,0 +1,33 @@ +description "Bringing up the local network" +author "IPFire Team" + +start on stopped sysctl + +console output + +script + set -e + . /etc/init/functions + + [ -e "/etc/sysconfig/network" ] && \ + . /etc/sysconfig/network + + ip addr add 127.0.0.1/8 label lo dev lo + ip link set lo up + if [ "${?}" = "0" ]; then + log_success_msg "Bringing up the loopback interface..." + else + log_failure_msg "Bringing up the loopback interface..." + fi + + if [ -n "${HOSTNAME}" ]; then + hostname "${HOSTNAME}" + if [ "${?}" = "0" ]; then + log_success_msg "Setting hostname to ${HOSTNAME}..." + else + log_failure_msg "Setting hostname to ${HOSTNAME}..." + fi + else + log_warning_msg "No hostname was set!" + fi +end script diff --git a/src/initscripts/core/modules b/src/initscripts/core/modules deleted file mode 100644 index 35cb9f2d4..000000000 --- a/src/initscripts/core/modules +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/modules - -### BEGIN INIT INFO -# Provides: modules -# Required-Start: mountkernfs sysctl -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Loads required modules. -# Description: Loads modules listed in /etc/sysconfig/modules. -# X-LFS-Default-Start: S10 -# X-LFS-Default-Stop: -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -# Assure that the kernel has module support. -[ -e /proc/ksyms -o -e /proc/modules ] || exit 0 - -case "${1}" in - start) - - # Exit if there's no modules file or there are no - # valid entries - [ -r /etc/sysconfig/modules ] && - egrep -qv '^($|#)' /etc/sysconfig/modules || - exit 0 - - # If proc is mounted, find the current kernel - # message level - if [ -f /proc/sys/kernel/printk ]; then - prev_msg=`cat /proc/sys/kernel/printk | \ - sed 'l 1' | sed -n '2~0p' | \ - sed 's/\\\//'` - else - prev_msg="6" - fi - - # Now set the message level to 1 so not to make too - # much noise when loading modules - dmesg -n 1 - - # Only try to load modules if the user has actually given us - # some modules to load. - if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null - then - - # Read in the configuration file. - exec 9>&0 < /etc/sysconfig/modules - - message="${INFO}Loading modules:" - - while read module args - do - # Ignore comments and blank lines. - case "${module}" in - ""|\#*) continue ;; - esac - - # Attempt to load the module, making - # sure to pass any arguments provided. - modprobe ${module} ${args} > /dev/null - - # Print the module name if successful, - # otherwise take note. - if [ ${?} -eq 0 ]; then - message="${message}${NORMAL} ${module}" - else - failedmod="${failedmod} ${module}" - fi - done - - # Print a message about successfully loaded - # modules on the correct line. - log_success_msg "${message}" - - # Print a failure message with a list of any - # modules that may have failed to load. - if [ "${failedmod}" ]; then - log_failure_msg "${FAILURE}Failed to load modules:${failedmod}" - fi - - exec 0>&9 9>&- - - fi - # Set the kernel message level back to it's previous value. - dmesg -n "${prev_msg}" - ;; - *) - echo "Usage: ${0} {start}" - exit 1 - ;; -esac - -# End /etc/init.d/modules diff --git a/src/initscripts/core/mount-kernel-filesystems.conf b/src/initscripts/core/mount-kernel-filesystems.conf new file mode 100644 index 000000000..2ed3b962a --- /dev/null +++ b/src/initscripts/core/mount-kernel-filesystems.conf @@ -0,0 +1,26 @@ +description "Mount kernel virtual systems" +author "IPFire Team" + +start on stopped welcome + +console output + +script + set -e + . /etc/init/functions + + message="Mounting kernel-based file systems:" + + if ! mountpoint /proc > /dev/null; then + message="${message}${INFO} /proc${NORMAL}" + mount -n /proc || failed=1 + fi + + if ! mountpoint /sys > /dev/null; then + message="${message}${INFO} /sys${NORMAL}" + mount -n /sys || failed=1 + fi + + (exit ${failed}) + evaluate_retval standard +end script diff --git a/src/initscripts/core/mountfs b/src/initscripts/core/mountfs deleted file mode 100644 index eeaac95de..000000000 --- a/src/initscripts/core/mountfs +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/mountfs - -### BEGIN INIT INFO -# Provides: $local_fs -# Required-Start: udev checkfs -# Should-Start: -# Required-Stop: swap -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab. -# Description: Remounts root filesystem read/write and mounts all -# remaining local filesystems defined in /etc/fstab on -# start. Remounts root filesystem read-only and unmounts -# remaining filesystems on stop. -# X-LFS-Default-Start: S40 -# X-LFS-Default-Stop: S70 -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - start) - message="Remounting root file system in read-write mode..." - mount -n -o remount,rw / >/dev/null - evaluate_retval standard - - # Remove fsck-related file system watermarks. - rm -f /fastboot /forcefsck - - message="Recording existing mounts in /etc/mtab..." - > /etc/mtab - mount -f / || failed=1 - mount -f /proc || failed=1 - mount -f /sys || failed=1 - (exit ${failed}) - evaluate_retval standard - - # This will mount all filesystems that do not have _netdev in - # their option list. _netdev denotes a network filesystem. - message="Mounting remaining file systems..." - mount -a -O no_netdev >/dev/null - evaluate_retval standard - ;; - - stop) - message="Unmounting all other currently mounted file systems..." - umount -a -d -r >/dev/null - evaluate_retval standard - ;; - - *) - echo "Usage: ${0} {start|stop}" - exit 1 - ;; -esac - -# End /etc/init.d/mountfs diff --git a/src/upstart/mountfs.conf b/src/initscripts/core/mountfs.conf similarity index 85% rename from src/upstart/mountfs.conf rename to src/initscripts/core/mountfs.conf index 176f8f748..b94130ec1 100644 --- a/src/upstart/mountfs.conf +++ b/src/initscripts/core/mountfs.conf @@ -1,9 +1,13 @@ -start on started checkfs +description "Mount / filesystem" +author "IPFire Team" + +start on stopped checkfs console output script - . /lib/lsb/init-functions + set -e + . /etc/init/functions message="Remounting root file system in read-write mode..." mount -n -o remount,rw / >/dev/null @@ -25,6 +29,4 @@ script message="Mounting remaining file systems..." mount -a -O no_netdev >/dev/null evaluate_retval standard - end script - diff --git a/src/initscripts/core/mountkernfs b/src/initscripts/core/mountkernfs deleted file mode 100644 index aa985b976..000000000 --- a/src/initscripts/core/mountkernfs +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/mountkernfs - -### BEGIN INIT INFO -# Provides: mountkernfs -# Required-Start: -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Mounts /sys and /proc virtual (kernel) filesystems. -# Description: Mounts /sys and /proc virtual (kernel) filesystems. -# X-LFS-Default-Start: S00 -# X-LFS-Default-Stop: -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - start) - message="Mounting kernel-based file systems:" - - if ! mountpoint /proc > /dev/null; then - message="${message}${INFO} /proc${NORMAL}" - mount -n /proc || failed=1 - fi - - if ! mountpoint /sys > /dev/null; then - message="${message}${INFO} /sys${NORMAL}" - mount -n /sys || failed=1 - fi - - (exit ${failed}) - evaluate_retval standard - ;; - - *) - echo "Usage: ${0} {start}" - exit 1 - ;; -esac - -# End /etc/init.d/mountkernfs diff --git a/src/initscripts/core/random b/src/initscripts/core/random deleted file mode 100644 index 0dfc0bed4..000000000 --- a/src/initscripts/core/random +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/random - -### BEGIN INIT INFO -# Provides: random -# Required-Start: udev -# Should-Start: -# Required-Stop: sendsignals -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Saves and restores the random seed. -# Description: Saves and restores the random seed. -# X-LFS-Default-Start: S25 -# X-LFS-Default-Stop: K45 -# X-LFS-Provided-By: -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - start) - message="Initializing kernel random number generator..." - if [ -f /var/tmp/random-seed ]; then - cat /var/tmp/random-seed > /dev/urandom - fi - dd if=/dev/urandom of=/var/tmp/random-seed count=1 &>/dev/null - evaluate_retval standard - ;; - - stop) - message="Saving random seed..." - dd if=/dev/urandom of=/var/tmp/random-seed count=1 &>/dev/null - evaluate_retval standard - ;; - - *) - echo "Usage: ${0} {start|stop}" - exit 1 - ;; -esac - -# End /etc/init.d/random diff --git a/src/initscripts/core/rc b/src/initscripts/core/rc deleted file mode 100644 index 53dc48020..000000000 --- a/src/initscripts/core/rc +++ /dev/null @@ -1,202 +0,0 @@ -#!/bin/sh -# Begin $RC_BASE/init.d/rc - -# Get the configuration file -# All changes are to occur in the config file -. /etc/sysconfig/rc - -# These 3 signals will not cause our script to exit -trap "" INT QUIT TSTP - -# Simple sanity check - rc only takes one argument -if [ "${#}" -ne 1 ]; then - echo "Usage: ${0} " >&2 - exit 1 -fi - -# Do not use the RUNLEVEL and PREVLEVEL variables provided by init so -# that they can be modified and alternate directories (S) can -# be used without affecting init -runlevel="${1}" -prevlevel="${PREVLEVEL}" - -# Just in case - some flavors of init don't set PREVLEVEL to 'N' -if [ "${prevlevel}" = "" ]; then - prevlevel="N" -fi - -if [ "${runlevel}" = "S" ]; then - touch /dev/.in_sysinit -fi - -# Mount a tmpfs to store boot accounting information -if [ "${runlevel}" = "S" -a "${TEMPFS_MOUNT}" != "" ]; then - mount -n -t tmpfs tmpfs "${TEMPFS_MOUNT}" -o mode=600 -fi - -# Provide an interactive prompt (if requested) -if [ "${runlevel}" = "S" -a "${iprompt}" = "yes" ]; then - # ash does not accept t and n flags for read - ls -l /bin/sh | grep "/ash" - if [ "${?}" -eq "0" ]; then - # We are using ash - echo -e -n "${WARNING}WARNING: Either bash or zsh is required" - echo -e "${WARNING} for interactive startup.\n" - sleep 3 - else - echo "" - # dcol and icol are spaces before the message to center the - # message on screen. - dcol=$(( $(( ${COLUMNS} - ${dlen} )) / 2 )) - icol=$(( $(( ${COLUMNS} - ${ilen} )) / 2 )) - echo -e "\\033[${dcol}G${welcome_message}" - echo -e "\\033[${icol}G${i_message}${NORMAL}" - echo "" - read -t "${itime}" -n 1 interactive 2>&1 > /dev/null - if [ "${interactive}" = "I" -o "${interactive}" = "i" ]; then - echo -n -e "${CURS_UP}" - echo -e "${INFO}Interactive boot selected...${NORMAL}" - echo "interactive=I" > "${TEMPFS_MOUNT}/.interactive-start" - fi - fi -fi - - -# Verify that the directory exists -if [ ! -d "${RC_BASE}/rc${runlevel}.d" ]; then - echo -n -e "${WARNING}${RC_BASE}/rc${runlevel}.d does not exist." - echo -e "${NORMAL}" - exit 1 -fi - -# Source the interactive state file if it exists -if [ "${runlevel}" != "S" -a -f "${TEMPFS_MOUNT}/.interactive-start" ]; then - . "${TEMPFS_MOUNT}/.interactive-start" -fi - -# Prompt for interactive startup after completing S -if [ "${interactive}" = "I" -a "${runlevel}" != "S" -a \ - "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then - echo -n -e "Proceed with interactive starup of runlevel " - echo -n -e "${INFO}${runlevel}${NORMAL}?" - echo -n -e "(${FAILURE}y${NORMAL})es/(${FAILURE}n${NORMAL})o " - read -n 1 go_on - echo "" - if [ "${go_on}" = "n" ]; then - # don't continue - exit 0 - fi -fi - - -# Attempt to stop all services started in the previous runlevel, -# that are stopped in this runlevel -if [ "${prevlevel}" != "N" ]; then - for link in $(ls -v ${RC_BASE}/rc${runlevel}.d/K* 2> /dev/null) - do - # Check to see if link is a valid symlink - if [ ! -f ${link} ]; then - echo -e "${WARNING}${link} is not a valid symlink." - continue # go on to the next K* link - fi - - # Check to see if link is executable - if [ ! -x ${link} ]; then - echo -e "${WARNING}${link} is not executable, skipping." - continue # go on to the next K* link - fi - - script=${link#$RC_BASE/rc$runlevel.d/K[0-9][0-9]} - prev_start=$RC_BASE/rc$prevlevel.d/S[0-9][0-9]$script - S_start=$RC_BASE/rcS.d/S[0-9][0-9]$script - - if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then - if [ ! -f ${prev_start} ] && [ ! -f ${S_start} ]; then - echo -e -n "${WARNING}WARNING:\n\n${link} can't be" - echo -e "${WARNING} executed because it was not" - echo -e -n "${WARNING} not started in the previous" - echo -e "${WARNING} runlevel (${prevlevel})." - echo -e "${NORMAL}" - continue - fi - fi - ${link} stop - error_value=${?} - - if [ "${error_value}" != "0" ]; then - print_error_msg - fi - done -fi - -# Start all functions in this runlevel if they weren't started in -# the previous runlevel -for link in $(ls -v ${RC_BASE}/rc${runlevel}.d/S* 2> /dev/null) -do - if [ "${prevlevel}" != "N" ]; then - script=${link#$RC_BASE/rc$runlevel.d/S[0-9][0-9]} - stop=$RC_BASE/rc$runlevel.d/K[0-9][0-9]$script - prev_start=$RC_BASE/rc$prevlevel.d/S[0-9][0-9]$script - - [ -f ${prev_start} ] && [ ! -f ${stop} ] && continue - fi - - # Check to see if link is a valid symlink - if [ ! -f ${link} ]; then - echo -e "${WARNING}${link} is not a valid symlink." - continue # go on to the next K* link - fi - - # Check to see if link is executable - if [ ! -x ${link} ]; then - echo -e "${WARNING}${link} is not executable, skipping." - continue # go on to the next K* link - fi - - case ${runlevel} in - 0|6) - ${link} stop - ;; - - *) - if [ "${interactive}" = "I" -o "${interactive}" = "i" ]; then - echo -e -n "${WARNING}Start ${INFO}${link} ${WARNING}?" - echo -e -n "${NORMAL}(${FAILURE}y${NORMAL})es/(${FAILURE}n${NORMAL})o " - read -n 1 startit 2>&1 > /dev/null - echo "" - if [ "${startit}" = "y" -o "${startit}" = "Y" ]; then - ${link} start - else - echo -e -n "${WARNING}Not starting ${INFO}${link}" - echo -e "${WARNING}.${NORMAL}\n" - fi - else - ${link} start - fi - ;; - esac - error_value=${?} - - if [ "${error_value}" -gt "1" ]; then - print_error_msg - fi -done - -rm -f /dev/.in_sysinit - -# Strip apply time to the logs, strip out any color codes and dump -# the log to /var/log/boot.log -if [ -f "${TEMPFS_MOUNT}/.bootlog" -a "${runlevel}" != "S" ]; then - # Remove any color codes from the temp log file - sed -i 's@\\033\[[0-9];[0-9][0-9]m@@g' "${TEMPFS_MOUNT}/.bootlog" - #Fix the time and hostname - BTIMESPEC=$(echo `date -u +"%b %d %T"` `hostname`) - sed -i "s@^bootlog:@${BTIMESPEC} bootlog:@" "${TEMPFS_MOUNT}/.bootlog" - # Don't try and write in 0 and 6, this is a 'boot' log - if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then - cat "${TEMPFS_MOUNT}/.bootlog" >> /var/log/boot.log - rm -f "${TEMPFS_MOUNT}/.bootlog" - fi -fi - -# End $RC_BASE/init.d/rc diff --git a/src/initscripts/core/reboot b/src/initscripts/core/reboot deleted file mode 100644 index 0de939aca..000000000 --- a/src/initscripts/core/reboot +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/reboot - -### BEGIN INIT INFO -# Provides: reboot -# Required-Start: -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: 6 -# Default-Stop: -# Short-Description: Reboots the system. -# Description: Reboots the System. -# X-LFS-Default-Start: -# X-LFS-Default-Stop: S99 -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - stop) - log_success_msg "Restarting system..." - reboot -d -f -i - ;; - - *) - echo "Usage: ${0} {stop}" - exit 1 - ;; - -esac - -# End /etc/init.d/reboot diff --git a/src/initscripts/core/sendsignals b/src/initscripts/core/sendsignals deleted file mode 100644 index e48e19fb7..000000000 --- a/src/initscripts/core/sendsignals +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/sendsignals - -### BEGIN INIT INFO -# Provides: sendsignals -# Required-Start: -# Should-Start: -# Required-Stop: $local_fs swap localnet -# Should-Stop: -# Default-Start: -# Default-Stop: 0 6 -# Short-Description: Attempts to kill remaining processes. -# Description: Attempts to kill remaining processes. -# X-LFS-Default-Start: -# X-LFS-Default-Stop: S60 -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - stop) - message="Sending all processes the TERM signal..." - killall5 -15 - error_value=${?} - - sleep 3 - - (exit ${error_value}) - evaluate_retval standard - - message="Sending all processes the KILL signal..." - killall5 -9 - error_value=${?} - - sleep 3 - - (exit ${error_value}) - evaluate_retval standard - ;; - - *) - echo "Usage: ${0} {stop}" - exit 1 - ;; - -esac - -# End /etc/init.d/sendsignals diff --git a/src/initscripts/core/setclock b/src/initscripts/core/setclock deleted file mode 100644 index 6bfa12592..000000000 --- a/src/initscripts/core/setclock +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/setclock - -### BEGIN INIT INFO -# Provides: $time -# Required-Start: -# Should-Start: modules -# Required-Stop: -# Should-Stop: $syslog -# Default-Start: -# Default-Stop: -# Short-Description: Stores and restores time from the hardware clock -# Description: On boot, system time is obtained from hwclock. The -# hardware clock can also be set on shutdown. -# X-LFS-Default-Start: S25 -# X-LFS-Default-Stop: K46 -# X-LFS-Provided-By: LFS BLFS -### END INIT INFO - -. /lib/lsb/init-functions - -BIN_FILE="/sbin/hwclock" -CONFIGFILE="/etc/sysconfig/clock" - -chk_stat - -. "${CONFIGFILE}" - -CLOCKPARAMS= - -case "${UTC}" in - yes|true|1) - CLOCKPARAMS="${CLOCKPARAMS} --utc" - ;; - - no|false|0) - CLOCKPARAMS="${CLOCKPARAMS} --localtime" - ;; - -esac - -case ${1} in - start) - message="Setting system clock..." - ${BIN_FILE} --hctosys ${CLOCKPARAMS} >/dev/null - evaluate_retval standard - ;; - - stop) - message="Setting hardware clock..." - ${BIN_FILE} --systohc ${CLOCKPARAMS} >/dev/null - evaluate_retval standard - ;; - - *) - echo "Usage: ${0} {start|stop}" - ;; - -esac - -# End /etc/init.d/setclock diff --git a/src/initscripts/core/swap b/src/initscripts/core/swap deleted file mode 100644 index d62702848..000000000 --- a/src/initscripts/core/swap +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/swap - -### BEGIN INIT INFO -# Provides: swap -# Required-Start: -# Should-Start: modules -# Required-Stop: localnet -# Should-Stop: -# Default-Start: S -# Default-Stop: 0 6 -# Short-Description: Mounts and unmounts swap partitions. -# Description: Mounts and unmounts swap partitions defined in -# /etc/fstab. -# X-LFS-Default-Start: S20 -# X-LFS-Default-Stop: S80 -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - start) - message="Activating all swap files/partitions..." - swapon -a - evaluate_retval standard - ;; - - stop) - message="Deactivating all swap files/partitions..." - swapoff -a - evaluate_retval standard - ;; - - restart) - swapoff -a - error_level="${?}" - sleep 1 - swapon -a - error_level="$(( ${error_level} + ${?} ))" - (exit "${error_level}") - evaluate_retval restart - ;; - - status) - log_success_msg "Retrieving swap status..." - echo - swapon -s - ;; - - *) - echo "Usage: ${0} {start|stop|restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/swap diff --git a/src/initscripts/core/swap.conf b/src/initscripts/core/swap.conf new file mode 100644 index 000000000..1f5a7a57f --- /dev/null +++ b/src/initscripts/core/swap.conf @@ -0,0 +1,15 @@ +description "Activating swap partitions" +author "IPFire Team" + +start on stopped checkfs + +console output + +script + set -e + . /etc/init/functions + + MESSAGE="Activating all swap files/partitions..." + swapon -a + evaluate_retval standard +end script diff --git a/src/initscripts/core/sysctl b/src/initscripts/core/sysctl deleted file mode 100644 index b0867cf16..000000000 --- a/src/initscripts/core/sysctl +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/sysctl - -### BEGIN INIT INFO -# Provides: sysctl -# Required-Start: mountkernfs -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Makes changes to the proc filesystem -# Description: Makes changes to the proc filesystem as defined in -# /etc/sysctl.conf. See 'man sysctl(8)'. -# X-LFS-Default-Start: S05 -# X-LFS-Default-Stop: -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - start) - if [ -f "/etc/sysctl.conf" ]; then - message="Setting kernel runtime parameters..." - sysctl -q -p - evaluate_retval standard - fi - if [ -d "/proc/sys/kernel/grsecurity" -a \ - -f "/etc/grsec/sysctl.conf" ]; then - message="Setting grsecurity parameters..." - sysctl -q -p /etc/grsec/sysctl.conf - evaluate_retval standard - fi - ;; - - status) - sysctl -a - ;; - - *) - echo "Usage: ${0} {start|status}" - exit 1 - ;; -esac - -# End /etc/init.d/sysctl diff --git a/src/initscripts/core/sysctl.conf b/src/initscripts/core/sysctl.conf new file mode 100644 index 000000000..af2d33c14 --- /dev/null +++ b/src/initscripts/core/sysctl.conf @@ -0,0 +1,23 @@ +description "Set sysctl settings" +author "IPFire Team" + +start on stopped mount-kernel-filesystems + +console output + +script + set -e + . /etc/init/functions + + if [ -f "/etc/sysctl.conf" ]; then + message="Setting kernel runtime parameters..." + sysctl -q -p + evaluate_retval standard + fi + if [ -d "/proc/sys/kernel/grsecurity" -a \ + -f "/etc/grsec/sysctl.conf" ]; then + message="Setting grsecurity parameters..." + sysctl -q -p /etc/grsec/sysctl.conf + evaluate_retval standard + fi +end script diff --git a/src/initscripts/core/template b/src/initscripts/core/template deleted file mode 100644 index 24a9e7f93..000000000 --- a/src/initscripts/core/template +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/template - -### BEGIN INIT INFO -# Provides: template -# Required-Start: -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: -# Default-Stop: -# Short-Description: -# Description: -# X-LFS-Default-Start: -# X-LFS-Default-Stop: -# X-LFS-Provided-By: -### END INIT INFO - -# Source the LSB init-functions, ours are pulled in from there. -. /lib/lsb/init-functions - -# These are optional, but required for chk_stat. They will be used in -# the rest of the functions if defined, else you must provide a program -# name to control, and a message ('Starting Template Service...' -# or 'Stoping Template Service...') to evauate_retval. See the -# documentaion in the lfs-fucntions file for more information. -MESSAGE="Template Service" -BIN_FILE="/some/path/to/template" -CONFIGFILE="/etc/sysconfig/template.conf" - -# check that $BIN_FILE exists and is executable, and $CONFIGFILE exists. -chk_stat - -# LSB Defined functions require that at least $BIN_FILE be passed to them, -# where as lfs-functions will use the $BIN_FILE environment variable. -# loadproc() and endproc() are just wrappers that pass everything on to -# the LSB defined functions. - -case "${1}" in - start) - #start_daemon "${BIN_FILE}" -arg1 -arg2 #... or: - loadproc -arg1 -arg2 -arg3 #... - evaluate_retval start - ;; - - stop) - #killproc -TERM "${BIN_FILE}" or: - endproc - evaluate_retval stop - ;; - - force-reload) - reloadproc -force - evaluate_retval force-reload - ;; - - restart) - $0 stop - $0 start - ;; - - status) - statusproc - ;; - -# reload and try-restart are optional per LSB requirements - reload) - reloadproc - evaluate_retval reload - ;; - - try-restart) - # Since this is optional there is no lfs-function for this one... - # might be at a later time if used enough, but I doubt it usefullness. - pidofproc "${BIN_FILE}" > /dev/null - if [ "${?}" -ne "0" ]; then - MESSAGE="${MESSAGE}: Not Running" - else - $0 stop - $0 start - exit 0 - fi - evaluate_retval try-restart - ;; - - *) - echo "Usage: ${0} {start|stop|{force-}reload|{try-}restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/template diff --git a/src/upstart/tty1.conf b/src/initscripts/core/tty1.conf similarity index 85% rename from src/upstart/tty1.conf rename to src/initscripts/core/tty1.conf index 35744dc0f..f3bd6d9b6 100644 --- a/src/upstart/tty1.conf +++ b/src/initscripts/core/tty1.conf @@ -3,9 +3,8 @@ # This service maintains a getty on tty1 from the point the system is # started until it is shut down again. -start on started udevtrigger +start on stopped mountfs stop on shutdown - respawn exec /sbin/agetty 9600 tty1 diff --git a/src/upstart/tty2.conf b/src/initscripts/core/tty2.conf similarity index 85% rename from src/upstart/tty2.conf rename to src/initscripts/core/tty2.conf index 2cd0c9b04..fbcf7ae24 100644 --- a/src/upstart/tty2.conf +++ b/src/initscripts/core/tty2.conf @@ -3,9 +3,8 @@ # This service maintains a getty on tty2 from the point the system is # started until it is shut down again. -start on started udevtrigger +start on stopped mountfs stop on shutdown - respawn exec /sbin/agetty 9600 tty2 diff --git a/src/upstart/tty3.conf b/src/initscripts/core/tty3.conf similarity index 85% rename from src/upstart/tty3.conf rename to src/initscripts/core/tty3.conf index 57ced1f8b..506865ea8 100644 --- a/src/upstart/tty3.conf +++ b/src/initscripts/core/tty3.conf @@ -3,9 +3,8 @@ # This service maintains a getty on tty3 from the point the system is # started until it is shut down again. -start on started udevtrigger +start on stopped mountfs stop on shutdown - respawn exec /sbin/agetty 9600 tty3 diff --git a/src/upstart/tty4.conf b/src/initscripts/core/tty4.conf similarity index 86% rename from src/upstart/tty4.conf rename to src/initscripts/core/tty4.conf index ad59f50f4..0e6c36c7c 100644 --- a/src/upstart/tty4.conf +++ b/src/initscripts/core/tty4.conf @@ -3,7 +3,7 @@ # This service maintains a getty on tty4 from the point the system is # started until it is shut down again. -start on started udevtrigger +start on stopped mountfs stop on shutdown respawn diff --git a/src/upstart/tty5.conf b/src/initscripts/core/tty5.conf similarity index 86% rename from src/upstart/tty5.conf rename to src/initscripts/core/tty5.conf index 1378112fa..9a7d34846 100644 --- a/src/upstart/tty5.conf +++ b/src/initscripts/core/tty5.conf @@ -3,7 +3,7 @@ # This service maintains a getty on tty5 from the point the system is # started until it is shut down again. -start on started udevtrigger +start on stopped mountfs stop on shutdown respawn diff --git a/src/upstart/tty6.conf b/src/initscripts/core/tty6.conf similarity index 68% rename from src/upstart/tty6.conf rename to src/initscripts/core/tty6.conf index 6de2828f4..5901d0649 100644 --- a/src/upstart/tty6.conf +++ b/src/initscripts/core/tty6.conf @@ -3,12 +3,8 @@ # This service maintains a getty on tty6 from the point the system is # started until it is shut down again. -start on started udevtrigger +start on stopped mountfs stop on shutdown -pre-start script - echo " TTY6 starting...." -end script - respawn exec /sbin/agetty 9600 tty6 diff --git a/src/initscripts/core/udev b/src/initscripts/core/udev deleted file mode 100644 index 3e95f9cb3..000000000 --- a/src/initscripts/core/udev +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/udev - -### BEGIN INIT INFO -# Provides: udev -# Required-Start: -# Should-Start: modules -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Populated /dev with device nodes. -# Description: Mounts a tempfs on /dev and starts the udevd daemon. -# Device nodes are created as defined by udev. -# X-LFS-Default-Start: S15 -# X-LFS-Default-Stop: -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="Populating /dev with device nodes..." - -case "${1}" in - start) - if ! grep -q '[[:space:]]sysfs' /proc/mounts; then - echo_failure - boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE} - boot_mesg -n " devices without a SysFS filesystem" - boot_mesg -n "\n\nAfter you press Enter, this system" - boot_mesg -n " will be halted and powered off." - boot_mesg -n "\n\nPress Enter to continue..." ${INFO} - boot_mesg "" ${NORMAL} - read ENTER - /etc/rc.d/init.d/halt stop - fi - - # Mount a temporary file system over /dev, so that any devices - # made or removed during this boot don't affect the next one. - # The reason we don't write to mtab is because we don't ever - # want /dev to be unavailable (such as by `umount -a'). - mount -n -t tmpfs tmpfs /dev -o mode=755 - if [ ${?} != 0 ]; then - echo_failure - boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE} - boot_mesg -n " onto /dev, this system will be halted." - boot_mesg -n "\n\nAfter you press Enter, this system" - boot_mesg -n " will be halted and powered off." - boot_mesg -n "\n\nPress Enter to continue..." ${INFO} - boot_mesg "" ${NORMAL} - read ENTER - /etc/rc.d/init.d/halt stop - fi - - # Udev handles uevents itself, so we don't need to have - # the kernel call out to any binary in response to them - echo > /proc/sys/kernel/hotplug - - # Copy static device nodes to /dev - cp -a /lib/udev/devices/* /dev - - # Start the udev daemon to continually watch for, and act on, - # uevents - /sbin/udevd --daemon - - # Now traverse /sys in order to "coldplug" devices that have - # already been discovered - /sbin/udevadm trigger - - # Now wait for udevd to process the uevents we triggered - /sbin/udevadm settle - evaluate_retval standard - ;; - - *) - echo "Usage ${0} {start}" - exit 1 - ;; -esac - -# End $rc_base/init.d/udev diff --git a/src/initscripts/core/udev.conf b/src/initscripts/core/udev.conf new file mode 100644 index 000000000..f22b92479 --- /dev/null +++ b/src/initscripts/core/udev.conf @@ -0,0 +1,32 @@ +description "Start Udev Daemon" +author "IPFire Team" + +start on stopped mount-kernel-filesystems + +emits block-device-added block-device-removed +emits network-device-added network-device-removed + +console output + +pre-start script + # Mount a temporary file system over /dev, so that any devices + # made or removed during this boot don't affect the next one. + # The reason we don't write to mtab is because we don't ever + # want /dev to be unavailable (such as by `umount -a'). + mount -n -t tmpfs tmpfs /dev -o mode=755 + + # Udev handles uevents itself, so we don't need to have + # the kernel call out to any binary in response to them + echo > /proc/sys/kernel/hotplug + + # Copy static device nodes to /dev + cp -a /lib/udev/devices/* /dev +end script + +respawn +exec /sbin/udevd + +post-start script + . /etc/init/functions + log_success_msg "Starting udev Daemon..." +end script diff --git a/src/initscripts/core/udev_retry b/src/initscripts/core/udev_retry deleted file mode 100644 index df70132eb..000000000 --- a/src/initscripts/core/udev_retry +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/udev_retry - -### BEGIN INIT INFO -# Provides: udev_retry -# Required-Start: udev -# Should-Start: $local_fs -# Required-Stop: -# Should-Stop: -# Default-Start: S -# Default-Stop: -# Short-Description: Replays failed uevents and creates additonal devices. -# Description: Replays any failed uevents that were skipped due to -# slow hardware initialization, and creates those needed -# device nodes -# X-LFS-Default-Start: S45 -# X-LFS-Default-Stop: -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="Retrying failed uevents, if any..." - -case "${1}" in - start) - - # From Debian: "copy the rules generated before / was mounted - # read-write": - for file in /dev/.udev/tmp-rules--*; do - dest=${file##*tmp-rules--} - [ "$dest" = '*' ] && break - cat $file >> /etc/udev/rules.d/$dest - rm -f $file - done - - # Re-trigger the failed uevents in hope they will succeed now - /sbin/udevadm trigger --retry-failed - - # Now wait for udevd to process the uevents we triggered - /sbin/udevadm settle - evaluate_retval standard - ;; - - *) - echo "Usage ${0} {start}" - exit 1 - ;; -esac - -# End $rc_base/init.d/udev_retry diff --git a/src/initscripts/core/udevtrigger.conf b/src/initscripts/core/udevtrigger.conf new file mode 100644 index 000000000..cfa5eb129 --- /dev/null +++ b/src/initscripts/core/udevtrigger.conf @@ -0,0 +1,21 @@ +description "Trigger udev events" +author "IPFire Team" + +start on started udev + +console output + +script + set -e + . /etc/init/functions + + MESSAGE="Populating /dev with device nodes..." + + # Now traverse /sys in order to "coldplug" devices that have + # already been discovered + udevadm trigger + + # Now wait for udevd to process the uevents we triggered + udevadm settle --timeout=5 || true + evaluate_retval standard +end script diff --git a/src/initscripts/core/welcome.conf b/src/initscripts/core/welcome.conf new file mode 100644 index 000000000..37ca7eb3c --- /dev/null +++ b/src/initscripts/core/welcome.conf @@ -0,0 +1,24 @@ +description "Display a welcome message to the user" +author "IPFire Team" + +start on startup + +console output + +script + . /etc/init/functions + + # dcol are spaces before the message to center the + # message on screen. + dcol=$(( $(( ${COLUMNS} - ${welcome_message_length} )) / 2 )) + echo -e "\\033[${dcol}G${welcome_message}" + + system_message=$(uname -r) + system_message_length=${#system_message} + system_message="Running on Linux ${FAILURE}${system_message}${NORMAL}" + system_message_length=$((17 + ${system_message_length})) + dcol=$(( $(( ${COLUMNS} - ${system_message_length} )) / 2 )) + echo -e "\\033[${dcol}G${system_message}" + + echo "" +end script diff --git a/src/initscripts/etc/lsb-config b/src/initscripts/etc/lsb-config deleted file mode 100644 index c77e420ab..000000000 --- a/src/initscripts/etc/lsb-config +++ /dev/null @@ -1,7 +0,0 @@ -# Begin /etc/lsb/lsb-config - -rcbase="/etc/init.d" -statedir="/etc/lsb/state" -distro="IPFire" - -# End /etc/lsb/lsb-config diff --git a/src/initscripts/extras/alsa b/src/initscripts/extras/alsa deleted file mode 100644 index 5da0b2c8f..000000000 --- a/src/initscripts/extras/alsa +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/alsa - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org -# ALSA specific parts by Mark Hymers - markh@linuxfromscratch.org -# Stores mixer settings in the default location: /etc/asound.state - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting ALSA... Restoring volumes..." - modprobe snd_pcm_oss >/dev/null 2>&1 || failed=1 - modprobe snd_mixer_oss >/dev/null 2>&1 || failed=1 - (exit ${failed}) - evaluate_retval - loadproc /usr/sbin/alsactl restore - ;; - stop) - boot_mesg "Stopping ALSA... Saving volumes..." - loadproc /usr/sbin/alsactl store - ;; - - *) - echo "Usage: $0 (start|stop)" - exit 1 - ;; -esac - -# End $rc_base/init.d/alsa diff --git a/src/initscripts/extras/asterisk b/src/initscripts/extras/asterisk deleted file mode 100644 index 223c01688..000000000 --- a/src/initscripts/extras/asterisk +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/asterisk -# -# Description : Asterisk Script -# -# Authors : Michael Tremer (mitch@ipfire.org) -# -# Version : 01.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -case "${1}" in - start) - boot_mesg "Starting Asterisk PBX..." - loadproc /usr/sbin/asterisk - ;; - - stop) - boot_mesg "Stopping Asterisk PBX..." - asterisk -rx "stop gracefully" >/dev/null 2>&1 - evaluate_retval - ;; - - reload) - boot_mesg "Reloading Asterisk PBX..." - asterisk -rx "reload" >/dev/null 2>&1 - evaluate_retval - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - status) - statusproc /usr/sbin/asterisk - ;; - - *) - echo "Usage: ${0} {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/asterisk diff --git a/src/initscripts/extras/clamav b/src/initscripts/extras/clamav deleted file mode 100644 index 1eb499ae2..000000000 --- a/src/initscripts/extras/clamav +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/clamav - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting Clamav Definition Updater..." - loadproc /usr/bin/freshclam -d -c 10 - - boot_mesg "Starting Clamav Daemon..." - COUNTER=0 - while [ "$COUNTER" -lt "10" ]; do - [ -e "/usr/share/clamav/main.cvd" ] && \ - [ -e "/usr/share/clamav/daily.cvd" ] && \ - break - sleep 5 - COUNTER=$(($COUNTER + 1)) - done - loadproc /usr/sbin/clamd - ;; - - stop) - boot_mesg "Stopping Clamav Definition Updater..." - killproc /usr/bin/freshclam - - boot_mesg "Stopping Clamav Daemon..." - killproc /usr/sbin/clamd - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/clamd - statusproc /usr/bin/freshclam - ;; - - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/clamav diff --git a/src/initscripts/extras/cups b/src/initscripts/extras/cups deleted file mode 100644 index 1e6f8ea64..000000000 --- a/src/initscripts/extras/cups +++ /dev/null @@ -1,44 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/cups - -#$LastChangedBy: bdubbs $ -#$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $ - -# Start or stop the CUPS server based upon the first argument to the script. - -. /etc/sysconfig/rc -. $rc_functions - -case $1 in - start) - boot_mesg "Starting CUPS Printserver..." - loadproc /usr/sbin/cupsd - ;; - - stop) - boot_mesg "Stopping CUPS Printserver..." - killproc /usr/sbin/cupsd - ;; - - reload) - boot_mesg "Reloading CUPS Printserver..." - reloadproc /usr/sbin/cupsd - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/cupsd - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/cups diff --git a/src/initscripts/extras/cyrus-imapd b/src/initscripts/extras/cyrus-imapd deleted file mode 100644 index 2f849c8a8..000000000 --- a/src/initscripts/extras/cyrus-imapd +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/cyrus-imapd - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting the Cyrus IMAP Server..." - /usr/lib/cyrus/master & - evaluate_retval - ;; - - stop) - boot_mesg "Stopping the Cyrus IMAP Server..." - killproc /usr/lib/cyrus/master - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/lib/cyrus/master - ;; - - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/cyrus-imapd diff --git a/src/initscripts/extras/cyrus-sasl b/src/initscripts/extras/cyrus-sasl deleted file mode 100644 index 31d31471d..000000000 --- a/src/initscripts/extras/cyrus-sasl +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/cyrus-sasl - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org - -#$LastChangedBy: bdubbs $ -#$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $ - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting the Cyrus SASL Server..." - loadproc /usr/sbin/saslauthd -n 2 -a pam - ;; - - stop) - boot_mesg "Stopping the Cyrus SASL Server..." - killproc /usr/sbin/saslauthd - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/saslauthd - ;; - - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/cyrus-sasl diff --git a/src/initscripts/extras/dhcp b/src/initscripts/extras/dhcp deleted file mode 100644 index 02c345290..000000000 --- a/src/initscripts/extras/dhcp +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/dhcp - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org -# Modified for IPFire by Michael Tremer - mitch@ipfire.org - -. /etc/sysconfig/rc -. $rc_functions -eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) - -case "$1" in - start) - iptables -F DHCPBLUEINPUT - if [ -e /var/ipfire/dhcp/enable_green ]; then - devices="${GREEN_DEV}" - fi - if [ -e /var/ipfire/dhcp/enable_blue ]; then - devices+=" ${BLUE_DEV}" - - iptables -A DHCPBLUEINPUT -p tcp --source-port 68 --destination-port 67 -i ${BLUE_DEV} -j ACCEPT > /dev/null 2>&1 - iptables -A DHCPBLUEINPUT -p udp --source-port 68 --destination-port 67 -i ${BLUE_DEV} -j ACCEPT > /dev/null 2>&1 - fi - - boot_mesg "Starting DHCP Server..." - loadproc /usr/sbin/dhcpd -q ${devices} - - (sleep 5 && chmod 644 /var/run/dhcpd.pid) & # Fix because silly dhcpd creates its pid with mode 640 - ;; - - stop) - boot_mesg "Stopping DHCP Server..." - killproc -p /var/run/dhcpd.pid /usr/sbin/dhcpd - ;; - - reload) - boot_mesg "Reloading DHCP Server..." - reloadproc /usr/sbin/dhcpd - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/dhcpd - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/dhcp diff --git a/src/initscripts/extras/fcron b/src/initscripts/extras/fcron deleted file mode 100644 index 9dfba992d..000000000 --- a/src/initscripts/extras/fcron +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/fcron - -### BEGIN INIT INFO -# Provides: fcron -# Required-Start: $syslog -# Should-Start: -# Required-Stop: $syslog -# Should-Stop: -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Starts fcron. -# Description: Starts the fcron daemon. -# X-LFS-Default-Start: S40 -# X-LFS-Default-Stop: K08 -# X-LFS-Provided-By: -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="F-Cron Daemon" -BIN_FILE="/usr/sbin/fcron" -PIDFILE="/var/run/fcron.pid" - -chk_stat - -case "$1" in - start) - start_daemon -p "${PIDFILE}" "${BIN_FILE}" - evaluate_retval start - ;; - - stop) - killproc -p "${PIDFILE}" "${BIN_FILE}" - evaluate_retval stop - ;; - - restart) - killproc -p "${PIDFILE}" "$BIN_FILE" - sleep 1 - start_daemon -p "${PIDFILE}" "${BIN_FILE}" - evaluate_retval restart - ;; - - status) - statusproc -p "${PIDFILE}" "${BIN_FILE}" - ;; - - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/fcron diff --git a/src/initscripts/extras/fetchmail b/src/initscripts/extras/fetchmail deleted file mode 100644 index 6084934dc..000000000 --- a/src/initscripts/extras/fetchmail +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/fetchmail -# -# Description : Fetchmail Init Script -# -# Authors : Michael Tremer (ms@ipfire.org) -# -# Version : 01.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -case "${1}" in - start) - boot_mesg "Starting fetchmail daemon..." - /usr/bin/fetchmail --daemon 300 >/dev/null 2>&1 - evaluate_retval - ;; - - stop) - boot_mesg "Stopping fetchmail daemon..." - killproc /usr/bin/fetchmail - ;; - - reload) - boot_mesg "Reloading fetchmail daemon..." - reloadproc /usr/bin/fetchmail - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - status) - statusproc /usr/bin/fetchmail - ;; - - *) - echo "Usage: ${0} {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/fetchmail diff --git a/src/initscripts/extras/firewall b/src/initscripts/extras/firewall deleted file mode 100644 index 62bac34bc..000000000 --- a/src/initscripts/extras/firewall +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/firewall - -### BEGIN INIT INFO -# Provides: firewall -# Required-Start: $network -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: IPFire Firewall Engine. -# Description: This controls the IPFire Firewall Engine. -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="IPFire Firewall" -BIN_FILE="/usr/bin/firewall" - -chk_stat - -case "$1" in - start) - ${BIN_FILE} start - evaluate_retval start - touch /var/lock/subsys/firewall - ;; - - stop) - ${BIN_FILE} stop - evaluate_retval stop - rm -f /var/lock/subsys/firewall - ;; - - restart) - ${BIN_FILE} restart - evaluate_retval restart - ;; - - reload) - ${BIN_FILE} reload - evaluate_retval reload - ;; - - *) - echo " Usage: ${0}{start|stop|restart|reload}" - if [ "${1}" = "status" -o "${1}" = "try-restart" ] - then - echo " Error: Unimplemented function '${1}'" - exit 3 - else - exit 2 - fi - ;; - -esac - -# End /etc/init.d/firewall diff --git a/src/initscripts/extras/gnump3d b/src/initscripts/extras/gnump3d deleted file mode 100644 index f1dac3aa2..000000000 --- a/src/initscripts/extras/gnump3d +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/gnump3d -# -# Description : GNUMP3d Init Script -# -# Authors : Michael Tremer (ms@ipfire.org) -# -# Version : 01.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -case "${1}" in - start) - boot_mesg "Starting GNUMP3d Server..." - /usr/bin/gnump3d --background --fast >/dev/null 2>&1 - evaluate_retval - ;; - - stop) - boot_mesg "Stopping GNUMP3d Server..." - killproc /usr/bin/gnump3d - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - status) - statusproc /usr/bin/gnump3d - ;; - - *) - echo "Usage: ${0} {start|stop|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/gnump3d diff --git a/src/initscripts/extras/haldaemon b/src/initscripts/extras/haldaemon deleted file mode 100644 index 3b0ecb574..000000000 --- a/src/initscripts/extras/haldaemon +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/haldaemon - -### BEGIN INIT INFO -# Provides: haldaemon -# Required-Start: messagebus -# Should-Start: $syslog -# Required-Stop: messagebus -# Should-Stop: $syslog -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Hardware abstraction layer daemon. -# Description: Starts the hardware abstraction layer daemon. -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="HAL Daemon" -BIN_FILE="/usr/sbin/hald" - -pidfile=/var/run/hald/pid - -chk_stat - -case "${1}" in - start) - start_daemon -p ${pidfile} "${BIN_FILE}" --use-syslog - evaluate_retval start - ;; - - stop) - killproc -p ${pidfile} "${BIN_FILE}" - evaluate_retval stop - ;; - - force-reload) - reloadproc -force - evaluate_retval force-reload - ;; - - restart) - $0 stop - $0 start - ;; - - status) - statusproc -p ${pidfile} - ;; - - reload) - reloadproc - evaluate_retval reload - ;; - - try-restart) - pidofproc "${BIN_FILE}" > /dev/null - if [ "${?}" -ne "0" ]; then - MESSAGE="${MESSAGE}: Not Running" - else - $0 stop - $0 start - exit 0 - fi - evaluate_retval try-restart - ;; - - *) - echo "Usage: ${0} {start|stop|{force-}reload|{try-}restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/haldaemon diff --git a/src/initscripts/extras/lighttpd b/src/initscripts/extras/lighttpd deleted file mode 100644 index 747341061..000000000 --- a/src/initscripts/extras/lighttpd +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/lighttpd - -### BEGIN INIT INFO -# Provides: lighttpd -# Required-Start: $local_fs $network -# Should-Start: -# Required-Stop: $local_fs $network -# Should-Stop: netfs -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Starts the lighttpd daemon. -# Description: Starts the lighttpd daemon -# which is the system's webserver. -# X-LFS-Default-Start: -# X-LFS-Default-Stop: -# X-LFS-Provided-By: -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="Lighttpd Daemon" -BIN_FILE="/usr/sbin/lighttpd" -CONFIGFILE="/etc/lighttpd.conf" - -chk_stat - -case "${1}" in - start) - loadproc -f $CONFIGFILE - evaluate_retval start - ;; - - stop) - endproc - evaluate_retval stop - ;; - - force-reload) - reloadproc -force - evaluate_retval force-reload - ;; - - restart) - $0 stop - $0 start - ;; - - status) - statusproc - ;; - - reload) - reloadproc - evaluate_retval reload - ;; - - *) - echo "Usage: ${0} {start|stop|{force-}reload|restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/lighttpd diff --git a/src/initscripts/extras/mISDN b/src/initscripts/extras/mISDN deleted file mode 100644 index bbe054a0a..000000000 --- a/src/initscripts/extras/mISDN +++ /dev/null @@ -1,475 +0,0 @@ -#!/bin/bash - -#---------------------------------------------- -# -# CONFIGURATION: -# -MISDN_CONF="/etc/mISDN.conf" -MISDN_CONF_XSL="/usr/lib/mISDN/mISDN.conf.xsl" -# -#---------------------------------------------- - -SELF="${0}" -USAGE="Usage: ${SELF} start|stop|restart|config|scan|help" - -function die { - echo "[!!] ${1}" - exit 1 -} - -function check_cmd -{ - if ! type -p "${1}" > /dev/null; then - if [ "${2}" = "opt" ]; then - return - fi - if [ "$(id -u)" != "0" ]; then - die "$1 not in path, please install and/or be root." - else - die "$1 not in path, please install." - fi - exit 1 - else - local var=$(echo ${1} | tr a-z A-Z) - eval "$var=`type -p ${1}`" - fi -} - -function check_misdn_conf -{ - if [ ! -f ${MISDN_CONF} ]; then - die "${MISDN_CONF} not found. Please run: ${SELF} config" - fi -} - -check_cmd sed -check_cmd cut -check_cmd cp -check_cmd wc -check_cmd grep -check_cmd xsltproc -check_cmd modprobe -check_cmd sleep -check_cmd lspci -check_cmd lsusb opt -check_cmd mknod -check_cmd chown -check_cmd chmod - -declare -a START_COMMANDS -declare -a STOP_COMMANDS - -declare -a HFCMULTI_card -declare -a HFCMULTI_type -declare -a HFCMULTI_protocol -declare -a HFCMULTI_layermask -HFCMULTI_options='' -MISDNDSP_options='' -L1OIP_options='' - -AVMFRITZ_protocol='' -AVMFRITZ_layermask='' - -HFCPCI_protocol='' -HFCPCI_layermask='' - -L1OIP_type='' -L1OIP_protocol='' -L1OIP_layermask='' -L1OIP_codec='' -L1OIP_ip='' -L1OIP_port='' -L1OIP_localport='' -L1OIP_ondemand='' -L1OIP_id='' - -DEVNODE_user='root' -DEVNODE_group='root' -DEVNODE_mode='0644' - -declare -a SCAN_card -declare -a SCAN_opts -declare -a SCAN_num_ports -declare -a SCAN_port_opts - -function parse_config -{ - local CONFIG=$(${XSLTPROC} ${MISDN_CONF_XSL} ${MISDN_CONF}) - local t p l line i tmpcmd curr tmpstr val - local IFS=$'\n' - - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install capi" - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install mISDN_core debug=0" - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install mISDN_l1 debug=0" - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install mISDN_l2 debug=0" - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install l3udss1 debug=0" - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install mISDN_capi" - - for line in ${CONFIG}; do - case "${line}" in - DEVNODE:mISDN*) - tmpstr=$(echo ${line} | ${SED} -n 's/.*user:\([^ ]*\).*/\1/p') - if [ ! -z "${tmpstr}" ]; then - DEVNODE_user="${tmpstr}" - fi - tmpstr=$(echo ${line} | ${SED} -n 's/.*group:\([^ ]*\).*/\1/p') - if [ ! -z "${tmpstr}" ]; then - DEVNODE_group="${tmpstr}" - fi - tmpstr=$(echo ${line} | ${SED} -n 's/.*mode:\([^ ]*\).*/\1/p') - if [ ! -z "${tmpstr}" ]; then - DEVNODE_mode="${tmpstr}" - fi - ;; - MODULE:hfcmulti*) - HFCMULTI_options=${line:16} - ;; - MODULE:mISDN_dsp*) - MISDNDSP_options=${line:17} - ;; - MODULE:l1oip*) - L1OIP_options=${line:13} - ;; - CARD:BN*) - curr='hfcmulti' - i=${#HFCMULTI_type[@]} - let "t = $(echo ${line} | ${SED} -n 's/.*type:\([^,]*\).*/\1/p')" - HFCMULTI_type[${i}]=$(printf "0x%x" ${t}) - -# this is for the BN2E1 card that needs two type numbers - t=$(echo ${line} | ${SED} -n 's/.*type:[^,]*,\([^ ]*\).*/\1/p') - if [ ! -z "${t}" ]; then - let "t = ${t}" - HFCMULTI_type[${i}]="${HFCMULTI_type[${i}]},$(printf "0x%x" ${t})" - fi - - HFCMULTI_card[${i}]=$(echo ${line:5} | ${CUT} -d" " -f1) - ;; - CARD:hfcpci*) - curr='hfcpci' - ;; - CARD:avmfritz*) - curr='avmfritz' - ;; - CARD:l1oip*) - curr='l1oip' - ;; - PORT*) - case "${curr}" in - hfcmulti) - let "p = $(echo ${line} | ${SED} -n 's/.*protocol:\([^ ]*\).*/\1/p')" - HFCMULTI_protocol[${i}]="${HFCMULTI_protocol[${i}]:+"${HFCMULTI_protocol[${i}]},"}$(printf "0x%x" ${p})" - let "l = $(echo ${line} | ${SED} -n 's/.*layermask:\([^ ]*\).*/\1/p')" - HFCMULTI_layermask[${i}]="${HFCMULTI_layermask[${i}]:+"${HFCMULTI_layermask[${i}]},"}$(printf "0x%x" ${l})" - ;; - hfcpci) - let "p = $(echo ${line} | ${SED} -n 's/.*protocol:\([^ ]*\).*/\1/p')" - HFCPCI_protocol="${HFCPCI_protocol:+"${HFCPCI_protocol},"}$(printf "0x%x" ${p})" - let "l = $(echo ${line} | ${SED} -n 's/.*layermask:\([^ ]*\).*/\1/p')" - HFCPCI_layermask="${HFCPCI_layermask:+"${HFCPCI_layermask},"}$(printf "0x%x" ${l})" - ;; - avmfritz) - let "p = $(echo ${line} | ${SED} -n 's/.*protocol:\([^ ]*\).*/\1/p')" - AVMFRITZ_protocol="${AVMFRITZ_protocol:+"${AVMFRITZ_protocol},"}$(printf "0x%x" ${p})" - let "l = $(echo ${line} | ${SED} -n 's/.*layermask:\([^ ]*\).*/\1/p')" - AVMFRITZ_layermask="${AVMFRITZ_layermask:+"${AVMFRITZ_layermask},"}$(printf "0x%x" ${l})" - ;; - l1oip) - let "val = $(echo ${line} | ${SED} -n 's/.*type:\([^ ]*\).*/\1/p')" - L1OIP_type="${L1OIP_type:+"${L1OIP_type},"}$(printf "0x%x" ${val})" - let "val = $(echo ${line} | ${SED} -n 's/.*protocol:\([^ ]*\).*/\1/p')" - L1OIP_protocol="${L1OIP_protocol:+"${L1OIP_protocol},"}$(printf "0x%x" ${val})" - let "val = $(echo ${line} | ${SED} -n 's/.*layermask:\([^ ]*\).*/\1/p')" - L1OIP_layermask="${L1OIP_layermask:+"${L1OIP_layermask},"}$(printf "0x%x" ${val})" - val="$(echo ${line} | ${SED} -n 's/.*codec:\([^ ]*\).*/\1/p')" - L1OIP_codec="${L1OIP_codec:+"${L1OIP_codec},"}${val}" - val="$(echo ${line} | ${SED} -n 's/.*ip:\([^ ]*\).*/\1/p')" - L1OIP_ip="${L1OIP_ip:+"${L1OIP_ip},"}${val}" - val="$(echo ${line} | ${SED} -n 's/.*port:\([^ ]*\).*/\1/p')" - L1OIP_port="${L1OIP_port:+"${L1OIP_port},"}${val}" - val="$(echo ${line} | ${SED} -n 's/.*localport:\([^ ]*\).*/\1/p')" - L1OIP_localport="${L1OIP_localport:+"${L1OIP_localport},"}${val}" - val="$(echo ${line} | ${SED} -n 's/.*ondemand:\([^ ]*\).*/\1/p')" - L1OIP_ondemand="${L1OIP_ondemand:+"${L1OIP_ondemand},"}${val}" - val="$(echo ${line} | ${SED} -n 's/.*id:\([^ ]*\).*/\1/p')" - L1OIP_id="${L1OIP_id:+"${L1OIP_id},"}${val}" - ;; - esac - ;; - esac - done - - if [ ! -z "${HFCMULTI_protocol[0]}" ]; then - tmpcmd="${MODPROBE} --ignore-install hfcmulti type=${HFCMULTI_type[0]}" - i=1 - while [ ! -z "${HFCMULTI_type[${i}]}" ]; do - tmpcmd="${tmpcmd},${HFCMULTI_type[${i}]}" - let "i = ${i} + 1" - done - tmpcmd="${tmpcmd} protocol=${HFCMULTI_protocol[0]}" - i=1 - while [ ! -z "${HFCMULTI_protocol[${i}]}" ]; do - tmpcmd="${tmpcmd},${HFCMULTI_protocol[${i}]}" - let "i = ${i} + 1" - done - tmpcmd="${tmpcmd} layermask=${HFCMULTI_layermask[0]}" - i=1 - while [ ! -z "${HFCMULTI_layermask[${i}]}" ]; do - tmpcmd="${tmpcmd},${HFCMULTI_layermask[${i}]}" - let "i = ${i} + 1" - done - START_COMMANDS[${#START_COMMANDS[@]}]="${tmpcmd} ${HFCMULTI_options}" - fi - - if [ ! -z "${HFCPCI_protocol}" ]; then - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install hfcpci protocol=${HFCPCI_protocol} layermask=${HFCPCI_layermask}" - fi - - if [ ! -z "${AVMFRITZ_protocol}" ]; then - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install avmfritz protocol=${AVMFRITZ_protocol} layermask=${AVMFRITZ_layermask}" - fi - - if [ ! -z "${L1OIP_type}" ]; then - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install l1oip type=${L1OIP_type} protocol=${L1OIP_protocol} layermask=${L1OIP_layermask} codec=${L1OIP_codec} ip=${L1OIP_ip} port=${L1OIP_port} localport=${L1OIP_localport} ondemand=${L1OIP_ondemand} id=${L1OIP_id} ${L1OIP_options}" - fi - - START_COMMANDS[${#START_COMMANDS[@]}]="${MODPROBE} --ignore-install mISDN_dsp ${MISDNDSP_options}" -} - -function run_start_commands -{ - local i=0 - - echo "-- Loading mISDN modules --" - while [ ! -z "${START_COMMANDS[${i}]}" ]; do - echo ">> ${START_COMMANDS[${i}]}" - eval "${START_COMMANDS[${i}]}" - let "i = ${i} + 1" - done -} - -function run_stop_commands -{ - local mod i=0 - - for mod in $(lsmod | ${SED} -ne '/Module/!{s/\([^ ]*\).*/\1/;p}'); do - case "${mod}" in - mISDN_capi | mISDN_dsp | l3udss1 | mISDN_l2 | mISDN_l1 | mISDN_isac | hfcmulti | avmfritz | l1oip) - STOP_COMMANDS[0]="${STOP_COMMANDS[0]:-"${MODPROBE} -r --ignore-remove"} ${mod}" - ;; - mISDN_core) - STOP_COMMANDS[1]="${MODPROBE} -r --ignore-remove mISDN_core" - ;; - esac - done - - echo "-- Unloading mISDN modules --" - while [ ! -z "${STOP_COMMANDS[${i}]}" ]; do - echo ">> ${STOP_COMMANDS[${i}]}" - eval "${STOP_COMMANDS[${i}]}" - let "i = ${i} + 1" - done -} - -function scan_devices -{ - local skipnext=0 IFS=$'\n' - local NL=" -" - - function addcard { - SCAN_card[${#SCAN_card[@]}]="${1}" - SCAN_opts[${#SCAN_opts[@]}]="${2}" - SCAN_num_ports[${#SCAN_num_ports[@]}]="${3}" - SCAN_port_opts[${#SCAN_port_opts[@]}]="${4}" - } - - for line in $(${LSPCI} -n -d 0xd161:b410); do - addcard "BN4S0" "" 4 'mode="te" link="ptmp"' - done - - for line in $(${LSPCI} -n | ${SED} -n 's/^\(0000:\|\)\([0-9a-f]\{2\}:[0-9a-f]\{2\}.[0-9a-f]\{1\}\)\( Class \| \)[0-9a-f]\{4\}: 1397:\([0-9a-f]\{4\}\).*$/\4 \2/p'); do - if [ ${skipnext} -eq 1 ]; then - skipnext=0 - continue - fi - case "${line}" in - 30b1*) - case "${line:5}" in - 00*) - addcard "BN1E1" "" 1 'mode="nt" link="ptp"' - ;; - *) - if [ $(${LSPCI} -n -s "${line:5:3}" | ${WC} -l) -eq 2 ]; then - addcard "BN2E1" "" 2 'mode="nt" link="ptp"' - skipnext=1 - else - addcard "BN1E1" "" 1 'mode="nt" link="ptp"' - fi - ;; - esac - ;; - 16b8*) - addcard "BN8S0" "" 8 'mode="te" link="ptmp"' - ;; - 08b4*) - if ${LSPCI} -n -v -s "${line:5}" | ${GREP} "Subsystem" | ${GREP} "1397:b567" > /dev/null ; then - addcard "BN1S0" "" 1 'mode="te" link="ptmp"' - elif ${LSPCI} -n -v -s "${line:5}" | ${GREP} "Subsystem" | ${GREP} "1397:b566\|1397:b569" > /dev/null ; then - addcard "BN2S0" "" 2 'mode="te" link="ptmp"' - else - addcard "BN4S0" "" 4 'mode="te" link="ptmp"' - fi - ;; - esac - done - for line in $(${LSPCI} -n | ${GREP} "1397:\(2bd\(0\|6\|7\|8\|9\|a\|b\|c\)\|b100\)\|1043:0675\|0871:ffa\(1\|2\)\|1051:0100\|15b0:2bd0\|114f:007\(0\|1\|2\|3\)\|13d1:2bd1\|182d:3069"); do - addcard "hfcpci" "" 1 'mode="te" link="ptmp"' - done - for line in $(${LSPCI} -n | ${GREP} "1244:\(0a00\|0e00\)"); do - addcard "avmfritz" "" 1 'mode="te" link="ptmp"' - done - for line in $(${LSPCI} -n -d 1050:6692); do - addcard "w6692pci" "" 1 'mode="te" link="ptmp"' - done - if [ -e ${LSUSB} ]; then - for line in $(${LSUSB} | ${GREP} "0959:2bd0\|0675:1688\|07b0:0007\|0742:200\(7\|8\|9\|A\)\|08e3:0301\|07fa:084\(7\|8\)\|07ba:0006"); do - addcard "hfcsusb" "" 1 'mode="te" link="ptmp"' - done - fi -} - -function write_mISDN_conf -{ - local NL=" -" - local TAB=" " - local HEADER=" - - -${TAB}hfcmulti -${TAB}mISDN_dsp -${TAB}mISDN" - local FOOTER="" - local i=0 j=0 MAIN="" - - echo "Writing ${MISDN_CONF} for ${#SCAN_card[@]} mISDN compatible device(s):" - while [ ! -z "${SCAN_card[${i}]}" ]; do - echo ">> ${SCAN_card[${i}]}" - MAIN="${MAIN}${NL}${TAB}" - j=1 - while [ ${j} -le ${SCAN_num_ports[${i}]} ]; do - MAIN="${MAIN}${NL}${TAB}${TAB}${j}" - let "j = ${j} + 1" - done - MAIN="${MAIN}${NL}${TAB}" - let "i = ${i} + 1" - done - - if [ -f ${MISDN_CONF} ]; then - echo "${MISDN_CONF} already present, saving a backup: ${MISDN_CONF}.bak" - ${CP} "${MISDN_CONF}" "${MISDN_CONF}.bak" || die "Could not backup your existing ${MISDN_CONF}!" - fi - echo "${HEADER}${MAIN}${NL}${FOOTER}" > ${MISDN_CONF} -} - -function print_scan_results -{ - local i=0 - - echo "${#SCAN_card[@]} mISDN compatible device(s) found:" - while [ ! -z "${SCAN_card[${i}]}" ]; do - echo ">> ${SCAN_card[${i}]}" - let "i = ${i} + 1" - done -} - -function mk_misdn_dev -{ - if [ ! -e /dev/mISDN ]; then - echo "creating device node: /dev/mISDN" - ${MKNOD} /dev/mISDN c 46 0 - fi - ${CHOWN} ${DEVNODE_user}:${DEVNODE_group} /dev/mISDN - ${CHMOD} ${DEVNODE_mode} /dev/mISDN -} - -# -# MAIN -# - -case "${1}" in - - start|--start) - - check_misdn_conf - parse_config - run_start_commands - mk_misdn_dev - ;; - - stop|--stop) - - run_stop_commands - ;; - - restart|--restart) - - check_misdn_conf - parse_config - run_stop_commands - ${SLEEP} 2 - run_start_commands - mk_misdn_dev - ;; - - config|--config) - - scan_devices - write_mISDN_conf - ;; - - scan|--scan) - - scan_devices - print_scan_results - ;; - - help|--help) - echo "${USAGE}" - exit 0 - ;; - - *) - echo "${USAGE}" - exit 2 - ;; - -esac - diff --git a/src/initscripts/extras/messagebus b/src/initscripts/extras/messagebus deleted file mode 100644 index eb23d9ae1..000000000 --- a/src/initscripts/extras/messagebus +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/messagebus - -### BEGIN INIT INFO -# Provides: messagebus -# Required-Start: $syslog -# Should-Start: -# Required-Stop: $syslog -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Messagebus Daemon. -# Description: Starts the dbus messagebus daemon. -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="the D-Bus Messagebus Daemon" -BIN_FILE="/usr/bin/dbus-daemon" - -CONFIGFILE=/etc/dbus-1/system.conf -PIDFILE=/var/run/dbus/pid -SOCKET=/var/run/dbus/system_bus_socket - -chk_stat - -case "${1}" in - start) - /usr/bin/dbus-uuidgen --ensure >/dev/null - start_daemon -p ${PIDFILE} "${BIN_FILE}" --config-file="${CONFIGFILE}" - evaluate_retval start - ;; - - stop) - killproc -p ${PIDFILE} "${BIN_FILE}" - evaluate_retval stop - rm -f "${SOCKET}" "${PIDFILE}" - ;; - - restart|force-reload) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc -p ${PIDFILE} - ;; - - *) - echo "Usage: ${0} {start|stop|force-reload|restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/messagebus diff --git a/src/initscripts/extras/mpd b/src/initscripts/extras/mpd deleted file mode 100644 index 5bc82cc8d..000000000 --- a/src/initscripts/extras/mpd +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/mpd - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org -# ALSA specific parts by Mark Hymers - markh@linuxfromscratch.org -# Stores mixer settings in the default location: /etc/asound.state - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting MPD..." - /bin/nice --20 /usr/bin/mpd - evaluate_retval - ;; - stop) - boot_mesg "Stopping MPD..." - /usr/bin/mpd --kill - evaluate_retval - ;; - status) - statusproc /usr/bin/mpd - ;; - restart) - $0 stop - sleep 3 - $0 start - ;; - *) - echo "Usage: $0 (start|stop|restart|status)" - exit 1 - ;; -esac - -# End $rc_base/init.d/alsa diff --git a/src/initscripts/extras/network b/src/initscripts/extras/network deleted file mode 100644 index 94dfb25b0..000000000 --- a/src/initscripts/extras/network +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/network - -### BEGIN INIT INFO -# Provides: $network -# Required-Start: $local_fs swap localnet -# Should-Start: $syslog -# Required-Stop: $local_fs swap localnet -# Should-Stop: $syslog -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Starts and configures network interfaces. -# Description: Starts and configures network interfaces. -# X-LFS-Default-Start: S20 -# X-LFS-Default-Stop: K80 -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -case "${1}" in - start|stop|reload|restart) - exec /sbin/network $@ - ;; - - *) - echo "Usage: ${0} {start|stop|restart|reload}" - exit 1 - ;; -esac - -# End /etc/init.d/network diff --git a/src/initscripts/extras/nfs-server b/src/initscripts/extras/nfs-server deleted file mode 100644 index 5e044286c..000000000 --- a/src/initscripts/extras/nfs-server +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/nfs-server - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org - -#$LastChangedBy: bdubbs $ -#$Date: 2006-09-10 19:41:47 -0500 (Sun, 10 Sep 2006) $ - -. /etc/sysconfig/rc -. $rc_functions -. /etc/sysconfig/nfs-server - -case "$1" in - start) - boot_mesg "Starting NFS mountd..." - loadproc /usr/sbin/rpc.mountd - - boot_mesg "Starting NFS nfsd..." - loadproc /usr/sbin/rpc.nfsd -p $PORT $PROCESSES - - boot_mesg "Starting NFS statd..." - loadproc /usr/sbin/rpc.statd - - if [ "$QUOTAS" = "yes" ]; then - boot_mesg "Starting NFS rquotad..." - loadproc /usr/sbin/rpc.rquotad - fi - - # NFSD support only in 2.6 kernel - /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null - if [ $? = 0 ]; then - boot_mesg "Mounting nfsd virtual filesystem..." - /bin/mount -t nfsd none /proc/fs/nfsd 2>&1 > /dev/null - evaluate_retval - fi - - # Make ceratin that the list is refreshed on - # a restart. - boot_mesg "Exporting NFS Filesystems..." - /usr/sbin/exportfs -ra 2>&1 > /dev/null - evaluate_retval - ;; - - stop) - boot_mesg "Stopping NFS statd..." - killproc /usr/sbin/rpc.statd - - boot_mesg "Stopping NFS nfsd..." - # nfsd needs HUP.... - killproc nfsd HUP - - boot_mesg "Stopping NFS mountd..." - killproc /usr/sbin/rpc.mountd - - if [ "$QUOTAS" = "yes" ]; then - boot_mesg "Stopping NFS rquotad..." - killproc /usr/sbin/rpc.rquotad - fi - - boot_mesg "Refreshing NFS Exported Filesystems..." - /usr/sbin/exportfs -au 2>&1 > /dev/null - evaluate_retval - - # NFSD support only in 2.6 kernel - /bin/uname -r | /bin/grep "2.6" 2>&1 > /dev/null - if [ $? = 0 ]; then - boot_mesg "Unmounting NFS Virtual Filesystem..." - /bin/umount /proc/fs/nfsd 2>&1 > /dev/null - evaluate_retval - fi - - # Remove a pid file that isn't done automatically - boot_mesg "Removing the rpc.statd pid file if it exists" - if [ -f /var/run/rpc.statd.pid ]; then - rm -f /var/run/rpc.statd.pid - fi - ;; - - reload) - boot_mesg "Reloading NFS Server..." - /usr/sbin/exportfs -ra - evaluate_retval - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/rpc.mountd - ## Special case for nfsd with no full path - statusproc nfsd - statusproc /usr/sbin/rpc.statd - if [ "$QUOTA" = "yes" ]; then - statusproc rpc.rquotad - fi - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/nfs-server diff --git a/src/initscripts/extras/ntpd b/src/initscripts/extras/ntpd deleted file mode 100644 index d721afbe2..000000000 --- a/src/initscripts/extras/ntpd +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/ntpd - -### BEGIN INIT INFO -# Provides: ntp -# Required-Start: $time $network -# Should-Start: -# Required-Stop: -# Should-Stop: -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: NTP Network Time Protocal -# Description: NTP Syncronizes time with time servers worldwide -# X-LFS-Default-Start: S26 -# X-LFS-Default-Stop: K46 -# X-LFS-Provided-By: BLFS -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="Network Time Protocal Daemon" -BIN_FILE="/usr/sbin/ntpd" -CONFIG_FILE="/etc/ntp.conf" -PIDFILE="/var/run/ntpd.pid" - -# Make certain that the binary exists, and that the config file exists -chk_stat - -case "$1" in - - start) - ${BIN_FILE} -gqx && - start_daemon -p "${PIDFILE}" "${BIN_FILE}" - evaluate_retval start - ;; - - stop) - killproc -p "${PIDFILE}" "${BIN_FILE}" - evaluate_retval stop - ;; - - restart) - # Restart service (if running) or start service - killproc -p "${PIDFILE}" "${BIN_FILE}" && - sleep 1 && - start_daemon -p "${PIDFILE}" "${BIN_FILE}" - evaluate_retval restart - ;; - - status) - statusproc - ;; - - *) - echo " Usage: ${0}{start|stop|restart|force-reload|status}" - if [ "${1}" = "reload" -o "${1}" = "try-restart" ] - then - echo " Error: Unimplemented function '${1}'" - exit 3 - else - exit 2 - fi - ;; - -esac - -# End /etc/init.d/ntpd - diff --git a/src/initscripts/extras/openldap b/src/initscripts/extras/openldap deleted file mode 100644 index d6c13b2c9..000000000 --- a/src/initscripts/extras/openldap +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/openldap - -### BEGIN INIT INFO -# Provides: openldap -# Required-Start: $network -# Should-Start: -# Required-Stop: -# Should-Stop: netfs -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Starts OpenLDAP slapd. -# Description: Starts OpenLDAP slapd daemon. -# X-LFS-Default-Start: S25 -# X-LFS-Default-Stop: K46 -# X-LFS-Provided-By: BLFS -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="OpenLDAP slapd" -BIN_FILE="/usr/sbin/slapd" -PIDFILE="/srv/ldap/run/slapd.pid" - -case "$1" in - start) - start_daemon "${BIN_FILE}" - evaluate_retval start - ;; - - stop) - # slapd needs SIGINT - killproc -p "${PIDFILE}" "${BIN_FILE}" -INT - evaluate_retval stop - ;; - - restart) - killproc -p "${PIDFILE}" "${BIN_FILE}" -INT && - sleep 1 && - start_daemon "${BIN_FILE}" - evaluate_retval restart - ;; - - status) - statusproc - ;; - - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; - -esac - -# End $rc_base/init.d/openldap diff --git a/src/initscripts/extras/openssh b/src/initscripts/extras/openssh deleted file mode 100644 index 1b79e0ef6..000000000 --- a/src/initscripts/extras/openssh +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/openssh - -### BEGIN INIT INFO -# Provides: ssh -# Required-Start: $network -# Should-Start: -# Required-Stop: -# Should-Stop: netfs -# Default-Start: 3 4 5 -# Default-Stop: 0 1 2 6 -# Short-Description: Starts OpenSSH daemon. -# Description: Starts OpenSSH daemon. -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="OpenSSH Server" -BIN_FILE="/usr/sbin/sshd" - -function generate_keys() { - for algo in dsa rsa; do - [ -e "/etc/ssh/ssh_host_${algo}_key" ] && continue - /usr/bin/ssh-keygen -q -t ${algo} -N "" -f /etc/ssh/ssh_host_${algo}_key - done -} - -case "$1" in - start) - generate_keys - start_daemon "${BIN_FILE}" - evaluate_retval start - ;; - - stop) - killproc "${BIN_FILE}" - evaluate_retval stop - ;; - - reload) - killproc "${BIN_FILE}" -HUP - evaluate_retval reload - ;; - - restart) - killproc "${BIN_FILE}" - sleep 1 - start_daemon "${BIN_FILE}" - evaluate_retval restart - ;; - - status) - statusproc "${BIN_FILE}" - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 1 - ;; - -esac - -# End $rc_base/init.d/openssh diff --git a/src/initscripts/extras/portmap b/src/initscripts/extras/portmap deleted file mode 100644 index 00516a298..000000000 --- a/src/initscripts/extras/portmap +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/portmap - -#$LastChangedBy: bdubbs $ -#$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $ - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting RPC Portmap" - loadproc /sbin/portmap - ;; - - stop) - boot_mesg "Stopping Portmap" - killproc /sbin/portmap - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /sbin/portmap - ;; - - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; - -esac - -# End $rc_base/init.d/portmap diff --git a/src/initscripts/extras/postfix b/src/initscripts/extras/postfix deleted file mode 100644 index b2582b709..000000000 --- a/src/initscripts/extras/postfix +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/postfix - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org - -#$LastChangedBy: bdubbs $ -#$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $ - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting Postfix..." - loadproc /usr/sbin/postfix start - ;; - - stop) - boot_mesg "Stopping Postfix..." - loadproc /usr/sbin/postfix stop - ;; - - reload) - boot_mesg "Reloading Postfix..." - loadproc /usr/sbin/postfix reload - ;; - - abort) - boot_mesg "Aborting Postfix..." - loadproc /usr/sbin/postfix abort - ;; - - flush) - boot_mesg "Flushing Postfix..." - loadproc /usr/sbin/postfix flush - ;; - - check) - boot_mesg "Checking Postfix..." - loadproc /usr/sbin/postfix check - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - *) - echo "Usage: $0 {start|stop|reload|abort|flush|check|restart}" - exit 1 - ;; -esac - -# End $rc_base/init.d/postfix diff --git a/src/initscripts/extras/samba b/src/initscripts/extras/samba deleted file mode 100644 index d6bdb262a..000000000 --- a/src/initscripts/extras/samba +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/samba - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org - -#$LastChangedBy: bdubbs $ -#$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $ - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting nmbd..." - loadproc /usr/sbin/nmbd -D - - boot_mesg "Starting smbd..." - loadproc /usr/sbin/smbd -D - ;; - - stop) - boot_mesg "Stopping smbd..." - killproc -p /var/run/smbd.pid /usr/sbin/smbd - - boot_mesg "Stopping nmbd..." - killproc -p /var/run/nmbd.pid /usr/sbin/nmbd - ;; - - reload) - boot_mesg "Reloading smbd..." - reloadproc /usr/sbin/smbd - - boot_mesg "Reloading nmbd..." - reloadproc /usr/sbin/nmbd - ;; - - restart) - $0 stop - sleep 3 - $0 start - ;; - - status) - statusproc /usr/sbin/nmbd - statusproc /usr/sbin/smbd - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/samba diff --git a/src/initscripts/extras/snort b/src/initscripts/extras/snort deleted file mode 100644 index 16f7953ef..000000000 --- a/src/initscripts/extras/snort +++ /dev/null @@ -1,132 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/snort -# -# Description : Snort Initscript -# -# Authors : Michael Tremer for ipfire.org - mitch@ipfire.org -# -# Version : 01.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin; export PATH - -eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) -eval $(/usr/local/bin/readhash /var/ipfire/snort/settings) - -if [ "$ENABLE_SNORT_ORANGE" == "on" ]; then - HOME_NET+="$ORANGE_ADDRESS," - DEVICES+="$ORANGE_DEV " -fi - -if [ "$ENABLE_SNORT_GREEN" == "on" ]; then - HOME_NET+="$GREEN_ADDRESS," - DEVICES+="$GREEN_DEV " -fi - -if [ "$ENABLE_SNORT_BLUE" == "on" ]; then - HOME_NET+="$BLUE_ADDRESS," - DEVICES+="$BLUE_DEV " -fi - -if [ "$ENABLE_SNORT" == "on" ]; then - LOCAL_IP=`cat /var/ipfire/red/local-ipaddress` - if [ "$LOCAL_IP" ]; then - HOME_NET+="$LOCAL_IP," - else - exit 1 ## Add error handling here - fi - DEVICES+=`cat /var/ipfire/red/iface 2>/dev/null` -fi - -COUNT=`echo $HOME_NET | wc -m` -HOME_NET=`echo $HOME_NET | cut -c $[$COUNT - 2]` - -echo "var HOME_NET [$HOME_NET]" > /etc/snort/vars -echo "var EXTERNAL_NET ANY" >> /etc/snort/vars - -DNS1=`cat /var/ipfire/red/dns1 2>/dev/null` -DNS2=`cat /var/ipfire/red/dns2 2>/dev/null` - -if [ "$DNS2" ]; then - echo "var DNS_SERVERS [$DNS1,$DNS2]" >> /etc/snort/vars -else - echo "var DNS_SERVERS $DNS1" >> /etc/snort/vars -fi - -case "$1" in - start) - for DEVICE in $DEVICES; do - boot_mesg "Starting Intrusion Detection System on $DEVICE..." - /usr/sbin/snort -c /etc/snort/snort.conf -i $DEVICE -D -l /var/log/snort --create-pidfile --nolock-pidfile --pid-path /var/run/ - evaluate_retval - chmod 644 /var/run/snort_$DEVICE.pid - done - - - if [ -r /var/ipfire/guardian/enable ]; then - IFACE=`/bin/cat /var/ipfire/red/iface 2>/dev/null | /usr/bin/tr -d '\012'` - sed -e "s/^Interface.*/Interface ${IFACE}/" /var/ipfire/guardian/guardian.conf > temp - mv temp /var/ipfire/guardian/guardian.conf - - boot_mesg "Starting Guardian..." - loadproc /usr/local/bin/guardian.pl -c /var/ipfire/guardian/guardian.conf - fi - ;; - - stop) - DEVICES="" - if [ -r /var/run/snort_$BLUE_DEV.pid ]; then - DEVICES+="$BLUE_DEV " - fi - - if [ -r /var/run/snort_$GREEN_DEV.pid ]; then - DEVICES+="$GREEN_DEV " - fi - - if [ -r /var/run/snort_$ORANGE_DEV.pid ]; then - DEVICES+="$ORANGE_DEV " - fi - - RED=`cat /var/ipfire/red/iface 2>/dev/null` - if [ -r /var/run/snort_$RED.pid ]; then - DEVICES+=`cat /var/ipfire/red/iface 2>/dev/null` - fi - - for DEVICE in $DEVICES; do - boot_mesg "Stopping Intrusion Detection System on $DEVICE..." - killproc -p /var/run/snort_$DEVICE.pid /var/run - done - - rm /var/run/snort_* >/dev/null 2>/dev/null - - if [ -r /var/ipfire/guardian/enable ]; then - boot_mesg "Stopping Guardian..." - killproc /usr/local/bin/guardian.pl - fi - ;; - - status) - statusproc /usr/sbin/snort - ;; - - restart) - $0 stop - $0 start - ;; - - *) - echo "Usage: $0 {start|stop|restart|status}" - exit 1 - ;; -esac - -chmod 644 /var/log/snort/* 2>/dev/null - -# End $rc_base/init.d/snort diff --git a/src/initscripts/extras/spamassassin b/src/initscripts/extras/spamassassin deleted file mode 100644 index 73403a8ec..000000000 --- a/src/initscripts/extras/spamassassin +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/spamassassin -# -# Description : Spamassassin Init Script -# -# Authors : Michael Tremer (ms@ipfire.org) -# -# Version : 01.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -case "${1}" in - start) - boot_mesg "Starting Spamassassin Daemon..." - loadproc -n 10 /usr/bin/spamd -d - ;; - - stop) - boot_mesg "Stopping Spamassassin Daemon..." - killproc /usr/bin/spamd - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - status) - statusproc /usr/bin/spamd - ;; - - *) - echo "Usage: ${0} {start|stop|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/spamassassin diff --git a/src/initscripts/extras/squid b/src/initscripts/extras/squid deleted file mode 100644 index c8a9b245e..000000000 --- a/src/initscripts/extras/squid +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/squid - -. /etc/sysconfig/rc -. $rc_functions - -chown -R squid:squid /var/log/squid -chown -R squid:squid /var/log/squidGuard - -transparent() { - DEVICE=$1 - - eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) - eval $(/usr/local/bin/readhash /var/ipfire/proxy/settings) - - # If the proxy port is not set we set the default to 800. - if [ -z $PROXY_PORT ]; then - PROXY_PORT=800 - fi - - LOCALIP=`cat /var/ipfire/red/local-ipaddress | tr -d \n` - if [ -z $LOCALIP ]; then - boot_mesg "Couldn't read local-ipaddress" ${FAILURE} - exit 1 - fi - - COUNT=1 - FILE=/var/ipfire/vpn/config - - while read LINE; do - let COUNT=$COUNT+1 - CONN_TYPE=`echo "$LINE" | awk -F, '{ print $5 }'` - if [ "$CONN_TYPE" != "net" ]; then - continue - fi - iptables -t nat -A SQUID -i $1 -p tcp -d `echo "$LINE" | awk -F, '{ print $13 }'` --dport 80 -j RETURN - done < $FILE - - if [ "$RED_TYPE" == "STATIC" ]; then - iptables -t nat -A SQUID -i $1 -p tcp -d $RED_NETADDRESS/$RED_NETMASK --dport 80 -j RETURN - fi - - iptables -t nat -A SQUID -i $1 -p tcp -d $LOCALIP --dport 80 -j RETURN - - iptables -t nat -A SQUID -i $1 -p tcp --dport 80 -j REDIRECT --to-port $PROXY_PORT -} - -case "$1" in - start) - if [ -e /var/ipfire/proxy/enable -o -e /var/ipfire/proxy/enable_blue ]; then - boot_mesg "Starting Squid Proxy Server..." - loadproc /usr/sbin/squid -D -z >/dev/null 2>&1 - loadproc /usr/sbin/squid -D - fi - - eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings) - - if [ -e /var/ipfire/proxy/transparent ]; then - transparent $GREEN_DEV - fi - if [ -e /var/ipfire/proxy/transparent_blue ]; then - transparent $BLUE_DEV - fi - ;; - - stop) - - if [ -e /var/ipfire/proxy/enable -o -e /var/ipfire/proxy/enable_blue ]; then - boot_mesg "Stopping Squid Proxy Server..." - iptables -t nat -F SQUID - squid -k shutdown >/dev/null 2>&1 - evaluate_retval - killproc /usr/bin/squidGuard >/dev/null - killproc /usr/sbin/updxlrator >/dev/null - killproc /usr/sbin/squid >/dev/null - fi - ;; - - restart) - $0 stop - sleep 5 - $0 start - ;; - - status) - statusproc /usr/sbin/squid - statusproc /usr/lib/squid/unlinkd - ;; - - flush) - $0 stop - echo > /var/log/cache/swap.state - chown squid.squid /var/log/cache/swap.state - sleep 1 - $0 start - ;; - - *) - echo "Usage: $0 {start|stop|restart|status|flush}" - exit 1 - ;; -esac - -# End $rc_base/init.d/squid diff --git a/src/initscripts/extras/syslog-ng b/src/initscripts/extras/syslog-ng deleted file mode 100644 index c687938b1..000000000 --- a/src/initscripts/extras/syslog-ng +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Begin /etc/init.d/syslog-ng - -### BEGIN INIT INFO -# Provides: $syslog -# Required-Start: localnet -# Should-Start: -# Required-Stop: $local_fs sendsignals -# Should-Stop: -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Starts the system log daemon. -# Description: Starts the system log daemon. -# X-LFS-Default-Start: S10 -# X-LFS-Default-Stop: K90 -# X-LFS-Provided-By: LFS -### END INIT INFO - -. /lib/lsb/init-functions - -MESSAGE="System Log Daemon" -BIN_FILE="/sbin/syslog-ng" -PIDFILE="/var/run/syslog-ng.pid" - -case "${1}" in - start) - loadproc -p "${PIDFILE}" - evaluate_retval start - ;; - - stop) - endproc - evaluate_retval stop - ;; - - force-reload) - reloadproc -force - evaluate_retval force-reload - ;; - - restart) - $0 stop - $0 start - ;; - - status) - statusproc - ;; - - *) - echo "Usage: ${0} {start|stop|force-reload|restart|status}" - exit 1 - ;; -esac - -# End /etc/init.d/syslog-ng diff --git a/src/initscripts/extras/template b/src/initscripts/extras/template deleted file mode 100644 index 69dc2a6a2..000000000 --- a/src/initscripts/extras/template +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/ -# -# Description : -# -# Authors : -# -# Version : 00.00 -# -# Notes : -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -case "${1}" in - start) - boot_mesg "Starting..." - loadproc - ;; - - stop) - boot_mesg "Stopping..." - killproc - ;; - - reload) - boot_mesg "Reloading..." - reloadproc - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - ;; - - status) - statusproc - ;; - - *) - echo "Usage: ${0} {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/ diff --git a/src/initscripts/extras/upnpd b/src/initscripts/extras/upnpd deleted file mode 100644 index ca05abf75..000000000 --- a/src/initscripts/extras/upnpd +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh -######################################################################## -# Begin $rc_base/init.d/ -# -# Description : UPnP Starter -# -# Authors : Michael Tremer -# -# Version : 01.00 -# -# Notes : for www.ipfire.org - GPLv2 -# -######################################################################## - -. /etc/sysconfig/rc -. ${rc_functions} - -# defaults -ALLOW_MULTICAST=no - -# configuration -eval $(/usr/local/bin/readhash /var/ipfire/upnp/settings) - -case "$1" in - start) - boot_mesg "Starting Universal Plug'n'Play daemon..." - loadproc /usr/sbin/upnpd $EXTIFACE $INTIFACE - evaluate_retval - [ "$ALLOW_MULTICAST" != "no" ] && route add -net 239.0.0.0 netmask 255.0.0.0 $INTIFACE - ;; - - stop) - boot_mesg "Stopping Universal Plug'n'Play daemon..." - killproc /usr/sbin/upnpd - evaluate_retval - [ "$ALLOW_MULTICAST" != "no" ] && route del -net 239.0.0.0 netmask 255.0.0.0 $INTIFACE - ;; - - restart) - ${0} stop - sleep 1 - ${0} start - - ;; - status) - statusproc - ;; - - *) - echo "Usage: ${0} {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/ diff --git a/src/initscripts/extras/vsftpd b/src/initscripts/extras/vsftpd deleted file mode 100644 index 62d838ade..000000000 --- a/src/initscripts/extras/vsftpd +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/sh -# Begin $rc_base/init.d/vsftpd - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org - -#$LastChangedBy: bdubbs $ -#$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $ - -. /etc/sysconfig/rc -. $rc_functions - -case "$1" in - start) - boot_mesg "Starting vsFTPD Server..." - loadproc /usr/sbin/vsftpd - ;; - - stop) - boot_mesg "Stopping vsFTPD Server..." - killproc /usr/sbin/vsftpd - ;; - - reload) - boot_mesg "Reloading vsFTPD Server..." - reloadproc /usr/sbin/vsftpd - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/vsftpd - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 1 - ;; -esac - -# End $rc_base/init.d/vsftpd diff --git a/src/initscripts/extras/winbind b/src/initscripts/extras/winbind deleted file mode 100644 index 590fddf40..000000000 --- a/src/initscripts/extras/winbind +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash -# Begin $rc_base/init.d/winbind - -# Based on sysklogd script from LFS-3.1 and earlier. -# Rewritten by Gerard Beekmans - gerard@linuxfromscratch.org - -#$LastChangedBy: bdubbs $ -#$Date: 2005-08-01 14:29:19 -0500 (Mon, 01 Aug 2005) $ - -. /etc/sysconfig/rc -. $rc_functions - -PIDFILE="/var/run/winbindd.pid" -KILLDELAY="10" - -case "$1" in - - start) - boot_mesg "Starting winbind..." - loadproc /usr/sbin/winbindd - ;; - - stop) - boot_mesg "Stopping winbind..." - killproc -p ${PIDFILE} /usr/sbin/winbind - ;; - - reload) - boot_mesg "Reloading winbind..." - reloadproc /usr/sbin/winbindd - ;; - - restart) - $0 stop - sleep 1 - $0 start - ;; - - status) - statusproc /usr/sbin/winbindd - ;; - - *) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 1 - ;; - -esac - -# End $rc_base/init.d/winbind diff --git a/src/initscripts/lsb/init-functions b/src/initscripts/lsb/init-functions deleted file mode 100644 index e4025b231..000000000 --- a/src/initscripts/lsb/init-functions +++ /dev/null @@ -1,577 +0,0 @@ -# Begin /lib/lsb/init-funtions - -# Provides initialization funtions as defined by the Linux Standard Base -# specification, version 3.1.0 - -# Source rc configuration if not inherited from the environment -if [ "${RC_BASE}" = "" ]; then - . /etc/sysconfig/rc -fi - -# Source the distro functions file -if [ "${DISTRO_MINI}" != "" ]; then - . "${RC_BASE}/init.d/${DISTRO_MINI}-functions" -fi - -################################################################################ -# start_daemon() # -# Usage: start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args...] # -# # -# Purpose: This runs the specified program as a daemon # -# # -# Inputs: -f: (force) run the program even if it is already running. # -# -n nicelevel: specify a nice level. See 'man nice(1)'. # -# -p pidfile: use the specified file to determine PIDs. # -# pathname: the complete path to the specified program # -# args: additional arguments passed to the program (pathname) # -# # -# Return values (as defined by LSB exit codes): # -# 0 - program is running or service is OK # -# 1 - generic or unspecified error # -# 2 - invalid or excessive argument(s) # -# 5 - program is not installed # -################################################################################ -start_daemon() -{ - local force="" - local nice="0" - local pidfile="" - local pidlist="" - local retval="" - - # Process arguments - while true - do - case "${1}" in - - -f) - force="1" - shift 1 - ;; - - -n) - nice="${2}" - shift 2 - ;; - - -p) - pidfile="${2}" - shift 2 - ;; - - -*) - return 2 - ;; - - *) - program="${1}" - break - ;; - esac - done - - # Check for a valid program - if [ ! -e "${program}" ] - then - return 5 - fi - - # Execute - if [ -z "${force}" ] - then - if [ -z "${pidfile}" ] - then - # determine the pid by discovery - pidlist=`pidofproc "${1}"` - retval="${?}" - else - # The PID file contains the needed PIDs - # Note that by LSB requirement, the path must be given to pidofproc, - # however, it is not used by the current implementation or standard. - pidlist=`pidofproc -p "${pidfile}" "${1}"` - retval="${?}" - fi - - # return a value ONLY - # It is the init script's (or distribution's functions) responsibilty - # to log messages! - case "${retval}" in - - 0) - # program is already running correctly, this is a - # succesful start. - return 0 - ;; - - 1) - # program is not running, but an invalid pid file exists - # remove the pid file and continue - rm -f "${pidfile}" - ;; - - 3) - # program is not running and no pidfile exists - # do nothing here, let start_deamon continue. - ;; - - *) - # Others as returned by status values shall not be interpreted - # and returned as an unspecified error. - return 1 - ;; - esac - fi - - # do the start! - nice -n "${nice}" "${@}" - -} - -################################################################################ -# killproc() # -# Usage: killproc [-p pidfile] pathname [signal] # -# # -# Purpose: Send control signals to running processes # -# # -# Inputs: -p pidfile, uses the specified pidfile # -# pathname, pathname to the specified program # -# signal, send this signal to pathname # -# # -# Return values (as defined by LSB exit codes): # -# 0 - program (pathname) has stopped/is already stopped or a # -# running program has been sent specified signal and stopped # -# successfully # -# 1 - generic or unspecified error # -# 2 - invalid or excessive argument(s) # -# 5 - program is not installed # -# 7 - program is not running and a signal was supplied # -################################################################################ -killproc() -{ - local pidfile - local program - local prefix - local progname - local signal="-TERM" - local fallback="-KILL" - local nosig - local pidlist - local retval - local pid - local delay="30" - local piddead - local dtime - - # Process arguments - while true - do - case "${1}" in - - -p) - pidfile="${2}" - shift 2 - ;; - - *) - program="${1}" - if [ -n "${2}" ] - then - signal="${2}" - fallback="" - else - nosig=1 - fi - - # error on additional arguments - if [ -n "${3}" ] - then - return 2 - else - break - fi - ;; - esac - done - - # Check for a valid program - if [ ! -e "${program}" ] - then - return 5 - fi - - # Check for a valid signal - check_signal "${signal}" - if [ "${?}" != "0" ] - then - return 2 - fi - - # Get a list of pids - if [ -z "${pidfile}" ] - then - # determine the pid by discovery - pidlist=`pidofproc "${1}"` - retval="${?}" - else - # The PID file contains the needed PIDs - # Note that by LSB requirement, the path must be given to pidofproc, - # however, it is not used by the current implementation or standard. - pidlist=`pidofproc -p "${pidfile}" "${1}"` - retval="${?}" - fi - - # return a value ONLY - # It is the init script's (or distribution's functions) responsibilty - # to log messages! - case "${retval}" in - - 0) - # program is running correctly - # do nothing here, let killproc continue. - ;; - - 1) - # program is not running, but an invalid pid file exists - # remove the pid file. - rm -f "${pidfile}" - # this is only a success if no signal was passed. - if [ -n "${nosig}" ] - then - return 0 - else - return 7 - fi - ;; - - 3) - # program is not running and no pidfile exists - # this is only a success if no signal was passed. - if [ -n "${nosig}" ] - then - return 0 - else - return 7 - fi - ;; - - *) - # Others as returned by status values shall not be interpreted - # and returned as an unspecified error. - return 1 - ;; - esac - - # perform different actions for exit signals and control signals - check_sig_type "${signal}" - if [ "${?}" -eq "0" ] # signal is used to terminate the program - then - # account for empty pidlist (pid file still exists and nosignal was given) - if [ "${pidlist}" != "" ]; then - #kill the list of pids - for pid in ${pidlist} - do - kill -0 "${pid}" 2> /dev/null - if [ "${?}" -ne "0" ]; then - # process is dead, continue to next and assume all is well - continue - else - kill "${signal}" "${pid}" 2> /dev/null - # Wait up to ${delay}/10 seconds to for "${pid}" to - # terminate in 10ths of a second - while [ "${delay}" != "0" ] - do - kill -0 "${pid}" 2> /dev/null || piddead="1" - if [ "${piddead}" = "1" ] - then - break - fi - sleep 0.1 - delay="$(( ${delay} - 1 ))" - done - # If a fallback is set, and program is still running, then - # use the fallback - if [ -n "${fallback}" -a "${piddead}" != "1" ] - then - kill "${fallback}" "${pid}" 2> /dev/null - sleep 1 - # Check again, and fail if still running - kill -0 "${pid}" 2> /dev/null && return 1 - else - # just check one last time and if still alive, fail - sleep 1 - kill -0 "${pid}" 2> /dev/null && return 1 - fi - fi - done - fi - - # Check for and remove stale PID files. - if [ -z "${pidfile}" ] - then - #find the basename of $program - prefix=`echo "${program}" | sed 's/[^/]*$//'` - progname=`echo "${program}" | sed "s@${prefix}@@"` - if [ -e "/var/run/${progname}.pid" ] - then - rm -f "/var/run/${progname}.pid" 2> /dev/null - fi - else - if [ -e "${pidfile}" ] - then - rm -f "${pidfile}" 2> /dev/null - fi - fi - - # For signals that do not expect a program to exit, simply - # let kill do it's job, and evaluate kills return for value - else # check_sig_type - signal is not used to terminate program - for pid in ${pidlist} - do - kill "${signal}" "${pid}" - if [ "${?}" -ne "0" ]; then - return 1 - fi - done - fi -} - -################################################################################ -# pidofproc() # -# Usage: pidofproc [-p pidfile] pathname # -# # -# Purpose: This function returns one or more pid(s) for a particular daemon # -# # -# Inputs: -p pidfile, use the specified pidfile instead of pidof # -# pathname, path to the specified program # -# # -# Return values (as defined by LSB status codes): # -# 0 - Success (PIDs to stdout) # -# 1 - Program is dead, PID file still exists (remaining PIDs output) # -# 3 - Program is not running (no output) # -################################################################################ -pidofproc() -{ - -local pidfile -local program -local prefix -local progname -local pidlist -local lpids -local exitstatus="0" - - # Process arguments - while true - do - case "${1}" in - - -p) - pidfile="${2}" - shift 2 - ;; - - *) - program="${1}" - if [ -n "${2}" ] - then - # Too many arguments - # Since this is status, return unknown - return 4 - else - break - fi - ;; - esac - done - - # If a PID file is not specified, try and find one. - if [ -z "${pidfile}" ] - then - # get the program's basename - prefix=`echo "${program}" | sed 's/[^/]*$//'` - progname=`echo "${program}" | sed "s@${prefix}@@"` - # if a PID file exists with that name, assume that is it. - if [ -e "/var/run/${progname}.pid" ] - then - pidfile="/var/run/${progname}.pid" - fi - fi - - # if a PID file is set and exists, use it. - if [ -n "${pidfile}" -a -e "${pidfile}" ] - then - # use the value in the first line of the pidfile - pidlist=`/bin/head -n1 "${pidfile}"` - # This can optionally be written as 'sed 1q' to repalce 'head -n1' - # should LFS move /bin/head to /usr/bin/head - else - # use pidof - pidlist=`pidof "${program}"` - fi - - # Figure out if all listed PIDs are running. - for pid in ${pidlist} - do - kill -0 ${pid} 2> /dev/null - if [ "${?}" = "0" ]; then - lpids="${pids}${pid} " - else - exitstatus="1" - fi - done - - if [ -z "${lpids}" -a ! -f "${pidfile}" ]; then - return 3 - else - echo "${lpids}" - return "${exitstatus}" - fi -} -################################################################################ -# log_success_msg() # -# Usage: log_success_msg [$MESSAGE | "message"] # -# # -# Purpose: Print a successful status message to the screen and optionally # -# a boot log file. # -# # -# Inputs: accepts one string value, either a quoted string or optionally # -# the value of $MESSAGE if set in the running environment. # -# # -# Return values: Not used # -################################################################################ -log_success_msg() -{ - echo -n -e "${PREFIX_SUCCESS}${INDENT}${@}" - echo -e "${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}" - if [ "${BOOTLOG_ENAB}" = "yes" ]; then - if [ $( hostname ) = "(none)" ]; then - BTTIMESPEC="" - else - BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) " - fi - echo "${BTTIMESPEC}bootlog: ${@} Successful" >> "${TEMPFS_MOUNT}/.bootlog" - fi - return 0 -} - -################################################################################ -# log_failure_msg() # -# Usage: log_failure_msg [$MESSAGE | "message"] # -# # -# Purpose: Print a failure status message to the screen and optionally # -# a boot log file. # -# # -# Inputs: accepts one string value, either a quoted string or optionally # -# the value of $MESSAGE if set in the running environment. # -# # -# Return values: Not used # -################################################################################ -log_failure_msg() -{ - echo -n -e "${PREFIX_FAILURE}${INDENT}${@}" - echo -e "${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}" - if [ "${BOOTLOG_ENAB}" = "yes" ]; then - if [ $( hostname ) = "(none)" ]; then - BTTIMESPEC="" - else - BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) " - fi - echo "${BTTIMESPEC}bootlog: ${@} Failed!" >> "${TEMPFS_MOUNT}/.bootlog" - fi - return 0 -} - -################################################################################ -# log_warning_msg() # -# Usage: log_warning_msg [$MESSAGE | "message"] # -# # -# Purpose: Print a warning status message to the screen and optionally # -# a boot log file. # -# # -# Inputs: accepts one string value, either a quoted string or optionally # -# the value of $MESSAGE if set in the running environment. # -# # -# Return values: Not used # -################################################################################ -log_warning_msg() -{ - echo -n -e "${PREFIX_WARNING}${INDENT}${@}" - echo -e "${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}" - if [ "${BOOTLOG_ENAB}" = "yes" ]; then - if [ $( hostname ) = "(none)" ]; then - BTTIMESPEC="" - else - BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) " - fi - echo "${BTTIMESPEC}bootlog: ${@} Warning" >> "${TEMPFS_MOUNT}/.bootlog" - fi - return 0 -} - -################################################################################ -# check_signal() # -# Usage: check_signal [ -{signal} | {signal} ] # -# # -# Purpose: Check for a valid signal. This is not defined by any LSB draft, # -# however, it is required to check the signals to determine if the # -# signals chosen are invalid arguments to the other functions. # -# # -# Inputs: accepts a single string value in the form or -{signal} or {signal} # -# # -# Return values: # -# 0 - Success (signal is valid # -# 1 - Signal is not valid # -################################################################################ -check_signal() -{ - local valsig - - # Add error handling for invalid signals - valsig="-ALRM -HUP -INT -KILL -PIPE -POLL -PROF -TERM -USR1 -USR2" - valsig="${valsig} -VTALRM -STKFLT -PWR -WINCH -CHLD -URG -TSTP -TTIN" - valsig="${valsig} -TTOU -STOP -CONT -ABRT -FPE -ILL -QUIT -SEGV -TRAP" - valsig="${valsig} -SYS -EMT -BUS -XCPU -XFSZ -0 -1 -2 -3 -4 -5 -6 -8 -9" - valsig="${valsig} -11 -13 -14 -15" - - echo "${valsig}" | grep -- " ${1} " > /dev/null - if [ "${?}" = "0" ] - then - return 0 - else - return 1 - fi -} - - -################################################################################ -# check_sig_type() # -# Usage: check_signal [ -{signal} | {signal} ] # -# # -# Purpose: Check if signal is a program termination signal or a control signal # -# This is not defined by any LSB draft, however, it is required to # -# check the signals to determine if they are intended to end a # -# program or simply to control it. # -# # -# Inputs: accepts a single string value in the form or -{signal} or {signal} # -# # -# Return values: # -# 0 - Signal is used for program termination # -# 1 - Signal is used for program control # -################################################################################ -check_sig_type() -{ - local valsig - - # The list of termination signals (limited to generally used items) - valsig="-ALRM -INT -KILL -TERM -PWR -STOP -ABRT -QUIT -2 -3 -6 -9 -14 -15" - - echo "${valsig}" | grep -- " ${1} " > /dev/null - if [ "${?}" = "0" ] - then - return 0 - else - return 1 - fi -} - -# End /lib/lsb/init-functions diff --git a/src/initscripts/lsb/manage-functions b/src/initscripts/lsb/manage-functions deleted file mode 100644 index 7c7a8f495..000000000 --- a/src/initscripts/lsb/manage-functions +++ /dev/null @@ -1,306 +0,0 @@ -#!/bin/bash -# Begin /lib/lsb/manage-functions - -# /lib/lsb/manage-functions contains the functions used by -# /lib/lsb/install_initd and /lib/lsb/remove_initd as well as additional helper -# functions for use in programs that would provide functionality similar to -# the RedHat chkconfig utility, for instance. - -# source the confif file -. /etc/lsb/lsb-config - -# Define all arrays at script start to avoid scope issues -# scriptlist is a list of valid scripts used as an index -declare -a scriptlist -# fullheaders is a complete set of valid LSB headers, stored in memory for -# each indexed script, to avoid multiple disk reads -declare -a fullheaders - -############################################################################### -# get_headers() - Obtains a valid list of scripts contained in ${rcbase} and # -# inserts the name of the script into the scriptlist[] array # -# for use by all other functions. Additionally, it inserts # -# the entire LSB header information from each script into a # -# second array, fullheaders[], so that diskreads need only be # -# done once # -# Returns no value, but populates the variable ${scriptcount} # -# and the arrays ${scriptlist} and ${fullheaders} for use # -# with other functions in this script. This function is # -# called unconditionally at the end of this scrip and is # -# provided as a function only for the case that it needs to # -# be called again after other operations. # -############################################################################### -get_headers() -{ - echo -n "Retrieving script information from disk..." - count=1 - for file in $(find -P /etc/init.d -xdev -perm -u=x | sed -n 2~1p \ - | sed "s@/etc/init.d/rc@@") - do - # determine if script is an LSB compliant script - grep "### BEGIN INIT INFO" $file > /dev/null - if test $? -gt "0" - then - # this is not a valid script and is ignored - # skip the rest of the loop - continue - fi - # determine basename using only bash (is basename a builtin?) - filename=$(echo "${file}" | sed "s@${rcbase}/@@") - # assign it to an array possition - scriptlist["${count}"]="${filename}" - # find the begining of the init info for the script - begin=$(grep -n "### BEGIN INIT INFO" "${file}" | cut -d: -f1) - # find the end of the init info for the script - end=$(grep -n "### END INIT INFO" "${file}" | cut -d: -f1) - # we'll use the difference between the values in the tail command - diff=$(( ${end} - ${begin} )) - # assign the entire LSB header information as a single string to the - # fullheaders[] array - fullheaders["${count}"]=$(head -n "${end}" "${file}" \ - | tail -n "${diff}") - count=$(( ${count} + 1 )) - unset begin - unset end - unset diff - unset filename - done - # a number or array elements would be a nice regular variable assignment - scriptcount="${#scriptlist[@]}" - unset count - echo -e "Completed!" -} - -############################################################################### -# print_headers() - Presents a formatted list of all LSB compliant script # -# headers to stdout preceeded by script name for use in # -# other scripts # -############################################################################### -print_headers() -{ - get_headers - count=1 - while test "${count}" -lt "${scriptcount}" - do - echo "${scriptlist[$count]}" - echo "=============================================================" - echo "${fullheaders[$count]}" - echo "" - echo "" - count="$(( ${count} + 1 ))" - done -} - -############################################################################### -# get_index() - Determines the array index of the specified script # -############################################################################### - -get_index() -{ - filename=$(echo "${1}" | sed "s@${rcbase}/@@") - count=1 - while test "${count}" -lt "${scriptcount}" - do - echo "${scriptlist[${count}]}" | grep "${filename}" > /dev/null - if test "${?}" -ne "0" - then - count=$(( ${count} + 1 )) - continue - else - break - fi - done - if test "${filename}" == "${scriptlist[${count}]}" - then - echo "${count}" - else - echo "${1} is not a valid LSB init script." - exit 1 - fi - unset filename - unset count -} - -############################################################################### -# get_lsb_value() - Obtains the LSB Value of $1 for index of script ($2). # -############################################################################### -get_lsb_value() -{ - # Probably need some error checking in here - echo "${fullheaders[${2}]}" | \ - grep "^# ${1}" | \ - sed -e "s@# ${1}:@@" \ - -e "s/^[ \t]*//" -} - -############################################################################### -# convert_lsb_required() - Converts LSB defined facilities (facility names # -# begining with a '$' character) into script names # -# for required start/stop # -############################################################################### -convert_lsb_required() -{ - local count=0 - local provides="" - local reqfacility="" - local reqprovideslist="" - - for reqfacility in $@ - do - # find the requires and it's index and then find the script name - # from the index. Since this is required, exit if it is not found - ## If reqfacility is already in script name format, nothing needs to - ## be done, just echo it back out. I can't think of an easy way to - ## do this right now, the scriptname will be the same as the provides - ## anyway, so just let it fly for now...it'll be correct, it just - ## takes an extra couple of commands to get the same result. - ## Besides, this will do some extra sanity checking in case somebody - ## writes a script that isn't named the same as provides, though this - ## isn't LSB compliant. Additionally, these same comments apply to - ## the convert_lsb_should() fucntion below. - count=0 - while test ${count} -lt ${scriptcount} - do - count=$(( $count + 1 )) - provides="$( get_lsb_value Provides ${count} )" - if test "${provides}" = "${reqfacility}" - then - reqprovideslist="${reqprovideslist} ${scriptlist[$count]}" - break - fi - if test ${count} -eq ${scriptcount}; then - # If we've never broken out of the while loop, then this is an - # unrecoverable error since it is a required item. Exit now! - echo "Error: unable to locate required facility ${reqfacility}!" - exit 5 - fi - done - done - echo "${reqprovideslist}" | sed -e "s/^[ \t]*//" -e "s/^[ \t]*//" -} - -############################################################################### -# convert_lsb_should() - Converts LSB defined facilities (facility names # -# begining with a '$' character) into script names for # -# should start/stop # -############################################################################### - -convert_lsb_should() -{ - local count=0 - local provides="" - local optfacility="" - local optprovideslist="" - - for optfacility in $@ - do - # find the should and it's index and then find the script name - # from the index. Since this is not an error, simply warn if it - # is not found. - count=0 - while test ${count} -lt ${scriptcount} - do - count=$(( $count + 1 )) - provides="$( get_lsb_value Provides ${count} )" - if test "${provides}" = "${optfacility}" - then - optprovideslist="${optprovideslist} ${scriptlist[$count]}" - break - fi - # No need to error or warn on should items, and it's messy if so! - done - done - echo "${optprovideslist}" | sed -e "s/^[ \t]*//" -e "s/[ \t]*$//" -} - -get_headers - -############################################################################### -# get_lsb_required_value() - Additional function to simplify repetitive tasks # -# Obtains the LSB Value of $1 for index of script # -# ($2) and immediately converts LSB defined # -# facilities (beginning with a '$' character) to a # -# script name. If the script is not found, then # -# the function exits with an error as per # -# convert_lsb_required. # -############################################################################### -get_lsb_required_value() -{ - local reqval - # Probably need some error checking in here - reqval=`echo "${fullheaders[${2}]}" | \ - grep "^# ${1}" | \ - sed -e "s@# ${1}:@@" \ - -e "s/^[ \t]*//"` - - # If $reqval contains a '$' charcter, then convert it to a script name - echo "${reqval}" | grep "\\$" 2>&1 > /dev/null - if test "${?}" -eq "0" - then - reqval=`convert_lsb_required "${reqval}"` - fi - echo "${reqval}" -} - -############################################################################### -# get_lsb_should_value() - Additional function to simplify repetitive tasks # -# Obtains the LSB Value of $1 for index of script # -# ($2) and immediately converts LSB defined # -# facilities (beginning with a '$' character) to a # -# script name. If the script is not found, the # -# value is removed from the list as it is optional. # -############################################################################### -get_lsb_should_value() -{ - local optval - local listitem - local optitem - # Probably need some error checking in here - optval=`echo "${fullheaders[${2}]}" | \ - grep "^# ${1}" | \ - sed -e "s@# ${1}:@@" \ - -e "s/^[ \t]*//"` - - # If $optval contains a '$' charcter, then convert it to a script name - echo "${optval}" | grep "\\$" 2>&1 > /dev/null - if test "${?}" -eq "0" - then - optval=`convert_lsb_should "${optval}"` - # if we still have a "$" character, then it's not found and it should - # be removed from the list (and it's trailing space if one exists) - # since it is optional - echo "${optval}" | grep "\\$" 2>&1 > /dev/null - if test "${?}" -eq "0" - then - # Remove the value - for listitem in ${optval} - do - echo "${listitem}" | grep "\\$" - if test "${?}" -eq "0" - then - optval=`echo "${optval}" | sed -e 's@${listitem} @@' \ - -e 's@${listitem}@@' | \ - sed -e "s@# ${1}:@@" \ - -e "s/^[ \t]*//"` - fi - done - fi - fi - # If a should start value does not have a script associted with it, then - # remove it (or it and trailing space) from the list - for optitem in ${otpval} - do - grep "${optitem}" "${statedir}/enabled-scripts" 2>&1 > /dev/null - if test "${?}" -ne "0" - then - optval=`echo "${optval}" | sed -e 's@${otpitem} @@' \ - -e 's@${optitem}@@' | \ - sed -e "s@# ${1}:@@" \ - -e "s/^[ \t]*//"` - fi - done - - echo "${optval}" -} - -# End /lib/lsb/manage-functions diff --git a/src/rootfiles/core/initscripts b/src/rootfiles/core/initscripts index 825983b5b..2a51275e8 100644 --- a/src/rootfiles/core/initscripts +++ b/src/rootfiles/core/initscripts @@ -1,59 +1,22 @@ -etc/init.d/boottemp -etc/init.d/checkfs -etc/init.d/cleanfs -etc/init.d/halt -etc/init.d/ipfire-functions -etc/init.d/localnet -etc/init.d/modules -etc/init.d/mountfs -etc/init.d/mountkernfs -etc/init.d/random -etc/init.d/rc -etc/init.d/reboot -etc/init.d/sendsignals -etc/init.d/setclock -etc/init.d/swap -etc/init.d/sysctl -#etc/init.d/template -etc/init.d/udev -etc/init.d/udev_retry -etc/lsb -etc/lsb/lsb-config -etc/lsb/state -etc/rc0.d -etc/rc0.d/K94syslog-ng -etc/rc0.d/K95random -etc/rc0.d/K96sendsignals -etc/rc0.d/K97mountfs -etc/rc0.d/K98swap -etc/rc0.d/K99localnet -etc/rc0.d/S00halt -etc/rc1.d -etc/rc1.d/K99syslog-ng -etc/rc2.d -etc/rc3.d -etc/rc4.d -etc/rc5.d -etc/rc6.d -etc/rc6.d/K94syslog-ng -etc/rc6.d/K95random -etc/rc6.d/K96sendsignals -etc/rc6.d/K97mountfs -etc/rc6.d/K98swap -etc/rc6.d/K99localnet -etc/rc6.d/S00reboot -etc/rcS.d -etc/rcS.d/S00mountkernfs -etc/rcS.d/S01sysctl -etc/rcS.d/S02modules -etc/rcS.d/S03udev -etc/rcS.d/S04swap -etc/rcS.d/S05checkfs -etc/rcS.d/S06mountfs -etc/rcS.d/S07cleanfs -etc/rcS.d/S08localnet -etc/rcS.d/S09random -etc/rcS.d/S10udev_retry +etc/init +etc/init/checkfs.conf +etc/init/control-alt-delete.conf +etc/init/functions +etc/init/load-modules.conf +etc/init/loopback.conf +etc/init/mount-kernel-filesystems.conf +etc/init/mountfs.conf +etc/init/swap.conf +etc/init/sysctl.conf +etc/init/tty1.conf +etc/init/tty2.conf +etc/init/tty3.conf +etc/init/tty4.conf +etc/init/tty5.conf +etc/init/tty6.conf +etc/init/udev.conf +etc/init/udevtrigger.conf +etc/init/welcome.conf etc/sysconfig/clock etc/sysconfig/createfiles etc/sysconfig/modules @@ -62,6 +25,3 @@ etc/sysconfig/rc etc/sysconfig/rc.local etc/sysconfig/rc.site etc/sysctl.conf -lib/lsb -lib/lsb/init-functions -lib/lsb/manage-functions diff --git a/src/rootfiles/core/udev b/src/rootfiles/core/udev index 31a5b607c..e24507b9a 100644 --- a/src/rootfiles/core/udev +++ b/src/rootfiles/core/udev @@ -12,6 +12,7 @@ lib/udev/collect lib/udev/console_init lib/udev/create_floppy_devices lib/udev/devices +lib/udev/devices/console lib/udev/devices/core lib/udev/devices/fd lib/udev/devices/kmsg diff --git a/src/rootfiles/core/upstart b/src/rootfiles/core/upstart index b821f3d13..1042b00a6 100644 --- a/src/rootfiles/core/upstart +++ b/src/rootfiles/core/upstart @@ -1,22 +1,4 @@ etc/dbus-1/system.d/Upstart.conf -etc/init -etc/init/control-alt-delete.conf -etc/init/mount-kernel-filesystems.conf -etc/init/sulogin.conf -#etc/init/load-modules.conf -#etc/init/swap.conf -etc/init/sysctl.conf -etc/init/udev.conf -etc/init/udevtrigger.conf -etc/init/checkfs.conf -#etc/init/mountfs.conf -etc/init/tty1.conf -etc/init/tty2.conf -etc/init/tty3.conf -etc/init/tty4.conf -etc/init/tty5.conf -etc/init/tty6.conf -etc/init/welcome.conf sbin/halt sbin/init sbin/initctl diff --git a/src/upstart/load-modules.conf b/src/upstart/load-modules.conf deleted file mode 100644 index 893107392..000000000 --- a/src/upstart/load-modules.conf +++ /dev/null @@ -1,74 +0,0 @@ -start on started sysctl - -console output - -script - . /lib/lsb/init-functions - - # Exit if there's no modules file or there are no - # valid entries - [ -r /etc/sysconfig/modules ] && \ - egrep -qv '^($|#)' /etc/sysconfig/modules || \ - exit 0 - - # If proc is mounted, find the current kernel - # message level - if [ -f /proc/sys/kernel/printk ]; then - prev_msg=`cat /proc/sys/kernel/printk | \ - sed 'l 1' | sed -n '2~0p' | \ - sed 's/\\\//'` - else - prev_msg="6" - fi - - # Now set the message level to 1 so not to make too - # much noise when loading modules - dmesg -n 1 - - # Only try to load modules if the user has actually given us - # some modules to load. - if egrep -qv '^(#|$)' /etc/sysconfig/modules 2>/dev/null - then - - # Read in the configuration file. - exec 9>&0 < /etc/sysconfig/modules - - message="${INFO}Loading modules:" - - while read module args; do - - # Ignore comments and blank lines. - case "${module}" in - ""|\#*) continue ;; - esac - - # Attempt to load the module, making - # sure to pass any arguments provided. - modprobe ${module} ${args} > /dev/null - - # Print the module name if successful, - # otherwise take note. - if [ ${?} -eq 0 ]; then - message="${message}${NORMAL} ${module}" - else - failedmod="${failedmod} ${module}" - fi - done - - # Print a message about successfully loaded - # modules on the correct line. - log_success_msg "${message}" - - # Print a failure message with a list of any - # modules that may have failed to load. - if [ "${failedmod}" ]; then - log_failure_msg "${FAILURE}Failed to load modules:${failedmod}" - fi - - exec 0>&9 9>&- - - fi - # Set the kernel message level back to it's previous value. - dmesg -n "${prev_msg}" - -end script diff --git a/src/upstart/loopback.conf b/src/upstart/loopback.conf deleted file mode 100644 index f3c2696e4..000000000 --- a/src/upstart/loopback.conf +++ /dev/null @@ -1,16 +0,0 @@ -description "Bring up the loopback (127.0.0.1) network interface" -author "Scott James Remnant" - -start on stopped sysctl ok - -console output - -pre-start script - if [ ! -d /var/run/network ]; then - mkdir -m 0755 /var/run/network - fi -end script - -exec /sbin/ip addr add 127.0.0.1/8 label lo dev lo -exec /sbin/ip link set lo up - diff --git a/src/upstart/mount-kernel-filesystems.conf b/src/upstart/mount-kernel-filesystems.conf deleted file mode 100644 index ea18a4f74..000000000 --- a/src/upstart/mount-kernel-filesystems.conf +++ /dev/null @@ -1,16 +0,0 @@ -start on stopped welcome - -console output - -script - echo "Mounting kernel file systems..." - # Mount /proc and /sys - mountpoint -q /proc || mount -n -t proc -o nodev,noexec,nosuid proc /proc - # If the user requested to be quiet, then we should not display warnings - grep -q quiet /proc/cmdline && echo "0" > /proc/sys/kernel/printk - mountpoint -q /sys || mount -n -t sysfs -o nodev,noexec,nosuid sysfs /sys -end script - -post-start script - echo "mount sysproc DONE" -end script diff --git a/src/upstart/swap.conf b/src/upstart/swap.conf deleted file mode 100644 index f05028df3..000000000 --- a/src/upstart/swap.conf +++ /dev/null @@ -1,9 +0,0 @@ -start on started udevtrigger - -console output - -pre-start script - echo "Activating all swap files/partitions..." -end script - -exec /sbin/swapon -a diff --git a/src/upstart/sysctl.conf b/src/upstart/sysctl.conf deleted file mode 100644 index 61940fa18..000000000 --- a/src/upstart/sysctl.conf +++ /dev/null @@ -1,9 +0,0 @@ -start on stopped mount-kernel-filesystems - -console output - -script - echo "Starting sysctl...." - /sbin/sysctl -q -p - echo "sysctl DONE" -end script diff --git a/src/upstart/udev.conf b/src/upstart/udev.conf deleted file mode 100644 index c099ea9b5..000000000 --- a/src/upstart/udev.conf +++ /dev/null @@ -1,15 +0,0 @@ -start on started mount-kernel-filesystems - -emits block-device-added block-device-removed -emits network-device-added network-device-removed - -console output - -pre-start script - mount -n -t tmpfs tmpfs /dev -o mode=755 - echo > /proc/sys/kernel/hotplug - cp -a /lib/udev/devices/* /dev -end script - -exec /sbin/udevd -respawn diff --git a/src/upstart/udevtrigger.conf b/src/upstart/udevtrigger.conf deleted file mode 100644 index 339496b58..000000000 --- a/src/upstart/udevtrigger.conf +++ /dev/null @@ -1,13 +0,0 @@ -start on started udev - -console output - -script - echo "Starting udev trigger..." - # Now traverse /sys in order to "coldplug" devices that have - # already been discovered - /sbin/udevadm trigger - - # Now wait for udevd to process the uevents we triggered - /sbin/udevadm settle --timeout=5 || true -end script diff --git a/src/upstart/welcome.conf b/src/upstart/welcome.conf index 538aa0b8e..5460f0516 100644 --- a/src/upstart/welcome.conf +++ b/src/upstart/welcome.conf @@ -1,7 +1,16 @@ +description "Display a welcome message to the user" +author "IPFire Team" + start on startup console output script - echo "Welcome to IPFire $(cat /etc/system-release)" + . /etc/init/functions + + # dcol are spaces before the message to center the + # message on screen. + dcol=$(( $(( ${COLUMNS} - ${dlen} )) / 2 )) + echo -e "\\033[${dcol}G${welcome_message}\n" + end script