commit:     ee944553a9ea35622046bd1ab5657fd416a7019a
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Wed Oct 21 19:01:57 2015 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Wed Oct 21 19:04:28 2015 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=ee944553

bootmisc: optionally save the previous dmesg log

X-Gentoo-Bug: 561204
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=561204

 conf.d/bootmisc    | 5 +++++
 init.d/bootmisc.in | 3 +++
 2 files changed, 8 insertions(+)

diff --git a/conf.d/bootmisc b/conf.d/bootmisc
index d79706c..5371209 100644
--- a/conf.d/bootmisc
+++ b/conf.d/bootmisc
@@ -8,3 +8,8 @@ wipe_tmp="YES"
 # Write the initial dmesg log into /var/log/dmesg after boot
 # This may be useful if you need the kernel boot log afterwards
 log_dmesg="YES"
+
+# Save the previous dmesg log to dmesc.old
+# This may be useful if you need to compare the current boot to the
+# previous one.
+#previous_dmesg=no

diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
index 1a05920..4015d8f 100644
--- a/init.d/bootmisc.in
+++ b/init.d/bootmisc.in
@@ -216,6 +216,9 @@ start()
                        case "$RC_SYS" in
                                VSERVER|OPENVZ|LXC|SYSTEMD-NSPAWN) ;;
                                *)
+                                       if yesno ${previous_dmesg:-no}; then
+                                               mv /var/log/dmesg 
/var/log/dmesg.old
+                                       fi
                                        dmesg > /var/log/dmesg
                                        chmod 640 /var/log/dmesg
                                        ;;

Reply via email to