From 0b2c8e82d02c600f2fc395947e7317f3b4d20f25 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Fri, 20 Jan 2006 00:54:30 +0000 Subject: Abstimmung der Debuglevel (siehe auch /trac Wiki) git-svn-id: http://svn.openslx.org/svn/openslx/dxs/ld4@26 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/initrd-stuff/etc/functions | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'initrd/initrd-stuff/etc/functions') diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 6eca05c1..e0e3bfbd 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -1,9 +1,18 @@ ####################################################################### # produce error message and if $2 is empty run (debug) shell error() { -echo -e "An error occured during execution of $0 script:\n\n$1\n" +local message="An error occured during execution of $0 script:\n\n$1\n" +# check if LOGFILE is already defined +[ -z "${LOGFILE}" ] && LOGFILE="/dev/null" +# check if LOGFILE is really writeable +[ -n "${LOGFILE}" ] && [ -w /mnt/${LOGFILE} ] || LOGFILE="/dev/null" +# if nonfatal error else fatal error message and shell if [ -n "$2" ] ; then - echo -e "This error is not fatal - continuing ...\n" +[ "$DEBUGLEVEL" -ge 1 ] && \ + echo -e "{$message} This error is not fatal - continuing ...\n" \ + >> /mnt/${LOGFILE} +[ "$DEBUGLEVEL" -gt 1 ] && \ + echo -e "{$message} This error is not fatal - continuing ...\n" else echo -e "Running shell for debugging purposes now ...\n" /bin/sh -- cgit v1.2.3-55-g7522