Index: /trunk/src/VBox/Additions/linux/installer/vboxadd-service.sh
===================================================================
--- /trunk/src/VBox/Additions/linux/installer/vboxadd-service.sh	(revision 57944)
+++ /trunk/src/VBox/Additions/linux/installer/vboxadd-service.sh	(revision 57945)
@@ -27,70 +27,40 @@
 
 PATH=$PATH:/bin:/sbin:/usr/sbin
+SCRIPTNAME=vboxadd-service
 
-system=unknown
-if [ -f /etc/redhat-release ]; then
-    system=redhat
-    PIDFILE="/var/lock/subsys/vboxadd-service"
-elif [ -f /etc/SuSE-release ]; then
-    system=suse
-    PIDFILE="/var/run/vboxadd-service"
-elif [ -f /etc/debian_version ]; then
-    system=debian
-    PIDFILE="/var/run/vboxadd-service.pid"
-elif [ -f /etc/gentoo-release ]; then
-    system=gentoo
-    PIDFILE="/var/run/vboxadd-service"
-elif [ -f /etc/slackware-version ]; then
-    system=slackware
-    PIDFILE="/var/run/vboxadd-service"
-elif [ -f /etc/lfs-release ]; then
-    system=lfs
-    PIDFILE="/var/run/vboxadd-service.pid"
-else
-    system=other
-    if [ -d /var/run -a -w /var/run ]; then
-        PIDFILE="/var/run/vboxadd-service"
-    fi
+PIDFILE="/var/run/${SCRIPTNAME}"
+
+# Preamble for Gentoo
+if [ "`which $0`" = "/sbin/rc" ]; then
+    shift
 fi
 
-if [ "$system" = "redhat" ]; then
-    . /etc/init.d/functions
-    fail_msg() {
-        echo_failure
-        echo
-    }
+begin()
+{
+    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
+    logger "${SCRIPTNAME}: ${1}."
+}
 
-    succ_msg() {
-        echo_success
-        echo
-    }
+succ_msg()
+{
+    logger "${SCRIPTNAME}: done."
+}
 
-    begin() {
-        echo -n "$1"
-    }
-fi
+fail_msg()
+{
+    echo "${SCRIPTNAME}: failed." >&2
+    logger "${SCRIPTNAME}: failed."
+}
 
-if [ "$system" = "suse" ]; then
-    . /etc/rc.status
-    daemon() {
-        startproc ${1+"$@"}
-    }
+daemon() {
+    $1 $2 $3
+}
 
-    fail_msg() {
-        rc_failed 1
-        rc_status -v
-    }
+killproc() {
+    killall $1
+    rm -f $PIDFILE
+}
 
-    succ_msg() {
-        rc_reset
-        rc_status -v
-    }
-
-    begin() {
-        echo -n "$1"
-    }
-fi
-
-if [ "$system" = "debian" ]; then
+if which start-stop-daemon >/dev/null; then
     daemon() {
         start-stop-daemon --start --exec $1 -- $2 $3
@@ -99,94 +69,4 @@
     killproc() {
         start-stop-daemon --stop --retry 2 --exec $@
-    }
-
-    fail_msg() {
-        echo " ...fail!"
-    }
-
-    succ_msg() {
-        echo " ...done."
-    }
-
-    begin() {
-        echo -n "$1"
-    }
-fi
-
-if [ "$system" = "gentoo" ]; then
-    if [ -f /sbin/functions.sh ]; then
-        . /sbin/functions.sh
-    elif [ -f /etc/init.d/functions.sh ]; then
-        . /etc/init.d/functions.sh
-    fi
-    daemon() {
-        start-stop-daemon --start --exec $1 -- $2 $3
-    }
-
-    killproc() {
-        start-stop-daemon --stop --retry 2 --exec $@
-    }
-
-    fail_msg() {
-        echo " ...fail!"
-    }
-
-    succ_msg() {
-        echo " ...done."
-    }
-
-    begin() {
-        echo -n "$1"
-    }
-
-    if [ "`which $0`" = "/sbin/rc" ]; then
-        shift
-    fi
-fi
-
-if [ "$system" = "slackware" -o "$system" = "other" ]; then
-    daemon() {
-        $1 $2 $3
-    }
-
-    killproc() {
-        killall $1
-        rm -f $PIDFILE
-    }
-
-    fail_msg() {
-        echo " ...fail!"
-    }
-
-    succ_msg() {
-        echo " ...done."
-    }
-
-    begin() {
-        echo -n "$1"
-    }
-
-fi
-
-if [ "$system" = "lfs" ]; then
-    . /etc/rc.d/init.d/functions
-    daemon() {
-        loadproc $1 $2 $3
-    }
-
-    fail_msg() {
-        echo_failure
-    }
-
-    succ_msg() {
-        echo_ok
-    }
-
-    begin() {
-        echo $1
-    }
-
-    status() {
-        statusproc $1
     }
 fi
@@ -207,5 +87,5 @@
 start() {
     if ! test -f $PIDFILE; then
-        begin "Starting VirtualBox Guest Addition service ";
+        begin "Starting VirtualBox Guest Addition service " console;
         vboxaddrunning || {
             echo "VirtualBox Additions module not loaded!"
@@ -222,5 +102,5 @@
 stop() {
     if test -f $PIDFILE; then
-        begin "Stopping VirtualBox Guest Addition service ";
+        begin "Stopping VirtualBox Guest Addition service " console;
         killproc $binary
         RETVAL=$?
Index: /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh
===================================================================
--- /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh	(revision 57944)
+++ /trunk/src/VBox/Additions/linux/installer/vboxadd-x11.sh	(revision 57945)
@@ -33,4 +33,5 @@
 CONFIG_DIR="/var/lib/VBoxGuestAdditions"
 CONFIG="config"
+SCRIPTNAME=vboxadd-x11
 
 # Check architecture
@@ -69,92 +70,25 @@
     /usr/X11R6/lib/X11/XF86Config"
 
-if [ -f /etc/redhat-release ]; then
-    system=redhat
-elif [ -f /etc/debian_version ]; then
-    system=debian
-elif [ -f /etc/SuSE-release ]; then
-    system=suse
-elif [ -f /etc/gentoo-release ]; then
-    system=gentoo
-elif [ -f /etc/lfs-release -a -d /etc/rc.d/init.d ]; then
-    system=lfs
-else
-    system=other
+# Preamble for Gentoo
+if [ "`which $0`" = "/sbin/rc" ]; then
+    shift
 fi
 
-if [ "$system" = "redhat" ]; then
-    . /etc/init.d/functions
-    fail_msg() {
-        echo_failure
-        echo
-    }
-    succ_msg() {
-        echo_success
-        echo
-    }
-    begin() {
-        echo -n "$1"
-    }
-fi
-
-if [ "$system" = "suse" ]; then
-    . /etc/rc.status
-    fail_msg() {
-        rc_failed 1
-        rc_status -v
-    }
-    succ_msg() {
-        rc_reset
-        rc_status -v
-    }
-    begin() {
-        echo -n "$1"
-    }
-fi
-
-if [ "$system" = "gentoo" ]; then
-    if [ -f /sbin/functions.sh ]; then
-        . /sbin/functions.sh
-    elif [ -f /etc/init.d/functions.sh ]; then
-        . /etc/init.d/functions.sh
-    fi
-    fail_msg() {
-        eend 1
-    }
-    succ_msg() {
-        eend $?
-    }
-    begin() {
-        ebegin $1
-    }
-    if [ "`which $0`" = "/sbin/rc" ]; then
-        shift
-    fi
-fi
-
-if [ "$system" = "lfs" ]; then
-    . /etc/rc.d/init.d/functions
-    fail_msg() {
-        echo_failure
-    }
-    succ_msg() {
-        echo_ok
-    }
-    begin() {
-        echo $1
-    }
-fi
-
-if [ "$system" = "debian" -o "$system" = "other" ]; then
-    fail_msg() {
-        echo " ...fail!"
-    }
-    succ_msg() {
-        echo " ...done."
-    }
-    begin() {
-        echo -n $1
-    }
-fi
+begin()
+{
+    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
+    logger "${SCRIPTNAME}: ${1}."
+}
+
+succ_msg()
+{
+    logger "${SCRIPTNAME}: done."
+}
+
+fail_msg()
+{
+    echo "${SCRIPTNAME}: failed." >&2
+    logger "${SCRIPTNAME}: failed."
+}
 
 dev=/dev/vboxguest
@@ -165,10 +99,6 @@
 fail()
 {
-    if [ "$system" = "gentoo" ]; then
-        eerror $1
-        exit 1
-    fi
-    fail_msg
-    echo "($1)"
+    echo "${SCRIPTNAME}: failed: ${1}." >&2
+    logger "${SCRIPTNAME}: ${1}."
     exit 1
 }
Index: /trunk/src/VBox/Additions/linux/installer/vboxadd.sh
===================================================================
--- /trunk/src/VBox/Additions/linux/installer/vboxadd.sh	(revision 57944)
+++ /trunk/src/VBox/Additions/linux/installer/vboxadd.sh	(revision 57945)
@@ -34,4 +34,5 @@
 MODPROBE=/sbin/modprobe
 OLDMODULES="vboxguest vboxadd vboxsf vboxvfs vboxvideo"
+SCRIPTNAME=vboxadd
 
 if $MODPROBE -c 2>/dev/null | grep -q '^allow_unsupported_modules  *0'; then
@@ -58,98 +59,30 @@
 done
 
-if [ -f /etc/redhat-release ]; then
-    system=redhat
-elif [ -f /etc/SuSE-release ]; then
-    system=suse
-elif [ -f /etc/gentoo-release ]; then
-    system=gentoo
-elif [ -f /etc/lfs-release -a -d /etc/rc.d/init.d ]; then
-    system=lfs
-else
-    system=other
+# Preamble for Gentoo
+if [ "`which $0`" = "/sbin/rc" ]; then
+    shift
 fi
 
-if [ "$system" = "redhat" ]; then
-    . /etc/init.d/functions
-    fail_msg() {
-        echo_failure
-        echo
-    }
-    succ_msg() {
-        echo_success
-        echo
-    }
-    begin() {
-        echo -n "$1"
-    }
-fi
-
-if [ "$system" = "suse" ]; then
-    . /etc/rc.status
-    fail_msg() {
-        rc_failed 1
-        rc_status -v
-    }
-    succ_msg() {
-        rc_reset
-        rc_status -v
-    }
-    begin() {
-        echo -n "$1"
-    }
-fi
-
-if [ "$system" = "gentoo" ]; then
-    if [ -f /sbin/functions.sh ]; then
-        . /sbin/functions.sh
-    elif [ -f /etc/init.d/functions.sh ]; then
-        . /etc/init.d/functions.sh
-    fi
-    fail_msg() {
-        eend 1
-    }
-    succ_msg() {
-        eend $?
-    }
-    begin() {
-        ebegin $1
-    }
-    if [ "`which $0`" = "/sbin/rc" ]; then
-        shift
-    fi
-fi
-
-if [ "$system" = "lfs" ]; then
-    . /etc/rc.d/init.d/functions
-    fail_msg() {
-        echo_failure
-    }
-    succ_msg() {
-        echo_ok
-    }
-    begin() {
-        echo $1
-    }
-fi
-
-if [ "$system" = "other" ]; then
-    fail_msg() {
-        echo " ...fail!"
-    }
-    succ_msg() {
-        echo " ...done."
-    }
-    begin() {
-        echo -n $1
-    }
-fi
+begin()
+{
+    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
+    logger "${SCRIPTNAME}: ${1}."
+}
+
+succ_msg()
+{
+    logger "${SCRIPTNAME}: done."
+}
+
+fail_msg()
+{
+    echo "${SCRIPTNAME}: failed." >&2
+    logger "${SCRIPTNAME}: failed."
+}
 
 show_error()
 {
-    if [ "$system" = "gentoo" ]; then
-        eerror $1
-    fi
-    fail_msg
-    echo "($1)"
+    echo "${SCRIPTNAME}: failed: ${1}." >&2
+    logger "${SCRIPTNAME}: ${1}."
 }
 
@@ -183,5 +116,5 @@
     fi
     printf "\nThe headers for the current running kernel were not found. If the following\nmodule compilation fails then this could be the reason.\n"
-    if [ "$system" = "redhat" ]; then
+    if which yum >/dev/null; then
         if echo "$KERN_VER" | grep -q "uek"; then
             printf "The missing package can be probably installed with\nyum install kernel-uek-devel-$KERN_VER\n"
@@ -189,9 +122,9 @@
             printf "The missing package can be probably installed with\nyum install kernel-devel-$KERN_VER\n"
         fi
-    elif [ "$system" = "suse" ]; then
+    elif which zypper >/dev/null; then
         KERN_VER_SUSE=`echo "$KERN_VER" | sed 's/.*-\([^-]*\)/\1/g'`
         KERN_VER_BASE=`echo "$KERN_VER" | sed 's/\(.*\)-[^-]*/\1/g'`
         printf "The missing package can be probably installed with\nzypper install kernel-$KERN_VER_SUSE-devel-$KERN_VER_BASE\n"
-    elif [ "$system" = "debian" ]; then
+    elif which apt-get >/dev/null; then
         printf "The missing package can be probably installed with\napt-get install linux-headers-$KERN_VER\n"
     fi
@@ -268,5 +201,5 @@
 start()
 {
-    begin "Starting the VirtualBox Guest Additions ";
+    begin "Starting the VirtualBox Guest Additions" console;
     uname -r | grep -q -E '^2\.6|^3|^4' 2>/dev/null &&
         ps -A -o comm | grep -q '/*udevd$' 2>/dev/null ||
@@ -318,5 +251,5 @@
 stop()
 {
-    begin "Stopping VirtualBox Additions ";
+    begin "Stopping VirtualBox Additions" console;
     if ! umount -a -t vboxsf 2>/dev/null; then
         fail "Cannot unmount vboxsf folders"
Index: /trunk/src/VBox/Installer/linux/vboxautostart-service.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/vboxautostart-service.sh	(revision 57944)
+++ /trunk/src/VBox/Installer/linux/vboxautostart-service.sh	(revision 57945)
@@ -27,4 +27,5 @@
 
 PATH=$PATH:/bin:/sbin:/usr/sbin
+SCRIPTNAME=vboxautostart-service
 
 [ -f /etc/debian_release -a -f /lib/lsb/init-functions ] || NOLSB=yes
@@ -43,80 +44,33 @@
 [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
 
-system=unknown
-if [ -f /etc/redhat-release ]; then
-    system=redhat
-elif [ -f /etc/SuSE-release ]; then
-    system=suse
-elif [ -f /etc/debian_version ]; then
-    system=debian
-elif [ -f /etc/gentoo-release ]; then
-    system=gentoo
-elif [ -f /etc/slackware-version ]; then
-    system=slackware
-elif [ -f /etc/lfs-release ]; then
-    system=lfs
-else
-    system=other
+# Preamble for Gentoo
+if [ "`which $0`" = "/sbin/rc" ]; then
+    shift
 fi
 
-if [ -z "$NOLSB" ]; then
-    . /lib/lsb/init-functions
-    fail_msg() {
-        echo ""
-        log_failure_msg "$1"
-    }
-    succ_msg() {
-        log_success_msg " done."
-    }
-    begin_msg() {
-        log_daemon_msg "$@"
-    }
-fi
+begin_msg()
+{
+    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
+    logger "${SCRIPTNAME}: ${1}."
+}
 
-if [ "$system" = "redhat" ]; then
-    . /etc/init.d/functions
-    if [ -n "$NOLSB" ]; then
-        start_daemon() {
-            usr="$1"
-            shift
-            daemon --user $usr $@
-        }
-        fail_msg() {
-            echo_failure
-            echo
-        }
-        succ_msg() {
-            echo_success
-            echo
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-fi
+succ_msg()
+{
+    logger "${SCRIPTNAME}: done."
+}
 
-if [ "$system" = "suse" ]; then
-    . /etc/rc.status
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            rc_failed 1
-            rc_status -v
-        }
-        succ_msg() {
-            rc_reset
-            rc_status -v
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-fi
+fail_msg()
+{
+    echo "${SCRIPTNAME}: failed: ${1}." >&2
+    logger "${SCRIPTNAME}: failed: ${1}."
+}
 
-if [ "$system" = "debian" ]; then
+start_daemon() {
+    usr="$1"
+    shift
+    su - $usr -c "$*"
+}
+
+if which start-stop-daemon >/dev/null; then
     start_daemon() {
         usr="$1"
@@ -126,110 +80,4 @@
         start-stop-daemon --background --chuid $usr --start --exec $bin -- $@
     }
-    killproc() {
-        start-stop-daemon --stop --exec $@
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-       }
-    fi
-fi
-
-if [ "$system" = "gentoo" ]; then
-    if [ -f /sbin/functions.sh ]; then
-        . /sbin/functions.sh
-    elif [ -f /etc/init.d/functions.sh ]; then
-        . /etc/init.d/functions.sh
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        bin="$1"
-        shift
-        start-stop-daemon --background --chuid $usr --start --exec $bin -- $@
-    }
-    killproc() {
-        start-stop-daemon --stop --exec $@
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-        if [ "`which $0`" = "/sbin/rc" ]; then
-            shift
-        fi
-    fi
-fi
-
-if [ "$system" = "slackware" ]; then
-    killproc() {
-        killall $1
-        rm -f $PIDFILE
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-fi
-
-if [ "$system" = "lfs" ]; then
-    . /etc/rc.d/init.d/functions
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo_failure
-        }
-        succ_msg() {
-            echo_ok
-        }
-        begin_msg() {
-            echo $1
-        }
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-    status() {
-        statusproc $1
-    }
-fi
-
-if [ "$system" = "other" ]; then
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
 fi
 
@@ -241,5 +89,5 @@
     [ -z "$VBOXAUTOSTART_DB" ] && exit 0
     [ -z "$VBOXAUTOSTART_CONFIG" ] && exit 0
-    begin_msg "Starting VirtualBox VMs configured for autostart";
+    begin_msg "Starting VirtualBox VMs configured for autostart" console;
     vboxdrvrunning || {
         fail_msg "VirtualBox kernel module not loaded!"
Index: /trunk/src/VBox/Installer/linux/vboxballoonctrl-service.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/vboxballoonctrl-service.sh	(revision 57944)
+++ /trunk/src/VBox/Installer/linux/vboxballoonctrl-service.sh	(revision 57945)
@@ -27,6 +27,6 @@
 
 PATH=$PATH:/bin:/sbin:/usr/sbin
-
-[ -f /lib/lsb/init-functions -a -f /etc/debian_release ] || NOLSB=yes
+SCRIPTNAME=vboxballoonctrl-service
+
 [ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
 
@@ -43,89 +43,40 @@
 [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
 
-system=unknown
-if [ -f /etc/redhat-release ]; then
-    system=redhat
-    PIDFILE="/var/lock/subsys/vboxballoonctrl-service"
-elif [ -f /etc/SuSE-release ]; then
-    system=suse
-    PIDFILE="/var/lock/subsys/vboxballoonctrl-service"
-elif [ -f /etc/debian_version ]; then
-    system=debian
-    PIDFILE="/var/run/vboxballoonctrl-service"
-elif [ -f /etc/gentoo-release ]; then
-    system=gentoo
-    PIDFILE="/var/run/vboxballoonctrl-service"
-elif [ -f /etc/slackware-version ]; then
-    system=slackware
-    PIDFILE="/var/run/vboxballoonctrl-service"
-elif [ -f /etc/lfs-release ]; then
-    system=lfs
-    PIDFILE="/var/run/vboxballoonctrl-service.pid"
-else
-    system=other
-    if [ -d /var/run -a -w /var/run ]; then
-        PIDFILE="/var/run/vboxballoonctrl-service"
-    fi
+PIDFILE="/var/run/${SCRIPTNAME}"
+
+# Preamble for Gentoo
+if [ "`which $0`" = "/sbin/rc" ]; then
+    shift
 fi
 
-if [ -z "$NOLSB" ]; then
-    . /lib/lsb/init-functions
-    fail_msg() {
-        echo ""
-        log_failure_msg "$1"
-    }
-    succ_msg() {
-        log_success_msg " done."
-    }
-    begin_msg() {
-        log_daemon_msg "$@"
-    }
-fi
-
-if [ "$system" = "redhat" ]; then
-    . /etc/init.d/functions
-    if [ -n "$NOLSB" ]; then
-        start_daemon() {
-            usr="$1"
-            shift
-            daemon --user $usr $@
-        }
-        fail_msg() {
-            echo_failure
-            echo
-        }
-        succ_msg() {
-            echo_success
-            echo
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-fi
-
-if [ "$system" = "suse" ]; then
-    . /etc/rc.status
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            rc_failed 1
-            rc_status -v
-        }
-        succ_msg() {
-            rc_reset
-            rc_status -v
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-fi
-
-if [ "$system" = "debian" ]; then
+begin_msg()
+{
+    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
+    logger "${SCRIPTNAME}: ${1}."
+}
+
+succ_msg()
+{
+    logger "${SCRIPTNAME}: done."
+}
+
+fail_msg()
+{
+    echo "${SCRIPTNAME}: failed: ${1}." >&2
+    logger "${SCRIPTNAME}: failed: ${1}."
+}
+
+start_daemon() {
+    usr="$1"
+    shift
+    su - $usr -c "$*"
+}
+
+killproc() {
+    killall $1
+    rm -f $PIDFILE
+}
+
+if which start-stop-daemon >/dev/null; then
     start_daemon() {
         usr="$1"
@@ -135,110 +86,8 @@
         start-stop-daemon --background --chuid $usr --start --exec $bin -- $@
     }
+
     killproc() {
         start-stop-daemon --stop --exec $@
     }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-       }
-    fi
-fi
-
-if [ "$system" = "gentoo" ]; then
-    if [ -f /sbin/functions.sh ]; then
-        . /sbin/functions.sh
-    elif [ -f /etc/init.d/functions.sh ]; then
-        . /etc/init.d/functions.sh
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        bin="$1"
-        shift
-        start-stop-daemon --background --chuid $usr --start --exec $bin -- $@
-    }
-    killproc() {
-        start-stop-daemon --stop --exec $@
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-        if [ "`which $0`" = "/sbin/rc" ]; then
-            shift
-        fi
-    fi
-fi
-
-if [ "$system" = "slackware" ]; then
-    killproc() {
-        killall $1
-        rm -f $PIDFILE
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-fi
-
-if [ "$system" = "lfs" ]; then
-    . /etc/rc.d/init.d/functions
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo_failure
-        }
-        succ_msg() {
-            echo_ok
-        }
-        begin_msg() {
-            echo $1
-        }
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-    status() {
-        statusproc $1
-    }
-fi
-
-if [ "$system" = "other" ]; then
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
 fi
 
@@ -258,5 +107,5 @@
         [ -z "$VBOXWATCHDOG_USER" -a -z "$VBOXBALLOONCTRL_USER" ] && exit 0
         [ -z "$VBOXWATCHDOG_USER" ] && VBOXWATCHDOG_USER="$VBOXBALLOONCTRL_USER"
-        begin_msg "Starting VirtualBox watchdog service";
+        begin_msg "Starting VirtualBox watchdog service" console;
         check_single_user $VBOXWATCHDOG_USER
         vboxdrvrunning || {
@@ -303,5 +152,5 @@
 stop() {
     if test -f $PIDFILE; then
-        begin_msg "Stopping VirtualBox watchdog service";
+        begin_msg "Stopping VirtualBox watchdog service" console;
         killproc $binary
         RETVAL=$?
Index: /trunk/src/VBox/Installer/linux/vboxdrv.sh.in
===================================================================
--- /trunk/src/VBox/Installer/linux/vboxdrv.sh.in	(revision 57944)
+++ /trunk/src/VBox/Installer/linux/vboxdrv.sh.in	(revision 57945)
@@ -27,4 +27,7 @@
 ### END INIT INFO
 
+## @todo get rid of the autogeneration, perhaps write "version" and "group" to
+##       a configuration file in /etc
+
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:$PATH
 DEVICE=/dev/vboxdrv
@@ -32,4 +35,5 @@
 VERSION=%VERSION%
 MODPROBE=/sbin/modprobe
+SCRIPTNAME=vboxdrv
 
 if $MODPROBE -c | grep -q '^allow_unsupported_modules  *0'; then
@@ -37,5 +41,4 @@
 fi
 
-[ -f /etc/debian_release -a -f /lib/lsb/init-functions ] || NOLSB=yes
 [ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
 export BUILD_TYPE
@@ -57,91 +60,27 @@
 [ ! -f /etc/debian_release -o -x $VBOXMANAGE -a -x $BUILDINTMP ] || exit 0
 
-if [ -n "$NOLSB" ]; then
-    if [ -f /etc/redhat-release ]; then
-        system=redhat
-    elif [ -f /etc/SuSE-release ]; then
-        system=suse
-    elif [ -f /etc/gentoo-release ]; then
-        system=gentoo
-    fi
+[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
+
+# Preamble for Gentoo
+if [ "`which $0`" = "/sbin/rc" ]; then
+    shift
 fi
 
-[ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
-
-if [ -z "$NOLSB" ]; then
-    . /lib/lsb/init-functions
-    fail_msg() {
-        echo ""
-        log_failure_msg "$1"
-    }
-    succ_msg() {
-        log_end_msg 0
-    }
-    begin_msg() {
-        log_daemon_msg "$@"
-    }
-else
-    if [ "$system" = "redhat" ]; then
-        . /etc/init.d/functions
-        fail_msg() {
-            echo -n " "
-            echo_failure
-            echo
-            echo "  ($1)"
-        }
-        succ_msg() {
-            echo -n " "
-            echo_success
-            echo
-        }
-    elif [ "$system" = "suse" ]; then
-        . /etc/rc.status
-        fail_msg() {
-            rc_failed 1
-            rc_status -v
-            echo "  ($1)"
-        }
-        succ_msg() {
-            rc_reset
-            rc_status -v
-        }
-    elif [ "$system" = "gentoo" ]; then
-        if [ -f /sbin/functions.sh ]; then
-            . /sbin/functions.sh
-        elif [ -f /etc/init.d/functions.sh ]; then
-            . /etc/init.d/functions.sh
-        fi
-        fail_msg() {
-            eerror "$1"
-        }
-        succ_msg() {
-            eend "$?"
-        }
-        begin_msg() {
-            ebegin "$1"
-        }
-        if [ "`which $0`" = "/sbin/rc" ]; then
-            shift
-        fi
-    else
-        fail_msg() {
-            echo " ...failed!"
-            echo "  ($1)"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-    fi
-    if [ "$system" != "gentoo" ]; then
-        begin_msg() {
-            [ -z "${1:-}" ] && return 1
-            if [ -z "${2:-}" ]; then
-                echo -n "$1"
-            else
-                echo -n "$1: $2"
-            fi
-        }
-    fi
-fi
+begin_msg()
+{
+    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
+    logger "${SCRIPTNAME}: ${1}."
+}
+
+succ_msg()
+{
+    logger "${SCRIPTNAME}: done."
+}
+
+fail_msg()
+{
+    echo "${SCRIPTNAME}: failed: ${1}." >&2
+    logger "${SCRIPTNAME}: failed: ${1}."
+}
 
 failure()
@@ -158,5 +97,5 @@
 start()
 {
-    begin_msg "Starting VirtualBox kernel modules"
+    begin_msg "Starting VirtualBox kernel modules" console
     if [ -d /proc/xen ]; then
         failure "Running VirtualBox in a Xen environment is not supported"
@@ -219,5 +158,5 @@
 stop()
 {
-    begin_msg "Stopping VirtualBox kernel modules"
+    begin_msg "Stopping VirtualBox kernel modules" console
     if running vboxpci; then
         if ! rmmod vboxpci 2>/dev/null; then
Index: /trunk/src/VBox/Installer/linux/vboxweb-service.sh
===================================================================
--- /trunk/src/VBox/Installer/linux/vboxweb-service.sh	(revision 57944)
+++ /trunk/src/VBox/Installer/linux/vboxweb-service.sh	(revision 57945)
@@ -27,6 +27,6 @@
 
 PATH=$PATH:/bin:/sbin:/usr/sbin
-
-[ -f /etc/debian_release -a -f /lib/lsb/init-functions ] || NOLSB=yes
+SCRIPTNAME=vboxweb-service
+
 [ -f /etc/vbox/vbox.cfg ] && . /etc/vbox/vbox.cfg
 
@@ -45,89 +45,40 @@
 [ -r /etc/default/virtualbox ] && . /etc/default/virtualbox
 
-system=unknown
-if [ -f /etc/redhat-release ]; then
-    system=redhat
-    PIDFILE="/var/lock/subsys/vboxweb-service"
-elif [ -f /etc/SuSE-release ]; then
-    system=suse
-    PIDFILE="/var/lock/subsys/vboxweb-service"
-elif [ -f /etc/debian_version ]; then
-    system=debian
-    PIDFILE="/var/run/vboxweb-service"
-elif [ -f /etc/gentoo-release ]; then
-    system=gentoo
-    PIDFILE="/var/run/vboxweb-service"
-elif [ -f /etc/slackware-version ]; then
-    system=slackware
-    PIDFILE="/var/run/vboxweb-service"
-elif [ -f /etc/lfs-release ]; then
-    system=lfs
-    PIDFILE="/var/run/vboxweb-service.pid"
-else
-    system=other
-    if [ -d /var/run -a -w /var/run ]; then
-        PIDFILE="/var/run/vboxweb-service"
-    fi
+PIDFILE="/var/run/${SCRIPTNAME}"
+
+# Preamble for Gentoo
+if [ "`which $0`" = "/sbin/rc" ]; then
+    shift
 fi
 
-if [ -z "$NOLSB" ]; then
-    . /lib/lsb/init-functions
-    fail_msg() {
-        echo ""
-        log_failure_msg "$1"
-    }
-    succ_msg() {
-        log_success_msg " done."
-    }
-    begin_msg() {
-        log_daemon_msg "$@"
-    }
-fi
-
-if [ "$system" = "redhat" ]; then
-    . /etc/init.d/functions
-    if [ -n "$NOLSB" ]; then
-        start_daemon() {
-            usr="$1"
-            shift
-            daemon --user $usr $@
-        }
-        fail_msg() {
-            echo_failure
-            echo
-        }
-        succ_msg() {
-            echo_success
-            echo
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-fi
-
-if [ "$system" = "suse" ]; then
-    . /etc/rc.status
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            rc_failed 1
-            rc_status -v
-        }
-        succ_msg() {
-            rc_reset
-            rc_status -v
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-fi
-
-if [ "$system" = "debian" ]; then
+begin_msg()
+{
+    test -n "${2}" && echo "${SCRIPTNAME}: ${1}."
+    logger "${SCRIPTNAME}: ${1}."
+}
+
+succ_msg()
+{
+    logger "${SCRIPTNAME}: done."
+}
+
+fail_msg()
+{
+    echo "${SCRIPTNAME}: failed: ${1}." >&2
+    logger "${SCRIPTNAME}: failed: ${1}."
+}
+
+start_daemon() {
+    usr="$1"
+    shift
+    su - $usr -c "$*"
+}
+
+killproc() {
+    killall $1
+    rm -f $PIDFILE
+}
+
+if which start-stop-daemon >/dev/null; then
     start_daemon() {
         usr="$1"
@@ -137,110 +88,8 @@
         start-stop-daemon --background --chuid $usr --start --exec $bin -- $@
     }
+
     killproc() {
         start-stop-daemon --stop --exec $@
     }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-       }
-    fi
-fi
-
-if [ "$system" = "gentoo" ]; then
-    if [ -f /sbin/functions.sh ]; then
-        . /sbin/functions.sh
-    elif [ -f /etc/init.d/functions.sh ]; then
-        . /etc/init.d/functions.sh
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        bin="$1"
-        shift
-        start-stop-daemon --background --chuid $usr --start --exec $bin -- $@
-    }
-    killproc() {
-        start-stop-daemon --stop --exec $@
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-        if [ "`which $0`" = "/sbin/rc" ]; then
-            shift
-        fi
-    fi
-fi
-
-if [ "$system" = "slackware" ]; then
-    killproc() {
-        killall $1
-        rm -f $PIDFILE
-    }
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-fi
-
-if [ "$system" = "lfs" ]; then
-    . /etc/rc.d/init.d/functions
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo_failure
-        }
-        succ_msg() {
-            echo_ok
-        }
-        begin_msg() {
-            echo $1
-        }
-    fi
-    start_daemon() {
-        usr="$1"
-        shift
-        su - $usr -c "$*"
-    }
-    status() {
-        statusproc $1
-    }
-fi
-
-if [ "$system" = "other" ]; then
-    if [ -n "$NOLSB" ]; then
-        fail_msg() {
-            echo " ...fail!"
-        }
-        succ_msg() {
-            echo " ...done."
-        }
-        begin_msg() {
-            echo -n "$1"
-        }
-    fi
 fi
 
@@ -259,5 +108,5 @@
     if ! test -f $PIDFILE; then
         [ -z "$VBOXWEB_USER" ] && exit 0
-        begin_msg "Starting VirtualBox web service";
+        begin_msg "Starting VirtualBox web service" console;
         check_single_user $VBOXWEB_USER
         vboxdrvrunning || {
@@ -316,5 +165,5 @@
 stop() {
     if test -f $PIDFILE; then
-        begin_msg "Stopping VirtualBox web service";
+        begin_msg "Stopping VirtualBox web service" console;
         killproc $binary
         RETVAL=$?
