#!/bin/bash
#
# mambawelcome - start mambawelcome on first time system execution
# Copyright (c) 2007-2014 by Silvan Calarco <silvan.calarco@mambasoft.it>

if [ $UID != 0 ]; then
   echo "$0: must be superuser." >&2
   exit 1
fi
. /etc/sysconfig/i18n
export LANG
export HOME=/root

INPUT_FILE=/root/.installer.conf

[ -e $INPUT_FILE ] || exit 0

. $INPUT_FILE

[ "$INSTALL_USER" ] && exit 0

# restore mixer status to prevent it to be set to 0 values in case of shutdown
/usr/sbin/alsactl restore >/dev/null 2>&1

#xset -dpms
[ -e /opt/kde3/bin/kconf_update ] && PATH=/opt/kde3/bin:$PATH kconf_update
#/opt/kde3/bin/dcopserver
xinit /opt/kde3/bin/kmdr-executor /usr/share/openmamba/mambawelcome/mambawelcome.kmdr -- -br -dpi 100
#/opt/kde3/bin/dcopserver_shutdown
killall -9 dcopserver

if [ -e /root/.mambawelcome-not-completed ]; then
   rm -f /root/.mambawelcome-not-completed
   poweroff
else
   systemctl disable mambawelcome.target
   systemctl isolate graphical.target
fi

exit 0
