mirror of
https://github.com/Poltern/lfs-ru.git
synced 2024-10-18 11:50:21 +03:00
Update lfs-bootscripts to only output escape sequences to a terminal.
Add -n to the ln command, for recreating /dev/fd correctly if the initramfs has already created one
This commit is contained in:
parent
d635a9860c
commit
e88e84f858
@ -1,3 +1,11 @@
|
||||
2024-07-12 Xi Ruoyao <xry111@xry111.site>
|
||||
* In mountvirtfs, recreate /dev/fd correctly if it's already created
|
||||
by the initramfs.
|
||||
|
||||
2024-07-06 Bruce Dubbs <bdubbs@linuxfromscratch.org>
|
||||
* Add logic to init-functions to only print escape sequences
|
||||
if stdin and stdout are connected to a terminal.
|
||||
|
||||
2024-04-16 Bruce Dubbs <bdubbs@linuxfromscratch.org>
|
||||
* Remove blank output line generated in ifup script when bringing
|
||||
up wireless interface.
|
||||
|
@ -83,7 +83,7 @@ case "${1}" in
|
||||
ln -sf /proc/self/fd/2 /dev/stderr || failed=1
|
||||
|
||||
log_info_msg2 " ${INFO}/dev/fd"
|
||||
ln -sf /proc/self/fd /dev/fd || failed=1
|
||||
ln -sfn /proc/self/fd /dev/fd || failed=1
|
||||
|
||||
if [ -e /proc/kcore ]; then
|
||||
log_info_msg2 " ${INFO}/dev/core"
|
||||
|
@ -58,11 +58,21 @@ SCRIPT_STAT="0"
|
||||
# Set any user specified environment variables e.g. HEADLESS
|
||||
[ -r /etc/sysconfig/rc.site ] && . /etc/sysconfig/rc.site
|
||||
|
||||
## Screen Dimensions
|
||||
# Find current screen size
|
||||
if [ -z "${COLUMNS}" ]; then
|
||||
COLUMNS=$(stty size)
|
||||
COLUMNS=${COLUMNS##* }
|
||||
# If HEADLESS is set, use that.
|
||||
# If file descriptor 1 or 2 (stdout and stderr) is not open or
|
||||
# does not refer to a terminal, consider the script headless.
|
||||
[ ! -t 1 -o ! -t 2 ] && HEADLESS=${HEADLESS:-yes}
|
||||
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
## Screen Dimensions
|
||||
# Find current screen size
|
||||
if [ -z "${COLUMNS}" ]; then
|
||||
COLUMNS=$(stty size)
|
||||
COLUMNS=${COLUMNS##* }
|
||||
fi
|
||||
else
|
||||
COLUMNS=80
|
||||
fi
|
||||
|
||||
# When using remote connections, such as a serial port, stty size returns 0
|
||||
@ -575,9 +585,14 @@ timespec()
|
||||
################################################################################
|
||||
log_success_msg()
|
||||
{
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}"
|
||||
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}"
|
||||
else
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
/bin/echo -e "${logmessage} OK"
|
||||
fi
|
||||
# Strip non-printable characters from log file
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
|
||||
@ -589,8 +604,13 @@ log_success_msg()
|
||||
|
||||
log_success_msg2()
|
||||
{
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}"
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}"
|
||||
else
|
||||
echo " OK"
|
||||
fi
|
||||
|
||||
echo " OK" >> ${BOOTLOG}
|
||||
|
||||
@ -610,8 +630,14 @@ log_success_msg2()
|
||||
################################################################################
|
||||
log_failure_msg()
|
||||
{
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}"
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}"
|
||||
else
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
/bin/echo -e "${logmessage} FAIL"
|
||||
fi
|
||||
|
||||
# Strip non-printable characters from log file
|
||||
|
||||
@ -624,8 +650,13 @@ log_failure_msg()
|
||||
|
||||
log_failure_msg2()
|
||||
{
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}"
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
|
||||
echo "FAIL" >> ${BOOTLOG}
|
||||
|
||||
@ -643,8 +674,14 @@ log_failure_msg2()
|
||||
################################################################################
|
||||
log_warning_msg()
|
||||
{
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${WARNING_PREFIX}${SET_COL}${WARNING_SUFFIX}"
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${WARNING_PREFIX}${SET_COL}${WARNING_SUFFIX}"
|
||||
else
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
/bin/echo -e "${logmessage} WARN"
|
||||
fi
|
||||
|
||||
# Strip non-printable characters from log file
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
@ -656,8 +693,14 @@ log_warning_msg()
|
||||
|
||||
log_skip_msg()
|
||||
{
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${SKIP_PREFIX}${SET_COL}${SKIP_SUFFIX}"
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
/bin/echo -e "${CURS_ZERO}${SKIP_PREFIX}${SET_COL}${SKIP_SUFFIX}"
|
||||
else
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
/bin/echo "SKIP"
|
||||
fi
|
||||
|
||||
# Strip non-printable characters from log file
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
@ -677,7 +720,13 @@ log_skip_msg()
|
||||
################################################################################
|
||||
log_info_msg()
|
||||
{
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${BMPREFIX}${@}"
|
||||
else
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
/bin/echo -n -e "${logmessage}"
|
||||
fi
|
||||
|
||||
# Strip non-printable characters from log file
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
@ -689,7 +738,13 @@ log_info_msg()
|
||||
|
||||
log_info_msg2()
|
||||
{
|
||||
/bin/echo -n -e "${@}"
|
||||
if [ "x$HEADLESS" != "xyes" ]
|
||||
then
|
||||
/bin/echo -n -e "${@}"
|
||||
else
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
/bin/echo -n -e "${logmessage}"
|
||||
fi
|
||||
|
||||
# Strip non-printable characters from log file
|
||||
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
|
||||
|
Loading…
Reference in New Issue
Block a user