aboutsummaryrefslogtreecommitdiffstats
path: root/bootscripts
diff options
context:
space:
mode:
Diffstat (limited to 'bootscripts')
-rw-r--r--bootscripts/ChangeLog3
-rw-r--r--bootscripts/Makefile174
-rw-r--r--bootscripts/lfs/init.d/functions793
-rw-r--r--bootscripts/lfs/init.d/localnet1
-rw-r--r--bootscripts/lfs/init.d/mountfs3
-rw-r--r--bootscripts/lfs/init.d/mountvirtfs4
-rw-r--r--bootscripts/lfs/init.d/rc4
-rw-r--r--bootscripts/lfs/init.d/udev10
-rw-r--r--bootscripts/lfs/init.d/udev_retry6
-rw-r--r--bootscripts/lfs/lib/services/init-functions2
-rw-r--r--bootscripts/lfs/lib/systemd/ifupdown@.service12
-rw-r--r--bootscripts/lfs/units/ifupdownat.service12
12 files changed, 134 insertions, 890 deletions
diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog
index a9e9806db..1a688b609 100644
--- a/bootscripts/ChangeLog
+++ b/bootscripts/ChangeLog
@@ -1,3 +1,6 @@
+2014-03-31 Bruce Dubbs <bdubbs@linuxfromscratch.org>
+ * Changes made to be consistent with common systemd functions
+
2013-08-21 Bruce Dubbs <bdubbs@linuxfromscratch.org>
* Delete duplicate entry in rc.site file.
diff --git a/bootscripts/Makefile b/bootscripts/Makefile
index 76f43d711..70ce71365 100644
--- a/bootscripts/Makefile
+++ b/bootscripts/Makefile
@@ -1,5 +1,7 @@
-EXTDIR=${DESTDIR}/etc
-LIBDIR=${DESTDIR}/lib/services
+ETCDIR=${DESTDIR}/etc
+LIBDIR=${DESTDIR}/lib
+SERVICEDIR=${LIBDIR}/services
+UNITDIR=${LIBDIR}/systemd/system
MAN8=${DESTDIR}/usr/share/man/man8
SBIN=${DESTDIR}/sbin
MODE=754
@@ -11,120 +13,124 @@ all: links
install: all
create-dirs:
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc0.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc1.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc2.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc3.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc4.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc5.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rc6.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/rcS.d
- install -d -m ${DIRMODE} ${EXTDIR}/rc.d/init.d
- install -d -m ${DIRMODE} ${EXTDIR}/sysconfig
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc0.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc1.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc2.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc3.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc4.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc5.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc6.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rcS.d
+ install -d -m ${DIRMODE} ${ETCDIR}/rc.d/init.d
+ install -d -m ${DIRMODE} ${ETCDIR}/sysconfig
install -d -m ${DIRMODE} ${LIBDIR}
+ install -d -m ${DIRMODE} ${SERVICEDIR}
+ install -d -m ${DIRMODE} ${UNITDIR}
install -d -m ${DIRMODE} ${MAN8}
install -d -m ${DIRMODE} ${SBIN}
- ln -sfn services ${DESTDIR}/lib/lsb
- ln -sfn rc.d/init.d ${EXTDIR}/init.d
+ ln -sfn services ${LIBDIR}/lsb
+ ln -sfn rc.d/init.d ${ETCDIR}/init.d-sysv
+ ln -sfn init.d-sysv ${ETCDIR}/init.d
files: create-dirs
- install -m ${MODE} lfs/init.d/checkfs ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/cleanfs ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/halt ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/console ${EXTDIR}/rc.d/init.d/
- install -m ${CONFMODE} lfs/init.d/functions ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/localnet ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/modules ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/mountfs ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/mountvirtfs ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/network ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/rc ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/reboot ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/sendsignals ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/setclock ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/swap ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/sysctl ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/sysklogd ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/template ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/udev ${EXTDIR}/rc.d/init.d/
- install -m ${MODE} lfs/init.d/udev_retry ${EXTDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/checkfs ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/cleanfs ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/halt ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/console ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/localnet ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/modules ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/mountfs ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/mountvirtfs ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/network ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/rc ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/reboot ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/sendsignals ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/setclock ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/swap ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/sysctl ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/sysklogd ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/template ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/udev ${ETCDIR}/rc.d/init.d/
+ install -m ${MODE} lfs/init.d/udev_retry ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/sbin/ifup ${SBIN}
install -m ${MODE} lfs/sbin/ifdown ${SBIN}
- install -m ${MODE} lfs/sbin/ifup.8 ${MAN8}
+ install -m ${CONFMODE} lfs/sbin/ifup.8 ${MAN8}
ln -sf ifup.8 ${MAN8}/ifdown.8
- install -m ${MODE} lfs/lib/services/ipv4-static-route ${LIBDIR}
- install -m ${MODE} lfs/lib/services/ipv4-static ${LIBDIR}
- install -m ${CONFMODE} lfs/lib/services/init-functions ${LIBDIR}
- if [ ! -f ${EXTDIR}/sysconfig/createfiles ]; then \
- install -m ${CONFMODE} lfs/sysconfig/createfiles ${EXTDIR}/sysconfig/ ;\
+ install -m ${MODE} lfs/lib/services/ipv4-static-route ${SERVICEDIR}
+ install -m ${MODE} lfs/lib/services/ipv4-static ${SERVICEDIR}
+ install -m ${CONFMODE} lfs/lib/services/init-functions ${SERVICEDIR}
+ install -m ${CONFMODE} lfs/units/ifupdownat.service ${UNITDIR}/ifupdown@.service
+
+ if [ ! -f ${ETCDIR}/sysconfig/createfiles ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/createfiles ${ETCDIR}/sysconfig/ ;\
fi
- if [ ! -f ${EXTDIR}/sysconfig/modules ]; then \
- install -m ${CONFMODE} lfs/sysconfig/modules ${EXTDIR}/sysconfig/ ;\
+ if [ ! -f ${ETCDIR}/sysconfig/modules ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/modules ${ETCDIR}/sysconfig/ ;\
fi
- if [ ! -f ${EXTDIR}/sysconfig/udev_retry ]; then \
- install -m ${CONFMODE} lfs/sysconfig/udev_retry ${EXTDIR}/sysconfig/ ;\
+ if [ ! -f ${ETCDIR}/sysconfig/udev_retry ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/udev_retry ${ETCDIR}/sysconfig/ ;\
fi
- if [ ! -f ${EXTDIR}/sysconfig/rc.site ]; then \
- install -m ${CONFMODE} lfs/sysconfig/rc.site ${EXTDIR}/sysconfig/ ;\
+ if [ ! -f ${ETCDIR}/sysconfig/rc.site ]; then \
+ install -m ${CONFMODE} lfs/sysconfig/rc.site ${ETCDIR}/sysconfig/ ;\
fi
links: rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6
rcS: files
- ln -sf ../init.d/mountvirtfs ${EXTDIR}/rc.d/rcS.d/S00mountvirtfs
- ln -sf ../init.d/modules ${EXTDIR}/rc.d/rcS.d/S05modules
- ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rcS.d/S08localnet
- ln -sf ../init.d/udev ${EXTDIR}/rc.d/rcS.d/S10udev
- ln -sf ../init.d/swap ${EXTDIR}/rc.d/rcS.d/S20swap
- ln -sf ../init.d/checkfs ${EXTDIR}/rc.d/rcS.d/S30checkfs
- ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rcS.d/S40mountfs
- ln -sf ../init.d/cleanfs ${EXTDIR}/rc.d/rcS.d/S45cleanfs
- ln -sf ../init.d/udev_retry ${EXTDIR}/rc.d/rcS.d/S50udev_retry
- ln -sf ../init.d/console ${EXTDIR}/rc.d/rcS.d/S70console
- ln -sf ../init.d/sysctl ${EXTDIR}/rc.d/rcS.d/S90sysctl
+ ln -sf ../init.d/mountvirtfs ${ETCDIR}/rc.d/rcS.d/S00mountvirtfs
+ ln -sf ../init.d/modules ${ETCDIR}/rc.d/rcS.d/S05modules
+ ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rcS.d/S08localnet
+ ln -sf ../init.d/udev ${ETCDIR}/rc.d/rcS.d/S10udev
+ ln -sf ../init.d/swap ${ETCDIR}/rc.d/rcS.d/S20swap
+ ln -sf ../init.d/checkfs ${ETCDIR}/rc.d/rcS.d/S30checkfs
+ ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rcS.d/S40mountfs
+ ln -sf ../init.d/cleanfs ${ETCDIR}/rc.d/rcS.d/S45cleanfs
+ ln -sf ../init.d/udev_retry ${ETCDIR}/rc.d/rcS.d/S50udev_retry
+ ln -sf ../init.d/console ${ETCDIR}/rc.d/rcS.d/S70console
+ ln -sf ../init.d/sysctl ${ETCDIR}/rc.d/rcS.d/S90sysctl
rc0: files
- ln -sf ../init.d/network ${EXTDIR}/rc.d/rc0.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc0.d/K90sysklogd
- ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc0.d/S60sendsignals
- ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc0.d/S65swap
- ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc0.d/S70mountfs
- ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc0.d/S90localnet
- ln -sf ../init.d/halt ${EXTDIR}/rc.d/rc0.d/S99halt
+ ln -sf ../init.d/network ${ETCDIR}/rc.d/rc0.d/K80network
+ ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc0.d/K90sysklogd
+ ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc0.d/S60sendsignals
+ ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc0.d/S65swap
+ ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc0.d/S70mountfs
+ ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc0.d/S90localnet
+ ln -sf ../init.d/halt ${ETCDIR}/rc.d/rc0.d/S99halt
rc1: files
- ln -sf ../init.d/network ${EXTDIR}/rc.d/rc1.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc1.d/K90sysklogd
+ ln -sf ../init.d/network ${ETCDIR}/rc.d/rc1.d/K80network
+ ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc1.d/K90sysklogd
rc2: files
- ln -sf ../init.d/network ${EXTDIR}/rc.d/rc2.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc2.d/K90sysklogd
+ ln -sf ../init.d/network ${ETCDIR}/rc.d/rc2.d/K80network
+ ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc2.d/K90sysklogd
rc3: files
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc3.d/S10sysklogd
- ln -sf ../init.d/network ${EXTDIR}/rc.d/rc3.d/S20network
+ ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc3.d/S10sysklogd
+ ln -sf ../init.d/network ${ETCDIR}/rc.d/rc3.d/S20network
rc4: files
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc4.d/S10sysklogd
- ln -sf ../init.d/network ${EXTDIR}/rc.d/rc4.d/S20network
+ ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc4.d/S10sysklogd
+ ln -sf ../init.d/network ${ETCDIR}/rc.d/rc4.d/S20network
rc5: files
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc5.d/S10sysklogd
- ln -sf ../init.d/network ${EXTDIR}/rc.d/rc5.d/S20network
+ ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc5.d/S10sysklogd
+ ln -sf ../init.d/network ${ETCDIR}/rc.d/rc5.d/S20network
rc6: files
- ln -sf ../init.d/network ${EXTDIR}/rc.d/rc6.d/K80network
- ln -sf ../init.d/sysklogd ${EXTDIR}/rc.d/rc6.d/K90sysklogd
- ln -sf ../init.d/sendsignals ${EXTDIR}/rc.d/rc6.d/S60sendsignals
- ln -sf ../init.d/swap ${EXTDIR}/rc.d/rc6.d/S65swap
- ln -sf ../init.d/mountfs ${EXTDIR}/rc.d/rc6.d/S70mountfs
- ln -sf ../init.d/localnet ${EXTDIR}/rc.d/rc6.d/S90localnet
- ln -sf ../init.d/reboot ${EXTDIR}/rc.d/rc6.d/S99reboot
+ ln -sf ../init.d/network ${ETCDIR}/rc.d/rc6.d/K80network
+ ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc6.d/K90sysklogd
+ ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc6.d/S60sendsignals
+ ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc6.d/S65swap
+ ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc6.d/S70mountfs
+ ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc6.d/S90localnet
+ ln -sf ../init.d/reboot ${ETCDIR}/rc.d/rc6.d/S99reboot
uninstall:
- rm -rf ${DESTDIR}/lib/services ${DESTDIR}/lib/lsb ${EXTDIR}/rc.d ${EXTDIR}/init.d \
- ${SBIN}/ifup ${SBIN}/ifdown ${MAN8}/ifup.8 ${MAN8}/ifdown.8 \
- ${EXTDIR}/sysconfig/rc
+ rm -rf ${DESTDIR}/lib/services ${DESTDIR}/lib/lsb ${ETCDIR}/rc.d ${ETCDIR}/init.d \
+ ${SBIN}/ifup ${SBIN}/ifdown ${MAN8}/ifup.8 ${MAN8}/ifdown.8 \
+ ${ETCDIR}/sysconfig/rc
.PHONY: all create-dirs install files links rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6 uninstall
diff --git a/bootscripts/lfs/init.d/functions b/bootscripts/lfs/init.d/functions
deleted file mode 100644
index 58165a3bf..000000000
--- a/bootscripts/lfs/init.d/functions
+++ /dev/null
@@ -1,793 +0,0 @@
-#!/bin/sh
-########################################################################
-# Begin boot functions
-#
-# Description : Run Level Control Functions
-#
-# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
-# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
-#
-# Version : LFS 7.0
-#
-# Notes : With code based on Matthias Benkmann's simpleinit-msb
-# http://winterdrache.de/linux/newboot/index.html
-#
-# This file is only present for backward BLFS compatibility
-#
-########################################################################
-
-## Environmental setup
-# Setup default values for environment
-umask 022
-export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
-
-# Signal sent to running processes to refresh their configuration
-RELOADSIG="HUP"
-
-# Number of seconds between STOPSIG and FALLBACK when stopping processes
-KILLDELAY="3"
-
-## Screen Dimensions
-# Find current screen size
-if [ -z "${COLUMNS}" ]; then
- COLUMNS=$(stty size)
- COLUMNS=${COLUMNS##* }
-fi
-
-# When using remote connections, such as a serial port, stty size returns 0
-if [ "${COLUMNS}" = "0" ]; then
- COLUMNS=80
-fi
-
-## Measurements for positioning result messages
-COL=$((${COLUMNS} - 8))
-WCOL=$((${COL} - 2))
-
-## Provide an echo that supports -e and -n
-# If formatting is needed, $ECHO should be used
-case "`echo -e -n test`" in
- -[en]*)
- ECHO=/bin/echo
- ;;
- *)
- ECHO=echo
- ;;
-esac
-
-## Set Cursor Position Commands, used via $ECHO
-SET_COL="\\033[${COL}G" # at the $COL char
-SET_WCOL="\\033[${WCOL}G" # at the $WCOL char
-CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char
-
-## Set color commands, used via $ECHO
-# Please consult `man console_codes for more information
-# under the "ECMA-48 Set Graphics Rendition" section
-#
-# Warning: when switching from a 8bit to a 9bit font,
-# the linux console will reinterpret the bold (1;) to
-# the top 256 glyphs of the 9bit font. This does
-# not affect framebuffer consoles
-NORMAL="\\033[0;39m" # Standard console grey
-SUCCESS="\\033[1;32m" # Success is green
-WARNING="\\033[1;33m" # Warnings are yellow
-FAILURE="\\033[1;31m" # Failures are red
-INFO="\\033[1;36m" # Information is light cyan
-BRACKET="\\033[1;34m" # Brackets are blue
-
-STRING_LENGTH="0" # the length of the current message
-
-#*******************************************************************************
-# Function - boot_mesg()
-#
-# Purpose: Sending information from bootup scripts to the console
-#
-# Inputs: $1 is the message
-# $2 is the colorcode for the console
-#
-# Outputs: Standard Output
-#
-# Dependencies: - sed for parsing strings.
-# - grep for counting string length.
-#
-# Todo:
-#*******************************************************************************
-boot_mesg()
-{
- local ECHOPARM=""
-
- while true
- do
- case "${1}" in
- -n)
- ECHOPARM=" -n "
- shift 1
- ;;
- -*)
- echo "Unknown Option: ${1}"
- return 1
- ;;
- *)
- break
- ;;
- esac
- done
-
- ## Figure out the length of what is to be printed to be used
- ## for warning messages.
- STRING_LENGTH=$((${#1} + 1))
-
- # Print the message to the screen
- ${ECHO} ${ECHOPARM} -e "${2}${1}"
-
- # Log the message
- [ -d /run/var ] || return
- ${ECHO} ${ECHOPARM} -e "${2}${1}" >> /run/var/bootlog
-}
-
-boot_mesg_flush()
-{
- # Reset STRING_LENGTH for next message
- STRING_LENGTH="0"
-}
-
-echo_ok()
-{
- ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]"
- ${ECHO} -e "${NORMAL}"
- boot_mesg_flush
-
- [ -d /run/var ] || return
- ${ECHO} -e "[ OK ]" >> /run/var/bootlog
-}
-
-echo_failure()
-{
- ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]"
- ${ECHO} -e "${NORMAL}"
- boot_mesg_flush
-
- [ -d /run/var ] || return
- ${ECHO} -e "[ FAIL]" >> /run/var/bootlog
-}
-
-echo_warning()
-{
- ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]"
- ${ECHO} -e "${NORMAL}"
- boot_mesg_flush
-
- [ -d /run/var ] || return
- ${ECHO} -e "[ WARN ]" >> /run/var/bootlog
-}
-
-echo_skipped()
-{
- ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} SKIP ${BRACKET}]"
- ${ECHO} -e "${NORMAL}"
- boot_mesg_flush
-
- [ -d /run/var ] || return
- ${ECHO} -e " [ SKIP ]" >> /run/var/bootlog
-}
-
-wait_for_user()
-{
- # Wait for the user by default
- [ "${HEADLESS=0}" = "0" ] && read ENTER
-}
-
-evaluate_retval()
-{
- error_value="${?}"
-
- if [ ${error_value} = 0 ]; then
- echo_ok
- else
- echo_failure
- fi
-
- # This prevents the 'An Unexpected Error Has Occurred' from trivial
- # errors.
- return 0
-}
-
-print_status()
-{
- if [ "${#}" = "0" ]; then
- echo "Usage: ${0} {success|warning|failure}"
- return 1
- fi
-
- case "${1}" in
-
- success)
- echo_ok
- ;;
-
- warning)
- # Leave this extra case in because old scripts
- # may call it this way.
- case "${2}" in
- running)
- ${ECHO} -e -n "${CURS_UP}"
- ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
- boot_mesg "Already running." ${WARNING}
- echo_warning
- ;;
- not_running)
- ${ECHO} -e -n "${CURS_UP}"
- ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
- boot_mesg "Not running." ${WARNING}
- echo_warning
- ;;
- not_available)
- ${ECHO} -e -n "${CURS_UP}"
- ${ECHO} -e -n "\\033[${STRING_LENGTH}G "
- boot_mesg "Not available." ${WARNING}
- echo_warning
- ;;
- *)
- # This is how it is supposed to
- # be called
- echo_warning
- ;;
- esac
- ;;
-
- failure)
- echo_failure
- ;;
-
- esac
-
-}
-
-reloadproc()
-{
- local pidfile=""
- local failure=0
-
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" -lt "1" ]; then
- log_failure_msg "Usage: reloadproc [-p pidfile] pathname"
- return 2
- fi
-
- # This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
-
- # Is the process running?
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Warn about stale pid file
- if [ "$?" = 1 ]; then
- boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING}
- rm -f "${pidfile}"
- fi
-
- if [ -n "${pidlist}" ]; then
- for pid in ${pidlist}
- do
- kill -"${RELOADSIG}" "${pid}" || failure="1"
- done
-
- (exit ${failure})
- evaluate_retval
-
- else
- boot_mesg "Process ${1} not running." ${WARNING}
- echo_warning
- fi
-}
-
-statusproc()
-{
- local pidfile=""
- local base=""
- local ret=""
-
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" != "1" ]; then
- shift 1
- log_failure_msg "Usage: statusproc [-p pidfile] pathname"
- return 2
- fi
-
- # Get the process basename
- base="${1##*/}"
-
- # This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
-
- # Is the process running?
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Store the return status
- ret=$?
-
- if [ -n "${pidlist}" ]; then
- ${ECHO} -e "${INFO}${base} is running with Process"\
- "ID(s) ${pidlist}.${NORMAL}"
- else
- if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
- ${ECHO} -e "${WARNING}${1} is not running but"\
- "/var/run/${base}.pid exists.${NORMAL}"
- else
- if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
- ${ECHO} -e "${WARNING}${1} is not running"\
- "but ${pidfile} exists.${NORMAL}"
- else
- ${ECHO} -e "${INFO}${1} is not running.${NORMAL}"
- fi
- fi
- fi
-
- # Return the status from pidofproc
- return $ret
-}
-
-# The below functions are documented in the LSB-generic 2.1.0
-
-#*******************************************************************************
-# Function - pidofproc [-s] [-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
-#
-# Outputs: return 0 - Success, pid's in stdout
-# return 1 - Program is dead, pidfile exists
-# return 2 - Invalid or excessive number of arguments,
-# warning in stdout
-# return 3 - Program is not running
-#
-# Dependencies: pidof, echo, head
-#
-# Todo: Remove dependency on head
-# This replaces getpids
-# Test changes to pidof
-#
-#*******************************************************************************
-pidofproc()
-{
- local pidfile=""
- local lpids=""
- local silent=""
- pidlist=""
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
-
- -s)
- # Added for legacy opperation of getpids
- # eliminates several '> /dev/null'
- silent="1"
- shift 1
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" != "1" ]; then
- shift 1
- log_failure_msg "Usage: pidofproc [-s] [-p pidfile] pathname"
- return 2
- fi
-
- if [ -n "${pidfile}" ]; then
- if [ ! -r "${pidfile}" ]; then
- return 3 # Program is not running
- fi
-
- lpids=`head -n 1 ${pidfile}`
- for pid in ${lpids}
- do
- if [ "${pid}" -ne "$$" -a "${pid}" -ne "${PPID}" ]; then
- kill -0 "${pid}" 2>/dev/null &&
- pidlist="${pidlist} ${pid}"
- fi
-
- if [ "${silent}" != "1" ]; then
- echo "${pidlist}"
- fi
-
- test -z "${pidlist}" &&
- # Program is dead, pidfile exists
- return 1
- # else
- return 0
- done
-
- else
- pidlist=`pidof -o $$ -o $PPID -x "$1"`
- if [ "${silent}" != "1" ]; then
- echo "${pidlist}"
- fi
-
- # Get provide correct running status
- if [ -n "${pidlist}" ]; then
- return 0
- else
- return 3
- fi
-
- fi
-
- if [ "$?" != "0" ]; then
- return 3 # Program is not running
- fi
-}
-
-#*******************************************************************************
-# Function - loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]
-#
-# Purpose: This runs the specified program as a daemon
-#
-# Inputs: -f, run the program even if it is already running
-# -n nicelevel, specifies a nice level. See nice(1).
-# -p pidfile, uses the specified pidfile
-# pathname, pathname to the specified program
-# args, arguments to pass to specified program
-#
-# Outputs: return 0 - Success
-# return 2 - Invalid of excessive number of arguments,
-# warning in stdout
-# return 4 - Program or service status is unknown
-#
-# Dependencies: nice, rm
-#
-# Todo: LSB says this should be called start_daemon
-# LSB does not say that it should call evaluate_retval
-# It checks for PIDFILE, which is deprecated.
-# Will be removed after BLFS 6.0
-# loadproc returns 0 if program is already running, not LSB compliant
-#
-#*******************************************************************************
-loadproc()
-{
- local pidfile=""
- local forcestart=""
- local nicelevel="10"
-
-# This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
-
- while true
- do
- case "${1}" in
- -f)
- forcestart="1"
- shift 1
- ;;
- -n)
- nicelevel="${2}"
- shift 2
- ;;
- -p)
- pidfile="${2}"
- shift 2
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2 #invalid or excess argument(s)
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" = "0" ]; then
- log_failure_msg "Usage: loadproc [-f] [-n nicelevel] [-p pidfile] pathname [args]"
- return 2 #invalid or excess argument(s)
- fi
-
- if [ -z "${forcestart}" ]; then
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- case "${?}" in
- 0)
- log_warning_msg "Unable to continue: ${1} is running"
- return 0 # 4
- ;;
- 1)
- boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING}
- rm -f "${pidfile}"
- ;;
- 3)
- ;;
- *)
- log_failure_msg "Unknown error code from pidofproc: ${?}"
- return 4
- ;;
- esac
- fi
-
- nice -n "${nicelevel}" "${@}"
- evaluate_retval # This is "Probably" not LSB compliant,
-# but required to be compatible with older bootscripts
- return 0
-}
-
-#*******************************************************************************
-# Function - killproc [-p pidfile] pathname [signal]
-#
-# Purpose:
-#
-# Inputs: -p pidfile, uses the specified pidfile
-# pathname, pathname to the specified program
-# signal, send this signal to pathname
-#
-# Outputs: return 0 - Success
-# return 2 - Invalid of excessive number of arguments,
-# warning in stdout
-# return 4 - Unknown Status
-#
-# Dependencies: kill, rm
-#
-# Todo: LSB does not say that it should call evaluate_retval
-# It checks for PIDFILE, which is deprecated.
-# Will be removed after BLFS 6.0
-#
-#*******************************************************************************
-killproc()
-{
- local pidfile=""
- local killsig=TERM # default signal is SIGTERM
- pidlist=""
-
- # This will ensure compatibility with previous LFS Bootscripts
- if [ -n "${PIDFILE}" ]; then
- pidfile="${PIDFILE}"
- fi
-
- while true
- do
- case "${1}" in
- -p)
- pidfile="${2}"
- shift 2
- ;;
- -*)
- log_failure_msg "Unknown Option: ${1}"
- return 2
- ;;
- *)
- break
- ;;
- esac
- done
-
- if [ "${#}" = "2" ]; then
- killsig="${2}"
- elif [ "${#}" != "1" ]; then
- shift 2
- log_failure_msg "Usage: killproc [-p pidfile] pathname [signal]"
- return 2
- fi
-
- # Is the process running?
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Remove stale pidfile
- if [ "$?" = 1 ]; then
- boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING}
- rm -f "${pidfile}"
- fi
-
- # If running, send the signal
- if [ -n "${pidlist}" ]; then
- for pid in ${pidlist}
- do
- kill -${killsig} ${pid} 2>/dev/null
-
- # Wait up to 3 seconds, for ${pid} to terminate
- case "${killsig}" in
- TERM|SIGTERM|KILL|SIGKILL)
- # sleep in 1/10ths of seconds and
- # multiply KILLDELAY by 10
- local dtime="${KILLDELAY}0"
- while [ "${dtime}" != "0" ]
- do
- kill -0 ${pid} 2>/dev/null || break
- sleep 0.1
- dtime=$(( ${dtime} - 1))
- done
- # If ${pid} is still running, kill it
- kill -0 ${pid} 2>/dev/null && kill -KILL ${pid} 2>/dev/null
- ;;
- esac
- done
-
- # Check if the process is still running if we tried to stop it
- case "${killsig}" in
- TERM|SIGTERM|KILL|SIGKILL)
- if [ -z "${pidfile}" ]; then
- pidofproc -s "${1}"
- else
- pidofproc -s -p "${pidfile}" "${1}"
- fi
-
- # Program was terminated
- if [ "$?" != "0" ]; then
- # Remove the pidfile if necessary
- if [ -f "${pidfile}" ]; then
- rm -f "${pidfile}"
- fi
- echo_ok
- return 0
- else # Program is still running
- echo_failure
- return 4 # Unknown Status
- fi
- ;;
- *)
- # Just see if the kill returned successfully
- evaluate_retval
- ;;
- esac
- else # process not running
- print_status warning not_running
- fi
-}
-
-
-#*******************************************************************************
-# Function - log_success_msg "message"
-#
-# Purpose: Print a success message
-#
-# Inputs: $@ - Message
-#
-# Outputs: Text output to screen
-#
-# Dependencies: echo
-#
-# Todo: logging
-#
-#*******************************************************************************
-log_success_msg()
-{
- ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
- ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}"
-
- [ -d /run/var ] || return 0
- ${ECHO} -n -e "${@} [ OK ]" >> /run/var/bootlog
- return 0
-}
-
-#*******************************************************************************
-# Function - log_failure_msg "message"
-#
-# Purpose: Print a failure message
-#
-# Inputs: $@ - Message
-#
-# Outputs: Text output to screen
-#
-# Dependencies: echo
-#
-# Todo: logging
-#
-#*******************************************************************************
-log_failure_msg() {
- ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
- ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}"
-
- [ -d /run/var ] || return 0
- ${ECHO} -e "${@} [ FAIL ]" >> /run/var/bootlog
- return 0
-}
-
-#*******************************************************************************
-# Function - log_warning_msg "message"
-#
-# Purpose: print a warning message
-#
-# Inputs: $@ - Message
-#
-# Outputs: Text output to screen
-#
-# Dependencies: echo
-#
-# Todo: logging
-#
-#*******************************************************************************
-log_warning_msg() {
- ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
- ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}"
-
- [ -d /run/var ] || return 0
- ${ECHO} -e "${@} [ WARN ]" >> /run/var/bootlog
- return 0
-}
-
-#*******************************************************************************
-# Function - log_skipped_msg "message"
-#
-# Purpose: print a message that the script was skipped
-#
-# Inputs: $@ - Message
-#
-# Outputs: Text output to screen
-#
-# Dependencies: echo
-#
-# Todo: logging
-#
-#*******************************************************************************
-log_skipped_msg() {
- ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}"
- ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" SKIP ""${BRACKET}""]""${NORMAL}"
-
- [ -d /run/var ] || return 0
- ${ECHO} -e "${@} [ SKIP ]" >> /run/var/bootlog
- return 0
-}
-
-# End boot functions
diff --git a/bootscripts/lfs/init.d/localnet b/bootscripts/lfs/init.d/localnet
index 7afcb72dd..4b85a987f 100644
--- a/bootscripts/lfs/init.d/localnet
+++ b/bootscripts/lfs/init.d/localnet
@@ -28,6 +28,7 @@
. /lib/lsb/init-functions
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
+[ -r /etc/hostname ] && HOSTNAME=`cat /etc/hostname`
case "${1}" in
start)
diff --git a/bootscripts/lfs/init.d/mountfs b/bootscripts/lfs/init.d/mountfs
index 6784a6943..4605d6096 100644
--- a/bootscripts/lfs/init.d/mountfs
+++ b/bootscripts/lfs/init.d/mountfs
@@ -39,6 +39,9 @@ case "${1}" in
# Remove fsck-related file system watermarks.
rm -f /fastboot /forcefsck
+ # Make sure /dev/pts exists
+ mkdir -p /dev/pts
+
# This will mount all filesystems that do not have _netdev in
# their option list. _netdev denotes a network filesystem.
diff --git a/bootscripts/lfs/init.d/mountvirtfs b/bootscripts/lfs/init.d/mountvirtfs
index 9c0d0f24d..efbb29d87 100644
--- a/bootscripts/lfs/init.d/mountvirtfs
+++ b/bootscripts/lfs/init.d/mountvirtfs
@@ -31,12 +31,12 @@
case "${1}" in
start)
- # Make sure /run/var is available before logging any messages
+ # Make sure /run is available before logging any messages
if ! mountpoint /run >/dev/null; then
mount /run || failed=1
fi
- mkdir -p /run/var /run/lock /run/shm
+ mkdir -p /run/lock /run/shm
chmod 1777 /run/shm
log_info_msg "Mounting virtual file systems: ${INFO}/run"
diff --git a/bootscripts/lfs/init.d/rc b/bootscripts/lfs/init.d/rc
index 30b5fe059..93d6ea942 100644
--- a/bootscripts/lfs/init.d/rc
+++ b/bootscripts/lfs/init.d/rc
@@ -217,13 +217,13 @@ fi
# Copy the boot log on initial boot only
if [ "${previous}" == "N" -a "${runlevel}" != "S" ]; then
- cat /run/var/bootlog >> /var/log/boot.log
+ cat $BOOTLOG >> /var/log/boot.log
# Mark the end of boot
echo "--------" >> /var/log/boot.log
# Remove the temporary file
- rm -f /run/var/bootlog 2> /dev/null
+ rm -f $BOOTLOG 2> /dev/null
fi
# End rc
diff --git a/bootscripts/lfs/init.d/udev b/bootscripts/lfs/init.d/udev
index ab56ab9e3..9e784ccb2 100644
--- a/bootscripts/lfs/init.d/udev
+++ b/bootscripts/lfs/init.d/udev
@@ -49,17 +49,17 @@ case "${1}" in
# Start the udev daemon to continually watch for, and act on,
# uevents
- /sbin/udevd --daemon
+ /lib/systemd-udevd --daemon
# Now traverse /sys in order to "coldplug" devices that have
# already been discovered
- /sbin/udevadm trigger --action=add --type=subsystems
- /sbin/udevadm trigger --action=add --type=devices
- /sbin/udevadm trigger --action=change --type=devices
+ /bin/udevadm trigger --action=add --type=subsystems
+ /bin/udevadm trigger --action=add --type=devices
+ /bin/udevadm trigger --action=change --type=devices
# Now wait for udevd to process the uevents we triggered
if ! is_true "$OMIT_UDEV_SETTLE"; then
- /sbin/udevadm settle
+ /bin/udevadm settle
fi
# If any LVM based partitions are on the system, ensure they
diff --git a/bootscripts/lfs/init.d/udev_retry b/bootscripts/lfs/init.d/udev_retry
index c921fc451..5db644a8b 100644
--- a/bootscripts/lfs/init.d/udev_retry
+++ b/bootscripts/lfs/init.d/udev_retry
@@ -35,7 +35,7 @@ case "${1}" in
log_info_msg "Retrying failed uevents, if any..."
# As of udev-186, the --run option is no longer valid
- #rundir=$(/sbin/udevadm info --run)
+ #rundir=$(/bin/udevadm info --run)
rundir=/run/udev
# From Debian: "copy the rules generated before / was mounted
# read-write":
@@ -52,13 +52,13 @@ case "${1}" in
/bin/sed -e 's/#.*$//' /etc/sysconfig/udev_retry | /bin/grep -v '^$' | \
while read line ; do
for subsystem in $line ; do
- /sbin/udevadm trigger --subsystem-match=$subsystem --action=add
+ /bin/udevadm trigger --subsystem-match=$subsystem --action=add
done
done
# Now wait for udevd to process the uevents we triggered
if ! is_true "$OMIT_UDEV_RETRY_SETTLE"; then
- /sbin/udevadm settle
+ /bin/udevadm settle
fi
evaluate_retval
diff --git a/bootscripts/lfs/lib/services/init-functions b/bootscripts/lfs/lib/services/init-functions
index 06a7f588c..a09f6188b 100644
--- a/bootscripts/lfs/lib/services/init-functions
+++ b/bootscripts/lfs/lib/services/init-functions
@@ -71,7 +71,7 @@ SUCCESS_SUFFIX="${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
FAILURE_SUFFIX="${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
WARNING_SUFFIX="${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
-BOOTLOG=/run/var/bootlog
+BOOTLOG=/run/bootlog
KILLDELAY=3
# Set any user specified environment variables e.g. HEADLESS
diff --git a/bootscripts/lfs/lib/systemd/ifupdown@.service b/bootscripts/lfs/lib/systemd/ifupdown@.service
new file mode 100644
index 000000000..963b8731c
--- /dev/null
+++ b/bootscripts/lfs/lib/systemd/ifupdown@.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Start ifupdown for %I
+BindTo=sys-subsystem-net-devices-%i.device
+ConditionPathExists=/etc/sysconfig/ifconfig.%i
+
+[Service]
+ExecStart=/sbin/ifup %I
+ExecStop=/sbin/ifdown %I
+RemainAfterExit=true
+
+[Install]
+WantedBy=multi-user.target
diff --git a/bootscripts/lfs/units/ifupdownat.service b/bootscripts/lfs/units/ifupdownat.service
new file mode 100644
index 000000000..963b8731c
--- /dev/null
+++ b/bootscripts/lfs/units/ifupdownat.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Start ifupdown for %I
+BindTo=sys-subsystem-net-devices-%i.device
+ConditionPathExists=/etc/sysconfig/ifconfig.%i
+
+[Service]
+ExecStart=/sbin/ifup %I
+ExecStop=/sbin/ifdown %I
+RemainAfterExit=true
+
+[Install]
+WantedBy=multi-user.target