mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-07-03 10:59:21 +01:00
Changes per thread starting at http://archive.linuxfromscratch.org/mail-archives/lfs-dev/2011-May/064677.html
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9532 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
b4a678295e
commit
dc55fb5e4b
@ -5,6 +5,13 @@ ChangeLog
|
||||
where user input is not appropriate in the event of a failure
|
||||
* Moved configuration of clock and hostname to rc.site
|
||||
* Removed $time provides from setclock script
|
||||
* Setup the /run mountpoint in the rc script (for use by bootloging)
|
||||
* Moved network services to /lib/network-services
|
||||
* Moved network configuration files to /etc/network
|
||||
* Moved ifup and ifdown scripts to /sbin
|
||||
* ifup - copy network configuration scritps to /run on startup
|
||||
* ifdown - use running configuration stored in /run to stop interfaces
|
||||
* Moved sysconfig files to /etc/default
|
||||
|
||||
20110424 - [dj]
|
||||
* Sync to LFS-Bootscripts-20110424 (move new run mounts and
|
||||
|
@ -17,6 +17,7 @@ create-dirs:
|
||||
install -d -m ${DIRMODE} ${EXTDIR}/rcS.d
|
||||
install -d -m ${DIRMODE} ${EXTDIR}/init.d
|
||||
install -d -m ${DIRMODE} ${EXTDIR}/default
|
||||
install -d -m ${DIRMODE} ${EXTDIR}/network
|
||||
install -d -m ${DIRMODE} ${DESTDIR}/lib/lsb
|
||||
install -d -m ${DIRMODE} ${EXTDIR}/lsb/state
|
||||
install -d -m ${DIRMODE} ${DESTDIR}/lib/network-services
|
||||
|
@ -1,5 +1,5 @@
|
||||
########################################################################
|
||||
# Begin /etc/sysconfig/createfiles
|
||||
# Begin /etc/default/createfiles
|
||||
#
|
||||
# Description : Createfiles script config file
|
||||
#
|
||||
|
@ -1,5 +1,5 @@
|
||||
########################################################################
|
||||
# Begin /etc/sysconfig/modules
|
||||
# Begin /etc/default/modules
|
||||
#
|
||||
# Description : Module auto-loading configuration
|
||||
#
|
||||
@ -15,4 +15,4 @@
|
||||
# a space or a tab.
|
||||
########################################################################
|
||||
|
||||
# End /etc/sysconfig/modules
|
||||
# End /etc/default/modules
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Begin /etc/sysconfig/rc
|
||||
# Begin /etc/default/rc
|
||||
|
||||
# Author: DJ Lucas - dj@linuxfromscratch.org
|
||||
# Version: 1.0 LSB V.3.1
|
||||
@ -7,7 +7,7 @@
|
||||
# Local variables for the rc script are in lowercase
|
||||
|
||||
# Source site specific rc configuration
|
||||
. /etc/sysconfig/rc.site
|
||||
. /etc/default/rc.site
|
||||
|
||||
# This sets default terminal options.
|
||||
# stty sane - this has been removed as nobody recalls
|
||||
@ -38,15 +38,7 @@ 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
|
||||
|
||||
# Bootlogging and interactive startup require a valid tempfs mount
|
||||
# if this mount is not present, disable them
|
||||
if [ "${TEMPFS_MOUNT}" = "" -o ! -d "${TEMPFS_MOUNT}" ]; then
|
||||
TEMPFS_MOUNT=""
|
||||
iprompt=""
|
||||
BOOTLOG_ENAB=""
|
||||
fi
|
||||
|
||||
# Export the environment variables so they are inherited by the scripts
|
||||
export PATH SET_COL SET_WCOL CURS_UP TEMPFS_MOUNT BOOTLOG_ENAB RUNLEVEL
|
||||
export PATH SET_COL SET_WCOL CURS_UP BOOTLOG_ENAB
|
||||
|
||||
# End /etc/sysconfig/rc
|
||||
# End /etc/default/rc
|
||||
|
@ -3,12 +3,7 @@ RC_BASE="/etc"
|
||||
RC_FUNCTIONS="${RC_BASE}/init.d/lfs-functions"
|
||||
|
||||
# Location of network device scripts and config files
|
||||
NETWORK_DEVICES="/etc/sysconfig/network-devices"
|
||||
|
||||
# Directory to store boot process accounting information
|
||||
# Used for boot logging and interactive flag when rootfs
|
||||
# is not writable
|
||||
TEMPFS_MOUNT="${RC_BASE}/init.d/boottemp"
|
||||
NETWORK_DEVICES="/etc/network"
|
||||
|
||||
# Bootlogging (requires a tempfs mount)
|
||||
BOOTLOG_ENAB="yes"
|
||||
@ -43,7 +38,7 @@ PREFIX_WARNING="${WARNING}**${NORMAL} "
|
||||
PREFIX_FAILURE="${FAILURE}***${NORMAL}"
|
||||
|
||||
# Export varialbles so that they are inherited by the initscripts
|
||||
export RC_BASE RC_FUNCTIONS NETWORK_DEVICES TEMPFS_MOUNT BOOTLOG_ENAB
|
||||
export RC_BASE RC_FUNCTIONS NETWORK_DEVICES BOOTLOG_ENAB
|
||||
export HOSTNAME UTC CLOCKPARAMS FAILURE_ACTION
|
||||
export DISTRO DISTRO_CONTACT DISTRO_MINI
|
||||
export BRACKET FAILURE INFO NORMAL SUCCESS WARNING
|
||||
@ -79,3 +74,4 @@ print_error_msg()
|
||||
$FAILURE_ACTION
|
||||
}
|
||||
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# 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.
|
||||
# defined in /etc/default/createfiles.
|
||||
# X-LFS-Provided-By: LFS
|
||||
### END INIT INFO
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
create_files()
|
||||
{
|
||||
# Read in the configuration file.
|
||||
exec 9>&0 < /etc/sysconfig/createfiles
|
||||
exec 9>&0 < /etc/default/createfiles
|
||||
while read name type perm usr grp dtype maj min junk
|
||||
do
|
||||
# Ignore comments and blank lines.
|
||||
@ -89,7 +89,7 @@ case "${1}" in
|
||||
(exit ${failed})
|
||||
evaluate_retval standard
|
||||
|
||||
if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null
|
||||
if egrep -qv '^(#|$)' /etc/default/createfiles 2>/dev/null
|
||||
then
|
||||
message="Creating files and directories..."
|
||||
create_files
|
||||
|
@ -11,7 +11,7 @@
|
||||
# Default-Stop:
|
||||
# Short-Description: Sets up a localised console.
|
||||
# Description: Sets up fonts and language settings for the user's
|
||||
# local as defined by /etc/sysconfig/console.
|
||||
# local as defined by /etc/default/console.
|
||||
# X-LFS-Provided-By: LFS
|
||||
### END INIT INFO
|
||||
|
||||
@ -19,10 +19,10 @@
|
||||
|
||||
MESSAGE="Setting up Linux console..."
|
||||
|
||||
# Native English speakers probably don't have /etc/sysconfig/console at all
|
||||
if [ -f /etc/sysconfig/console ]
|
||||
# Native English speakers probably don't have /etc/default/console at all
|
||||
if [ -f /etc/default/console ]
|
||||
then
|
||||
. /etc/sysconfig/console
|
||||
. /etc/default/console
|
||||
fi
|
||||
|
||||
is_true() {
|
||||
|
@ -10,7 +10,7 @@
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Loads required modules.
|
||||
# Description: Loads modules listed in /etc/sysconfig/modules.
|
||||
# Description: Loads modules listed in /etc/default/modules.
|
||||
# X-LFS-Provided-By: LFS
|
||||
### END INIT INFO
|
||||
|
||||
@ -24,8 +24,8 @@ case "${1}" in
|
||||
|
||||
# Exit if there's no modules file or there are no
|
||||
# valid entries
|
||||
[ -r /etc/sysconfig/modules ] &&
|
||||
egrep -qv '^($|#)' /etc/sysconfig/modules ||
|
||||
[ -r /etc/default/modules ] &&
|
||||
egrep -qv '^($|#)' /etc/default/modules ||
|
||||
exit 0
|
||||
|
||||
# If proc is mounted, find the current kernel
|
||||
@ -44,11 +44,11 @@ case "${1}" in
|
||||
|
||||
# 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
|
||||
if egrep -qv '^(#|$)' /etc/default/modules 2>/dev/null
|
||||
then
|
||||
|
||||
# Read in the configuration file.
|
||||
exec 9>&0 < /etc/sysconfig/modules
|
||||
exec 9>&0 < /etc/default/modules
|
||||
|
||||
message="${INFO}Loading modules:"
|
||||
|
||||
|
@ -30,11 +30,8 @@ case "${1}" in
|
||||
mount -n /sys || failed=1
|
||||
fi
|
||||
|
||||
if ! mountpoint /run > /dev/null; then
|
||||
message="${message}${INFO} /run${NORMAL}"
|
||||
mount -n /run || failed=1
|
||||
mkdir /run/{var,lock,shm} || failed=1
|
||||
fi
|
||||
# create needed directories in /run
|
||||
mkdir /run/{var,lock,shm} || failed=1
|
||||
|
||||
(exit ${failed})
|
||||
evaluate_retval standard
|
||||
|
@ -15,7 +15,6 @@
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
. /etc/sysconfig/network
|
||||
|
||||
case "${1}" in
|
||||
start)
|
||||
@ -29,14 +28,14 @@ case "${1}" in
|
||||
then
|
||||
continue
|
||||
fi
|
||||
IN_BOOT=1 ${NETWORK_DEVICES}/ifup ${interface}
|
||||
IN_BOOT=1 /sbin/ifup ${interface}
|
||||
done
|
||||
;;
|
||||
|
||||
stop)
|
||||
# Reverse list
|
||||
FILES=""
|
||||
for file in ${NETWORK_DEVICES}/ifconfig.*
|
||||
for file in /run/network/ifconfig.*
|
||||
do
|
||||
FILES="${file} ${FILES}"
|
||||
done
|
||||
@ -52,7 +51,7 @@ case "${1}" in
|
||||
continue
|
||||
fi
|
||||
|
||||
IN_BOOT=1 ${NETWORK_DEVICES}/ifdown ${interface}
|
||||
IN_BOOT=1 /sbin/ifdown ${interface}
|
||||
done
|
||||
;;
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
# Get the configuration file
|
||||
# All changes are to occur in the config file
|
||||
. /etc/sysconfig/rc
|
||||
. /etc/default/rc
|
||||
|
||||
# These 3 signals will not cause our script to exit
|
||||
trap "" INT QUIT TSTP
|
||||
@ -25,9 +25,9 @@ if [ "${prevlevel}" = "" ]; then
|
||||
prevlevel="N"
|
||||
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
|
||||
# Mount /run
|
||||
if [ "${runlevel}" = "S" ]; then
|
||||
mount -n -t tmpfs tmpfs /run
|
||||
fi
|
||||
|
||||
# Provide an interactive prompt (if requested)
|
||||
@ -52,7 +52,7 @@ if [ "${runlevel}" = "S" -a "${iprompt}" = "yes" ]; then
|
||||
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"
|
||||
echo "interactive=I" > /run/.interactive-start
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -66,8 +66,8 @@ if [ ! -d "${RC_BASE}/rc${runlevel}.d" ]; then
|
||||
fi
|
||||
|
||||
# Source the interactive state file if it exists
|
||||
if [ "${runlevel}" != "S" -a -f "${TEMPFS_MOUNT}/.interactive-start" ]; then
|
||||
. "${TEMPFS_MOUNT}/.interactive-start"
|
||||
if [ "${runlevel}" != "S" -a -f /run/.interactive-start ]; then
|
||||
. /run/.interactive-start
|
||||
fi
|
||||
|
||||
# Prompt for interactive startup after completing S
|
||||
@ -180,17 +180,22 @@ done
|
||||
|
||||
# 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
|
||||
if [ -f /run/.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"
|
||||
sed -i 's@\\033\[[0-9];[0-9][0-9]m@@g' /run/.bootlog
|
||||
#Fix the time and hostname
|
||||
BTIMESPEC=$(echo `date +"%b %d %T"` `hostname`)
|
||||
sed -i "s@^bootlog:@${BTIMESPEC} bootlog:@" "${TEMPFS_MOUNT}/.bootlog"
|
||||
sed -i "s@^bootlog:@${BTIMESPEC} bootlog:@" /run/.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"
|
||||
cat /run/.bootlog >> /var/log/boot.log
|
||||
rm -f /run/.bootlog
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove interactive boot temp file
|
||||
if [ -f /run/.interactive-start -a "${runlevel}" != "S" ]; then
|
||||
rm -f /run/.interactive-start
|
||||
fi
|
||||
|
||||
# End $RC_BASE/init.d/rc
|
||||
|
@ -24,7 +24,7 @@
|
||||
# documentaion in the lfs-fucntions file for more information.
|
||||
MESSAGE="Template Service"
|
||||
BIN_FILE="/some/path/to/template"
|
||||
CONFIGFILE="/etc/sysconfig/template.conf"
|
||||
CONFIGFILE="/etc/default/template.conf"
|
||||
|
||||
# check that $BIN_FILE exists and is executable, and $CONFIGFILE exists.
|
||||
chk_stat
|
||||
|
@ -33,10 +33,11 @@ case "${1}" in
|
||||
/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').
|
||||
# If not using DEVTMPFS 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').
|
||||
if ! mountpoint /dev > /dev/null; then
|
||||
mount -n -t tmpfs tmpfs /dev -o mode=755
|
||||
fi
|
||||
@ -57,11 +58,14 @@ case "${1}" in
|
||||
|
||||
# Udev handles uevents itself, so we don't need to have
|
||||
# the kernel call out to any binary in response to them
|
||||
# This is a failsafe and should be done in kernel config
|
||||
echo > /proc/sys/kernel/hotplug
|
||||
|
||||
# Copy the only static device node that Udev >= 155 doesn't
|
||||
# handle to /dev
|
||||
cp -a /lib/udev/devices/null /dev
|
||||
# handle to /dev (handled by default with DEVTMPFS)
|
||||
if [ ! -f /dev/null ]; then
|
||||
cp -a /lib/udev/devices/null /dev
|
||||
fi
|
||||
|
||||
# Start the udev daemon to continually watch for, and act on,
|
||||
# uevents
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
# Source rc configuration if not inherited from the environment
|
||||
if [ "${RC_BASE}" = "" ]; then
|
||||
. /etc/sysconfig/rc
|
||||
. /etc/default/rc
|
||||
fi
|
||||
|
||||
# Source the distro functions file
|
||||
@ -449,7 +449,9 @@ log_success_msg()
|
||||
else
|
||||
BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) "
|
||||
fi
|
||||
echo "${BTTIMESPEC}bootlog: ${@} Successful" >> "${TEMPFS_MOUNT}/.bootlog"
|
||||
if [ "${RUNLEVEL}" != "0" -a "${RUNLEVEL}" != "6" ]; then
|
||||
echo "${BTTIMESPEC}bootlog: ${@} Successful" >> /run/.bootlog
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -476,7 +478,9 @@ log_failure_msg()
|
||||
else
|
||||
BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) "
|
||||
fi
|
||||
echo "${BTTIMESPEC}bootlog: ${@} Failed!" >> "${TEMPFS_MOUNT}/.bootlog"
|
||||
if [ "${RUNLEVEL}" != "0" -a "${RUNLEVEL}" != "6" ]; then
|
||||
echo "${BTTIMESPEC}bootlog: ${@} Failed!" >> /run/.bootlog
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
@ -503,7 +507,9 @@ log_warning_msg()
|
||||
else
|
||||
BTTIMESPEC="$(echo `date -u +"%b %d %T"` `hostname`) "
|
||||
fi
|
||||
echo "${BTTIMESPEC}bootlog: ${@} Warning" >> "${TEMPFS_MOUNT}/.bootlog"
|
||||
if [ "${RUNLEVEL}" != "0" -a "${RUNLEVEL}" != "6" ]; then
|
||||
echo "${BTTIMESPEC}bootlog: ${@} Warning" >> /run/.bootlog
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
@ -20,12 +20,12 @@
|
||||
# Collect a list of configuration files for our interface
|
||||
if [ -n "${2}" ]; then
|
||||
for file in ${@#$1}; do # All parameters except $1
|
||||
FILES="${FILES} ${NETWORK_DEVICES}/ifconfig.${1}/${file}"
|
||||
FILES="${FILES} /run/network/ifconfig.${1}/${file}"
|
||||
done
|
||||
elif [ -d "${NETWORK_DEVICES}/ifconfig.${1}" ]; then
|
||||
FILES=`echo ${NETWORK_DEVICES}/ifconfig.${1}/*`
|
||||
elif [ -d "/run/network/ifconfig.${1}" ]; then
|
||||
FILES=`echo /run/network/ifconfig.${1}/*`
|
||||
else
|
||||
FILES="${NETWORK_DEVICES}/ifconfig.${1}"
|
||||
FILES="/run/network/ifconfig.${1}"
|
||||
fi
|
||||
|
||||
# Reverse the order configuration files are processed in
|
||||
@ -46,7 +46,9 @@ for file in ${FILES}; do
|
||||
log_warning_msg
|
||||
fi
|
||||
(
|
||||
. ${file}
|
||||
if [ ! -d "${file}" ]; then
|
||||
. ${file}
|
||||
fi
|
||||
|
||||
# Will not process this service if started by boot, and ONBOOT
|
||||
# is not set to yes
|
||||
@ -61,10 +63,13 @@ for file in ${FILES}; do
|
||||
fi
|
||||
|
||||
# This will run the service script, if SERVICE is set
|
||||
if [ -n "${SERVICE}" -a -x "${NETWORK_DEVICES}/services/${SERVICE}" ]; then
|
||||
if [ -n "${SERVICE}" -a -x "/lib/network-services/${SERVICE}" ]; then
|
||||
if ip link show ${1} > /dev/null 2>&1
|
||||
then
|
||||
IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} down
|
||||
IFCONFIG=${file} /lib/network-services/${SERVICE} ${1} down &&
|
||||
if [ -f "${file}" ]; then
|
||||
rm ${file}
|
||||
fi
|
||||
else
|
||||
message="Interface ${1} doesn't exist."
|
||||
log_warning_msg
|
||||
|
@ -45,7 +45,9 @@ for file in ${FILES}; do
|
||||
fi
|
||||
|
||||
(
|
||||
. ${file}
|
||||
if [ ! -d "${file}" ]; then
|
||||
. ${file}
|
||||
fi
|
||||
|
||||
# Will not process this service if started by boot, and ONBOOT
|
||||
# is not set to yes
|
||||
@ -58,7 +60,7 @@ for file in ${FILES}; do
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -n "${SERVICE}" -a -x "${NETWORK_DEVICES}/services/${SERVICE}" ]; then
|
||||
if [ -n "${SERVICE}" -a -x "/lib/network-services/${SERVICE}" ]; then
|
||||
if [ -z "${CHECK_LINK}" -o "${CHECK_LINK}" = "y" -o "${CHECK_LINK}" = "yes" -o "${CHECK_LINK}" = "1" ]; then
|
||||
if ip link show ${1} > /dev/null 2>&1; then
|
||||
link_status=`ip link show ${1}`
|
||||
@ -73,7 +75,15 @@ for file in ${FILES}; do
|
||||
log_warning_msg
|
||||
fi
|
||||
fi
|
||||
IFCONFIG=${file} ${NETWORK_DEVICES}/services/${SERVICE} ${1} up
|
||||
IFCONFIG=${file} /lib/network-services/${SERVICE} ${1} up
|
||||
if [ "${?}" -eq "0" ]; then
|
||||
if [ ! -d "${file}" -a "${file}" != "${NETWORK_DEVICES}/ifconfig.${1}" ]; then
|
||||
mkdir -p "/run/network/ifconfig.${1}"
|
||||
cp "${file}" "/run/network/ifconfig.${1}"
|
||||
elif [ ! -d "${file}" ]; then
|
||||
cp "${file}" "/run/network/"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "${FAILURE}Unable to process ${file}. Either"
|
||||
echo -e "${FAILURE}the SERVICE variable was not set,"
|
||||
|
Loading…
Reference in New Issue
Block a user