]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
fix dracut logging
authorHarald Hoyer <harald@redhat.com>
Thu, 4 Jun 2009 11:17:57 +0000 (13:17 +0200)
committerHarald Hoyer <harald@redhat.com>
Thu, 4 Jun 2009 11:17:57 +0000 (13:17 +0200)
dracut-functions

index 49d18fdc71b23f4143e7688e4898e70f71b61719..7f14318697c7d498e82bf20b636fdee8129860a8 100755 (executable)
@@ -31,24 +31,25 @@ strstr() { [[ ! ${1#*$2*} = $1 ]]; }
 # Log initrd creation.
 if ! [[ $dracutlogfile ]]; then
     [[ $dsrc = /usr/lib/dracut ]] && \
-       dracutlogfile=/var/log/dracut/log || \
+       dracutlogfile=/var/log/dracut.log || \
        dracutlogfile=/tmp/dracut.log
+    [[ -w "$dracutlogfile" ]] || dracutlogfile=/tmp/dracut.log
     >"$dracutlogfile"
 fi
 
 dwarning() {
     echo "W: $@" >&2
-    echo "W: $@" >>"$dracutlogfile"
+    [[ -w "$dracutlogfile" ]] && echo "W: $@" >>"$dracutlogfile"
 }
 
 dinfo() {
     [[ $beverbose ]] && echo "I: $@" >&2
-    echo "I: $@" >>"$dracutlogfile"
+    [[ -w "$dracutlogfile" ]] && echo "I: $@" >>"$dracutlogfile"
 }
 
 derror() {
     echo "E: $@" >&2
-    echo "E: $@" >>"$dracutlogfile"
+    [[ -w "$dracutlogfile" ]] && echo "E: $@" >>"$dracutlogfile"
 }
 
 # $1 = file to copy to ramdisk