]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
Log dracut output.
authorVictor Lowther <victor.lowther@gmail.com>
Fri, 29 May 2009 02:41:05 +0000 (21:41 -0500)
committerVictor Lowther <victor.lowther@gmail.com>
Fri, 29 May 2009 02:41:05 +0000 (21:41 -0500)
If we are installed, log to /var/log/dracut.log.
If we are not installed, log to /tmp/dracut.log

dracut
dracut-functions

diff --git a/dracut b/dracut
index a255a1424c066c0b2cbaefc1bf4d2df2f7956359..63939e95d94226b65cc822d79dc6f65b68db5cba 100755 (executable)
--- a/dracut
+++ b/dracut
@@ -71,6 +71,7 @@ done
 [[ $drivers_l ]] && drivers=$drivers_l
 
 [[ $allowlocal && -f "$(dirname $0)/dracut-functions" ]] && dsrc="$(dirname $0)" || dsrc=/usr/lib/dracut
+
 if [[ -f $dsrc/dracut-functions ]]; then
    . $dsrc/dracut-functions
 else
index 3ef664e422be5d9ac5b657300551899de7c2277b..16ff5b1ae43e4729ab0bd8c146110684a387d392 100755 (executable)
@@ -28,16 +28,26 @@ IF_dynamic=""
 # Generic substring function.  If $2 is in $1, return 0.
 strstr() { [[ ! ${1#*$2*} = $1 ]]; }
 
+if ! [[ $dracutlogfile ]]; then
+    [[ $dsrc = /usr/lib/dracut ]] && \
+       dracutlogfile=/var/log/dracut/log || \
+       dracutlogfile=/tmp/dracut.log
+    >"$dracutlogfile"
+fi
+
 dwarning() {
     echo "W: $@" >&2
+    echo "W: $@" >>"$dracutlogfile"
 }
 
 dinfo() {
     [[ $beverbose ]] && echo "I: $@" >&2
+    echo "I: $@" >>"$dracutlogfile"
 }
 
 derror() {
     echo "E: $@" >&2
+    echo "E: $@" >>"$dracutlogfile"
 }
 
 # $1 = file to copy to ramdisk