From: Victor Lowther Date: Fri, 29 May 2009 02:41:05 +0000 (-0500) Subject: Log dracut output. X-Git-Tag: 0.1~156 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a918b40b6e80dd95ac39d82010d672db4ad04b4;p=thirdparty%2Fdracut.git Log dracut output. If we are installed, log to /var/log/dracut.log. If we are not installed, log to /tmp/dracut.log --- diff --git a/dracut b/dracut index a255a1424..63939e95d 100755 --- 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 diff --git a/dracut-functions b/dracut-functions index 3ef664e42..16ff5b1ae 100755 --- a/dracut-functions +++ b/dracut-functions @@ -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