Check for eerror in die() since an invalid option(long) or
authoridl0r <idl0r@gentoo.org>
Sun, 31 Jan 2010 11:48:05 +0000 (11:48 -0000)
committeridl0r <idl0r@gentoo.org>
Sun, 31 Jan 2010 11:48:05 +0000 (11:48 -0000)
missing arg will end up in calling die() before /etc/init.d/functions.sh
has been sourced.

svn path=/trunk/gentoolkit/; revision=735

ChangeLog
bin/revdep-rebuild

index 00b0b339627fa899c0bae7c1fa309443c6baeeaa..fb4f28e4f73138fa790304dd416d81a6a94d90bf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-31-01: Christian Ruppert <idl0r@gentoo.org>
+       * revdep-rebuild: Check for eerror in die() since an invalid option(long) or
+       missing arg will end up in calling die() before /etc/init.d/functions.sh
+       has been sourced.
+
 2009-01-11: Paul Varner <fuzzyray@gentoo.org>
        * revdep-rebuild: Set environment using 'portageq -v' (Bug 300229)
 
index ce9e61c0f347b33f0c1ee88d6d3445994cf07a94..6726c7e03c2a6752a68080e9701109ad59e05701 100755 (executable)
@@ -241,7 +241,17 @@ clean_var() {
 die() {
        local status=$1
        shift
-       eerror "$@"
+
+       # Check if eerror has been loaded.
+       # Its loaded _after_ opt parsing but not before due to RC_NOCOLOR.
+       type eerror &> /dev/null
+
+       if [[ $? -eq 0 ]];
+       then
+               eerror "$@"
+       else
+               echo " * ${@}" >> /dev/stderr
+       fi
        exit $status
 }
 ##