|
@@ -2,13 +2,13 @@
|
|
|
########################################################################
|
|
|
# Begin rc
|
|
|
#
|
|
|
-# 描述 : 主要运行级别控制脚本
|
|
|
+# Description : Main Run Level Control Script
|
|
|
#
|
|
|
-# 作者 : Gerard Beekmans - gerard@linuxfromscratch.org
|
|
|
+# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
|
|
|
# : DJ Lucas - dj@linuxfromscratch.org
|
|
|
-# 更新者 : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
|
|
+# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
|
|
|
#
|
|
|
-# 版本 : LFS 7.0
|
|
|
+# Version : LFS 7.0
|
|
|
#
|
|
|
########################################################################
|
|
|
|
|
@@ -80,7 +80,7 @@ run()
|
|
|
return $ret
|
|
|
}
|
|
|
|
|
|
-# 读入所有本地设置和覆盖选项
|
|
|
+# Read any local settings/overrides
|
|
|
[ -r /etc/sysconfig/rc.site ] && source /etc/sysconfig/rc.site
|
|
|
|
|
|
DISTRO=${DISTRO:-"Linux From Scratch"}
|
|
@@ -88,7 +88,7 @@ DISTRO_CONTACT=${DISTRO_CONTACT:-"lfs-dev@linuxfromscratch.org (Registration req
|
|
|
DISTRO_MINI=${DISTRO_MINI:-"LFS"}
|
|
|
IPROMPT=${IPROMPT:-"no"}
|
|
|
|
|
|
-# 这三个信号不会使得该脚本退出
|
|
|
+# These 3 signals will not cause our script to exit
|
|
|
trap "" INT QUIT TSTP
|
|
|
|
|
|
[ "${1}" != "" ] && runlevel=${1}
|
|
@@ -108,24 +108,24 @@ fi
|
|
|
|
|
|
if [ "$runlevel" == "6" -o "$runlevel" == "0" ]; then IPROMPT="no"; fi
|
|
|
|
|
|
-# 注意: ${LOGLEVEL:-7} 中, ':-7' 应读作 '冒号' '杠' '七', 不是负七。
|
|
|
+# Note: In ${LOGLEVEL:-7}, it is ':' 'dash' '7', not minus 7
|
|
|
if [ "$runlevel" == "S" ]; then
|
|
|
[ -r /etc/sysconfig/console ] && source /etc/sysconfig/console
|
|
|
dmesg -n "${LOGLEVEL:-7}"
|
|
|
fi
|
|
|
|
|
|
if [ "${IPROMPT}" == "yes" -a "${runlevel}" == "S" ]; then
|
|
|
- # 发行版欢迎消息字符串的总长度,不计转义代码
|
|
|
+ # The total length of the distro welcome string, without escape codes
|
|
|
wlen=${wlen:-$(echo "Welcome to ${DISTRO}" | wc -c )}
|
|
|
welcome_message=${welcome_message:-"Welcome to ${INFO}${DISTRO}${NORMAL}"}
|
|
|
|
|
|
- # 交互字符串的总长度,不计转义代码
|
|
|
+ # The total length of the interactive string, without escape codes
|
|
|
ilen=${ilen:-$(echo "Press 'I' to enter interactive startup" | wc -c )}
|
|
|
i_message=${i_message:-"Press '${FAILURE}I${NORMAL}' to enter interactive startup"}
|
|
|
|
|
|
|
|
|
- # dcol 和 icol 是消息前应有的空格数,这些空格使得消息居中。
|
|
|
- # itime 是等待用户输入按键的时间。
|
|
|
+ # dcol and icol are spaces before the message to center the message
|
|
|
+ # on screen. itime is the amount of wait time for the user to press a key
|
|
|
wcol=$(( ( ${COLUMNS} - ${wlen} ) / 2 ))
|
|
|
icol=$(( ( ${COLUMNS} - ${ilen} ) / 2 ))
|
|
|
itime=${itime:-"3"}
|
|
@@ -137,14 +137,15 @@ if [ "${IPROMPT}" == "yes" -a "${runlevel}" == "S" ]; then
|
|
|
read -t "${itime}" -n 1 interactive 2>&1 > /dev/null
|
|
|
fi
|
|
|
|
|
|
-# 将用户输入变成小写
|
|
|
+# Make lower case
|
|
|
[ "${interactive}" == "I" ] && interactive="i"
|
|
|
[ "${interactive}" != "i" ] && interactive=""
|
|
|
|
|
|
-# 如果是从运行级别 S 切换而来,读入状态文件
|
|
|
+# Read the state file if it exists from runlevel S
|
|
|
[ -r /var/run/interactive ] && source /var/run/interactive
|
|
|
|
|
|
-# 试图停止那些在上一运行级别启动,而在该运行级别中禁用的服务
|
|
|
+# Attempt to stop all services started by the previous runlevel,
|
|
|
+# and killed in this runlevel
|
|
|
if [ "${previous}" != "N" ]; then
|
|
|
for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null)
|
|
|
do
|
|
@@ -183,7 +184,7 @@ if [ "$runlevel" == "6" -a -n "${FASTBOOT}" ]; then
|
|
|
fi
|
|
|
|
|
|
|
|
|
-# 启动该运行级别启用的所有服务
|
|
|
+# Start all functions in this runlevel
|
|
|
for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null)
|
|
|
do
|
|
|
if [ "${previous}" != "N" ]; then
|
|
@@ -214,21 +215,21 @@ do
|
|
|
if [ "${error_value}" != "0" ]; then print_error_msg; fi
|
|
|
done
|
|
|
|
|
|
-# 对于运行级别 S,保存交互状态,否则删除状态文件
|
|
|
+# Store interactive variable on switch from runlevel S and remove if not
|
|
|
if [ "${runlevel}" == "S" -a "${interactive}" == "i" ]; then
|
|
|
echo "interactive=\"i\"" > /var/run/interactive
|
|
|
else
|
|
|
rm -f /var/run/interactive 2> /dev/null
|
|
|
fi
|
|
|
|
|
|
-# 仅为初次引导复制引导日志
|
|
|
+# Copy the boot log on initial boot only
|
|
|
if [ "${previous}" == "N" -a "${runlevel}" != "S" ]; then
|
|
|
cat $BOOTLOG >> /var/log/boot.log
|
|
|
|
|
|
- # 标记引导结束
|
|
|
+ # Mark the end of boot
|
|
|
echo "--------" >> /var/log/boot.log
|
|
|
|
|
|
- # 删除临时文件
|
|
|
+ # Remove the temporary file
|
|
|
rm -f $BOOTLOG 2> /dev/null
|
|
|
fi
|
|
|
|