Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F115923055
D34513.id103734.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D34513.id103734.diff
View Options
diff --git a/libexec/rc/rc.d/bgfsck b/libexec/rc/rc.d/bgfsck
--- a/libexec/rc/rc.d/bgfsck
+++ b/libexec/rc/rc.d/bgfsck
@@ -39,7 +39,7 @@
bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds"
fi
if [ -z "${rc_force}" ]; then
- check_startmsgs && echo "${bgfsck_msg}."
+ startmsg "${bgfsck_msg}."
fi
(sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \
diff --git a/libexec/rc/rc.d/cleartmp b/libexec/rc/rc.d/cleartmp
--- a/libexec/rc/rc.d/cleartmp
+++ b/libexec/rc/rc.d/cleartmp
@@ -26,7 +26,7 @@
${tmp}/.ICE-unix ${tmp}/.font-unix"
if checkyesno ${rcvar1}; then
- check_startmsgs && echo "Clearing ${tmp}."
+ startmsg "Clearing ${tmp}."
# This is not needed for mfs, but doesn't hurt anything.
# Things to note:
@@ -48,7 +48,7 @@
elif checkyesno clear_tmp_X; then
# Remove X lock files, since they will prevent you from
# restarting X. Remove other X related directories.
- check_startmsgs && echo "Clearing ${tmp} (X related)."
+ startmsg "Clearing ${tmp} (X related)."
rm -rf ${tmp}/.X[0-9]-lock ${x11_socket_dirs}
fi
if checkyesno clear_tmp_X; then
diff --git a/libexec/rc/rc.d/fsck b/libexec/rc/rc.d/fsck
--- a/libexec/rc/rc.d/fsck
+++ b/libexec/rc/rc.d/fsck
@@ -24,7 +24,7 @@
# During fsck ignore SIGQUIT
trap : 3
- check_startmsgs && echo "Starting file system checks:"
+ startmsg "Starting file system checks:"
# Background fsck can only be run with -p
if checkyesno background_fsck; then
fsck -F -p
@@ -37,7 +37,7 @@
echo "Warning! Some of the devices might not be" \
"available; retrying"
root_hold_wait
- check_startmsgs && echo "Restarting file system checks:"
+ startmsg "Restarting file system checks:"
# Background fsck can only be run with -p
if checkyesno background_fsck; then
fsck -F -p
diff --git a/libexec/rc/rc.d/hostid b/libexec/rc/rc.d/hostid
--- a/libexec/rc/rc.d/hostid
+++ b/libexec/rc/rc.d/hostid
@@ -50,9 +50,9 @@
# Set both kern.hostuuid and kern.hostid.
#
- check_startmsgs && echo "Setting hostuuid: ${uuid}."
+ startmsg "Setting hostuuid: ${uuid}."
${SYSCTL} kern.hostuuid="${uuid}" >/dev/null
- check_startmsgs && echo "Setting hostid: ${id}."
+ startmsg "Setting hostid: ${id}."
${SYSCTL} kern.hostid=${id} >/dev/null
}
diff --git a/libexec/rc/rc.d/hostname b/libexec/rc/rc.d/hostname
--- a/libexec/rc/rc.d/hostname
+++ b/libexec/rc/rc.d/hostname
@@ -72,9 +72,9 @@
# All right, it is safe to invoke hostname(1) now.
#
- check_startmsgs && echo -n "Setting hostname: ${hostname}"
+ startmsg -n "Setting hostname: ${hostname}"
/bin/hostname "${hostname}"
- check_startmsgs && echo '.'
+ startmsg '.'
}
load_rc_config $name
diff --git a/libexec/rc/rc.d/ldconfig b/libexec/rc/rc.d/ldconfig
--- a/libexec/rc/rc.d/ldconfig
+++ b/libexec/rc/rc.d/ldconfig
@@ -37,7 +37,7 @@
_LDC="${_LDC} ${i}"
fi
done
- check_startmsgs && echo 'ELF ldconfig path:' ${_LDC}
+ startmsg 'ELF ldconfig path:' ${_LDC}
${ldconfig} -elf ${_ins} ${_LDC}
machine_arch=$(sysctl -n hw.machine_arch)
@@ -58,8 +58,7 @@
_LDC="${_LDC} ${i}"
fi
done
- check_startmsgs &&
- echo '32-bit compatibility ldconfig path:' ${_LDC}
+ startmsg '32-bit compatibility ldconfig path:' ${_LDC}
${ldconfig} -32 ${_ins} ${_LDC}
;;
esac
diff --git a/libexec/rc/rc.d/motd b/libexec/rc/rc.d/motd
--- a/libexec/rc/rc.d/motd
+++ b/libexec/rc/rc.d/motd
@@ -26,7 +26,7 @@
# Must be done *before* interactive logins are possible
# to prevent possible race conditions.
#
- check_startmsgs && echo -n 'Updating motd:'
+ startmsg -n 'Updating motd:'
if [ ! -f "${TEMPLATE}" ]; then
# Create missing template from existing regular motd file, if
# one exists.
@@ -51,7 +51,7 @@
install -C -o root -g wheel -m "${PERMS}" "$T" "${TARGET}"
rm -f "$T"
- check_startmsgs && echo '.'
+ startmsg '.'
}
load_rc_config $name
diff --git a/libexec/rc/rc.d/mountcritlocal b/libexec/rc/rc.d/mountcritlocal
--- a/libexec/rc/rc.d/mountcritlocal
+++ b/libexec/rc/rc.d/mountcritlocal
@@ -29,7 +29,7 @@
esac
# Mount everything except nfs filesystems.
- check_startmsgs && echo -n 'Mounting local filesystems:'
+ startmsg -n 'Mounting local filesystems:'
mount_excludes='no'
for i in ${netfs_types}; do
fstype=${i%:*}
@@ -47,7 +47,7 @@
err=$?
fi
- check_startmsgs && echo '.'
+ startmsg '.'
case ${err} in
0)
diff --git a/libexec/rc/rc.d/moused b/libexec/rc/rc.d/moused
--- a/libexec/rc/rc.d/moused
+++ b/libexec/rc/rc.d/moused
@@ -52,9 +52,9 @@
mytype="$moused_type"
fi
- check_startmsgs && echo -n "Starting ${ms} moused"
+ startmsg -n "Starting ${ms} moused"
/usr/sbin/moused ${myflags} -p ${myport} -t ${mytype} ${pidarg}
- check_startmsgs && echo '.'
+ startmsg '.'
mousechar_arg=
case ${mousechar_start} in
diff --git a/libexec/rc/rc.d/newsyslog b/libexec/rc/rc.d/newsyslog
--- a/libexec/rc/rc.d/newsyslog
+++ b/libexec/rc/rc.d/newsyslog
@@ -18,9 +18,9 @@
newsyslog_start()
{
- check_startmsgs && echo -n 'Creating and/or trimming log files'
+ startmsg -n 'Creating and/or trimming log files'
${command} ${rc_flags}
- check_startmsgs && echo '.'
+ startmsg '.'
}
load_rc_config $name
diff --git a/libexec/rc/rc.d/nfsclient b/libexec/rc/rc.d/nfsclient
--- a/libexec/rc/rc.d/nfsclient
+++ b/libexec/rc/rc.d/nfsclient
@@ -23,8 +23,7 @@
#
if [ -n "${nfs_access_cache}" ]; then
- check_startmsgs &&
- echo "NFS access cache time=${nfs_access_cache}"
+ startmsg "NFS access cache time=${nfs_access_cache}"
if ! sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null; then
warn "failed to set access cache timeout"
fi
diff --git a/libexec/rc/rc.d/os-release b/libexec/rc/rc.d/os-release
--- a/libexec/rc/rc.d/os-release
+++ b/libexec/rc/rc.d/os-release
@@ -21,7 +21,7 @@
{
local _version _version_id
- check_startmsgs && echo -n "Updating ${osrelease_file} "
+ startmsg -n "Updating ${osrelease_file} "
_version=$(freebsd-version -u)
_version_id=${_version%%[^0-9.]*}
t=$(mktemp -t os-release)
@@ -38,7 +38,7 @@
__EOF__
install -C -o root -g wheel -m ${osrelease_perms} "$t" "${osrelease_file}"
rm -f "$t"
- check_startmsgs && echo 'done.'
+ startmsg 'done.'
}
load_rc_config $name
diff --git a/libexec/rc/rc.d/pf b/libexec/rc/rc.d/pf
--- a/libexec/rc/rc.d/pf
+++ b/libexec/rc/rc.d/pf
@@ -42,13 +42,13 @@
pf_start()
{
- check_startmsgs && echo -n 'Enabling pf'
+ startmsg -n 'Enabling pf'
$pf_program -F all > /dev/null 2>&1
$pf_program -f "$pf_rules" $pf_flags || pf_fallback
if ! $pf_program -s info | grep -q "Enabled" ; then
$pf_program -eq
fi
- check_startmsgs && echo '.'
+ startmsg '.'
}
pf_stop()
diff --git a/libexec/rc/rc.d/savecore b/libexec/rc/rc.d/savecore
--- a/libexec/rc/rc.d/savecore
+++ b/libexec/rc/rc.d/savecore
@@ -74,7 +74,7 @@
fi
sync
else
- check_startmsgs && echo 'No core dumps found.'
+ startmsg 'No core dumps found.'
fi
}
diff --git a/libexec/rc/rc.subr b/libexec/rc/rc.subr
--- a/libexec/rc/rc.subr
+++ b/libexec/rc/rc.subr
@@ -715,6 +715,15 @@
fi
}
+#
+# startmsg
+# Preferred method to use when displaying start messages in lieu of echo.
+#
+startmsg()
+{
+ check_startmsgs && echo "$@"
+}
+
#
# run_rc_command argument
# Search for argument in the list of supported commands, which is:
@@ -1111,7 +1120,7 @@
# setup the full command to run
#
- check_startmsgs && echo "Starting ${name}."
+ startmsg "Starting ${name}."
if [ -n "$_chroot" ]; then
_cd=
_doit="\
diff --git a/share/man/man8/rc.subr.8 b/share/man/man8/rc.subr.8
--- a/share/man/man8/rc.subr.8
+++ b/share/man/man8/rc.subr.8
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd November 29, 2021
+.Dd March 11, 2022
.Dt RC.SUBR 8
.Os
.Sh NAME
@@ -73,6 +73,8 @@
.It
.Ic run_rc_script Ar file Ar argument
.It
+.Ic startmsg Oo Fl n Oc Ar message
+.It
.Ic wait_for_pids Op Ar pid ...
.It
.Ic warn Ar message
@@ -881,6 +883,17 @@
.Ar file
into the current shell.
.El
+.It Ic startmsg Oo Fl n Oc Ar message
+Display a start message to
+.Va stdout .
+It should be used instead of
+.Xr echo 1 .
+The display of this output can be turned off if the
+.Xr rc.conf 5
+variable
+.Va rc_startmsgs
+is set to
+.Dq Li NO .
.It Ic stop_boot Op Ar always
Prevent booting to multiuser mode.
If the
@@ -929,7 +942,8 @@
.El
.Sh SEE ALSO
.Xr rc.conf 5 ,
-.Xr rc 8
+.Xr rc 8 ,
+.Xr echo 1
.Sh HISTORY
The
.Nm
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, May 1, 11:26 AM (4 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17880178
Default Alt Text
D34513.id103734.diff (8 KB)
Attached To
Mode
D34513: rc.subr: Introduce startmsg
Attached
Detach File
Event Timeline
Log In to Comment