#! /bin/bash

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/root/bin:/usr/X11R6/bin:/usr/local/bin:/lbin

exec < /dev/console > /dev/console 2>&1 3>&1

#echo verbose >/proc/splash

echo 'root: reboot' > /etc/yast.inf

set > /tmp/SETTING

## Evaluate the boot parameter
for i in `cat /proc/cmdline `
do
    echo $i | grep -q '=' && eval "export $i";
done

if [ -z "${SERVER}" ]
then
        export SERVER="admin"
fi

if [ -z "$NOSSH" ]
then
	/usr/bin/ssh-keygen -A
	/usr/sbin/sshd -q
	curl ftp://${SERVER}/itool/authorized_keys  >> /root/.ssh/authorized_keys
	chmod 700 /root/.ssh/
	chmod 600 /root/.ssh/authorized_keys
fi

curl ftp://${SERVER}/itool/scripts/login > /root/login
curl ftp://${SERVER}/itool/scripts/clone.sh > /root/clone.sh

/bin/bash ${CDEBUG} -l /root/login

