init.d/bootmisc.in: prevent error due to nonexistant file

During boot if the "previous_dmesg" setting is enabled in
/etc/conf.d/bootmisc then during the 1st boot of a machine the
bootmisc init.d script will attempt to move a nonexistant dmesg
file, so generating an error on the console.

Modify the script to only move an existing file.
This commit is contained in:
Dermot Bradley 2022-01-29 21:01:20 +00:00 committed by Mike Frysinger
parent e6d48ea141
commit 98feac173e

View File

@ -226,7 +226,7 @@ start()
case "$RC_SYS" in case "$RC_SYS" in
VSERVER|OPENVZ|LXC|SYSTEMD-NSPAWN) ;; VSERVER|OPENVZ|LXC|SYSTEMD-NSPAWN) ;;
*) *)
if yesno ${previous_dmesg:-no}; then if yesno ${previous_dmesg:-no} && [ -e /var/log/dmesg ]; then
mv /var/log/dmesg /var/log/dmesg.old mv /var/log/dmesg /var/log/dmesg.old
fi fi
dmesg > /var/log/dmesg dmesg > /var/log/dmesg