summaryrefslogtreecommitdiffstats
path: root/initrd/initrd-stuff/etc/functions
diff options
context:
space:
mode:
authorDirk von Suchodoletz2006-01-20 01:54:30 +0100
committerDirk von Suchodoletz2006-01-20 01:54:30 +0100
commit0b2c8e82d02c600f2fc395947e7317f3b4d20f25 (patch)
tree56c453a1ddf8b7d6675857d8dd13906a41071ad4 /initrd/initrd-stuff/etc/functions
parentdxsinitrd: mehr zeug in kommandozeilenparameter (diff)
downloadcore-0b2c8e82d02c600f2fc395947e7317f3b4d20f25.tar.gz
core-0b2c8e82d02c600f2fc395947e7317f3b4d20f25.tar.xz
core-0b2c8e82d02c600f2fc395947e7317f3b4d20f25.zip
Abstimmung der Debuglevel (siehe auch /trac Wiki)
git-svn-id: http://svn.openslx.org/svn/openslx/dxs/ld4@26 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd/initrd-stuff/etc/functions')
-rw-r--r--initrd/initrd-stuff/etc/functions13
1 files changed, 11 insertions, 2 deletions
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