[arch-projects] [initscripts] [PATCH 2/2] rc.multi/rc.single: Merge duplicated bootlogd stop code into a function
Kurt J. Bosch
kjb-temp-2009 at alpenjodel.de
Fri Jun 24 12:04:56 EDT 2011
---
functions | 9 +++++++++
rc.multi | 8 +-------
rc.single | 8 +-------
3 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/functions b/functions
index 0c34cb9..b64f78b 100644
--- a/functions
+++ b/functions
@@ -430,6 +430,15 @@ mount_all() {
stat_done
}
+bootlogd_stop() {
+ [[ -f /run/bootlogd.pid ]] || return 0
+ touch /var/log/boot
+ kill $(< /run/bootlogd.pid)
+ rm -f /run/bootlogd.pid
+ sed -i -r -e 's/\^\[\[[0-9]?;?[0-9]?[0-9]?;?[0-9]?[0-9]?[ms]//g' \
+ -e 's/\^\[(\[151|%)G//g' /var/log/boot
+}
+
###############################
# Custom hooks in initscripts #
###############################
diff --git a/rc.multi b/rc.multi
index 1160ab4..4b55a27 100755
--- a/rc.multi
+++ b/rc.multi
@@ -26,12 +26,6 @@ fi
run_hook multi_end
-if [[ -f /run/bootlogd.pid ]]; then
- touch /var/log/boot
- kill $(< /run/bootlogd.pid)
- rm -f /run/bootlogd.pid
- sed -i -r -e 's/\^\[\[[0-9]?;?[0-9]?[0-9]?;?[0-9]?[0-9]?[ms]//g' \
- -e 's/\^\[(\[151|%)G//g' /var/log/boot
-fi
+bootlogd_stop
# vim: set ts=2 sw=2 noet:
diff --git a/rc.single b/rc.single
index 46b502c..d630736 100755
--- a/rc.single
+++ b/rc.single
@@ -22,13 +22,7 @@ fi
run_hook single_end
-if [[ -f /run/bootlogd.pid ]]; then
- touch /var/log/boot
- kill $(< /run/bootlogd.pid)
- rm -f /run/bootlogd.pid
- sed -i -r -e 's/\^\[\[[0-9]?;?[0-9]?[0-9]?;?[0-9]?[0-9]?[ms]//g' \
- -e 's/\^\[(\[151|%)G//g' /var/log/boot
-fi
+bootlogd_stop
if [[ $RUNLEVEL = 1 ]]; then
printsep
--
1.7.1
More information about the arch-projects
mailing list