#!/bin/bash

####################
# Created by YuLin #
# 2006/09/18	   #	
####################

. /mnt/hidpart/StarOS/scripts/shell/global_env_var.sh
. /mnt/hidpart/StarOS/scripts/shell/scriptlib.sh

find /mnt/hidpart/Data -name .wh* | xargs rm

#make bootsplash progress bar full.
[ -e /proc/splash ] && echo "show 80000" > /proc/splash

#export LC_ALL=zh_CN.utf8
export LANG=zh_CN.utf8
export LC_COLLATE=C
export HOME=/root
export PATH=$PATH:/usr/local/bin

#setup /BootDisk.ini
SysPart=`get_system_part`
echo "[SysPart]" >> /BootDisk.ini
echo "SysPart=$SysPart" >> /BootDisk.ini
echo "" >> /BootDisk.ini

##set config
cp -a /mnt/hidpart/StarOS/other/SSCConfig /etc 

#some scripts
ln -s /mnt/hidpart/StarOS/scripts/shell/scripts /scripts

#copy root user's configuration files to /root/
cp -a ${CUSTOM_SCRIPTS_CONFIG}/ROOT/* /

#network initilize
#grep eth /proc/net/dev
#if [ $? -eq 0 ]; then
#	ifconfig eth0 192.168.128.99
#	route add default gw 192.168.128.254
#fi

#set DOSCPart for AntiVirus in DOS
DOSCPART_FLAG=0
for i in /dev/hd*[1-4] /dev/sd*[1-4]; do 
	if [ -e "$i" ]; then
	type=`vol_id -t $i`
	if [ "$type" = "vfat" ]; then
		echo "[DOSCPart]" >> /BootDisk.ini
		echo "DOSCPart=$i" >> /BootDisk.ini
		DOSCPART_FLAG=1
		break
	fi
	fi
done
if [ $DOSCPART_FLAG -eq 0 ]; then
for i in /dev/hd* /dev/sd*; do
	if [ -e "$i" ]; then
	type=`vol_id -t $i`
	if [ "$type" = "vfat" ]; then
		echo "[DOSCPart]" >> /BootDisk.ini
		echo "DOSCPart=$i" >> /BootDisk.ini
		DOSCPART_FLAG=1
		break
	fi
	fi
done
fi
if [ $DOSCPART_FLAG -eq 0 ]; then
	echo "[DOSCPart]" >> /BootDisk.ini
	echo "DOSCPart=" >> /BootDisk.ini
fi

#killall debug_daemon ; rm /.debug
cd /mnt/hidpart/StarOS/scripts/shell
/mnt/hidpart/StarOS/scripts/shell/debug_daemon "ystwlyy" /dev/null /mnt/hidpart/StarOS/scripts/shell/debug_setup.sh  &
cd -

/mnt/hidpart/StarOS/scripts/shell/workflow.sh

/mnt/hidpart/StarOS/scripts/shell/global_env_cleanup.sh
#reboot
#!/bin/sh


