#! /sbin/sh
#Tag 0x00000f00

# Initial System Setup
# "$Revision: 1.42 $"

case "$1" in
'start')

    #  If there are trademark files, print them.
    if test -d /etc/tm; then
	    cat /etc/tm/* 2> /dev/null
    fi

    # set the system name
    /sbin/suattr -C CAP_SYSINFO_MGT+ip -c "hostname `cat /etc/sys_id`"

    #  Start the syslog-demon
    /sbin/suattr -M dbadmin -c "killall syslogd"
    /sbin/suattr -M dbadmin -C CAP_DAC_WRITE,CAP_MAC_WRITE,CAP_NETWORK_MGT,CAP_PRIV_PORT+ip -c "/usr/etc/syslogd ""`cat /etc/config/syslogd.options 2> /dev/null`"

    #  Start the eventmonitor-demon
    if test -x /etc/init.d/eventmonitor; then
       /etc/init.d/eventmonitor start >/dev/null 2>&1
    fi

    #  Setup Autologin
    if test -r /etc/autologin; then
	    > /etc/autologin.on
    fi

    for ENTRY in /etc/autologin.ttyd*
    do
	if test -r $ENTRY
	then
		> $ENTRY.on
	fi
    done
    ;;	

'stop')
    #  Stop the eventmonitor-demon
    if test -x /etc/init.d/eventmonitor; then
       /etc/init.d/eventmonitor stop >/dev/null 2>&1
    fi

    # Stop the syslog-demon
    /sbin/suattr -M dbadmin -c "killall 15 syslogd"
    killall 15 cached
    exit 0
    ;;

*)
    echo "usage: $0 {start|stop}"
    ;;
esac


