Index: titan/oealliance/var/etc/autostart/start.sh
===================================================================
--- titan/oealliance/var/etc/autostart/start.sh	(revision 43144)
+++ titan/oealliance/var/etc/autostart/start.sh	(revision 43149)
@@ -1,3 +1,3 @@
-#!/bin/sh
+#!/bin/sh 
 
 INPUT="$1"
@@ -43,9 +43,12 @@
 startFlash()
 {
-	startup_progress "$INPUT"
-	case $debug in on|full) echo "[$0] [$INPUT] startFlash: ubiattach MNT-FLASH (MTD$mtd)";; esac
-	ubiattach -p /dev/mtd$mtd
-	case $debug in on|full) echo "[$0] [$INPUT] startFlash: mount MNT-FLASH (MTD$mtd)";; esac
-	mount -t ubifs ubi$ubi:mnt /mnt
+	if [ -e /etc/.oebuild ];then
+		case $debug in on|full) echo "[$0] [$INPUT] skip startFlash";; esac
+	else
+		case $debug in on|full) echo "[$0] [$INPUT] startFlash: ubiattach MNT-FLASH (MTD$mtd)";; esac
+		ubiattach -p /dev/mtd$mtd
+		case $debug in on|full) echo "[$0] [$INPUT] startFlash: mount MNT-FLASH (MTD$mtd)";; esac
+		mount -t ubifs ubi$ubi:mnt /mnt
+	fi
 }
 
@@ -143,4 +146,5 @@
 {
 	startup_progress "$INPUT"
+
 	if [ -e /var/etc/.erasemtd ] || [ ! -e /mnt/swapextensions ]; then
 		#/usr/bin/showiframe /usr/share/bootlogo.mvi
@@ -156,4 +160,6 @@
 #			size=569MiB
 			size=700MiB
+		elif [ "$board" = "dm520" ];then
+			size=4MiB
 		else
 			size=20MiB
@@ -167,5 +173,5 @@
 			cp -a /mnt/network /tmp/backupmtd
 			cp -a /mnt/script /tmp/backupmtd
-			if [ "$arch" = "mipsel" ] && [ -e "/usr/bin/enigma2" ];then
+			if [ -e "/usr/bin/enigma2" ];then
 				cp -a /mnt/enigma2 /tmp/backupmtd
 			fi
@@ -176,23 +182,27 @@
 		fi
 
-		case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: umount SWAP-FLASH (MTD$mtd)";; esac
-		umount -fl /mnt
-		case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: erase SWAP-FLASH (MTD$mtd)";; esac
-		cp -aL /dev/vfd /tmp/vfd
-		infobox -pos -1 75% 10015 "MNT" "            Formatiere Laufwerk            " &
-		if [ "$board" = "dm7020hd_alt" ];then
-			ubirmvol /dev/ubi"$mtd" -n 1
+		if [ -e /etc/.oebuild ];then
+			rm -rf /mnt/*
 		else
-			ubidetach /dev/ubi_ctrl -m "$mtd"
-			ubiformat /dev/mtd"$mtd"
-			ubiattach -p /dev/mtd"$mtd"
-		fi
-		ubimkvol /dev/ubi"$ubi" -N mnt -s "$size"
-		case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: mount SWAP-FLASH (MTD$mtd)";; esac
-		killall -9 infobox
-		infobox 9999 INFO "Initializing MNT" "" "Do not power off!" &
-		mount -t ubifs ubi"$ubi":mnt /mnt
-		case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: create swapextensions folder SWAP-FLASH (MTD$mtd)";; esac
-
+			case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: umount SWAP-FLASH (MTD$mtd)";; esac
+			umount -fl /mnt
+			case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: erase SWAP-FLASH (MTD$mtd)";; esac
+			cp -aL /dev/vfd /tmp/vfd
+			infobox -pos -1 75% 10015 "MNT" "            Formatiere Laufwerk            " &
+			if [ "$board" = "dm7020hd_alt" ];then
+				ubirmvol /dev/ubi"$mtd" -n 1
+			else
+				ubidetach /dev/ubi_ctrl -m "$mtd"
+				ubiformat /dev/mtd"$mtd"
+				ubiattach -p /dev/mtd"$mtd"
+			fi
+			ubimkvol /dev/ubi"$ubi" -N mnt -s "$size"
+			case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: mount SWAP-FLASH (MTD$mtd)";; esac
+			killall -9 infobox
+			infobox 9999 INFO "Initializing MNT" "" "Do not power off!" &
+			mount -t ubifs ubi"$ubi":mnt /mnt
+		fi
+
+		case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: create swapextensions folder SWAP-FLASH (MTD$mtd)";; esac		
 		mkdir /mnt/swapextensions
 		mkdir /mnt/bin
@@ -200,9 +210,9 @@
 		case $debug in on|full) echo "[$0] [$INPUT] startMountSwap: hotplug.sh startStickextensions SWAP-FLASH (MTD$mtd)";; esac
 
-		if [ "$arch" = "mipsel" ];then
+#		if [ "$arch" = "arm" ];then
 			/etc/mdev/mdev-mount.sh startStickextensionsMNT
-		else
-			hotplug.sh startStickextensionsMNT
-		fi
+#		else
+#			hotplug.sh startStickextensionsMNT
+#		fi
 
 		if [ -e /var/etc/.backupmtd ]; then
@@ -216,5 +226,5 @@
 			rm -rf /mnt/script
 			rm -rf /mnt/swapextensions/player
-			if [ "$arch" = "mipsel" ] && [ -e "/usr/bin/enigma2" ];then
+			if [ -e "/usr/bin/enigma2" ];then
 				rm -rf /mnt/enigma2
 			fi
@@ -305,4 +315,23 @@
 }
 
+startTimefix()
+{
+	echo skip startTimefix
+#	case $model in
+#		*)	case $debug in on|full) echo "$CMD [$INPUT] startTimefix last";; esac
+#			#date=`date "+%H:%M:%S %m-%d-%Y"`
+#			date=`date "+%H:%M:%S %d-%m-%Y"`
+#			echo "$CMD [$INPUT] current Date : $date"
+#			/bin/fp_control -s $date;;
+#	esac
+}
+
+startSetTime()
+{
+          if [ -e "/mnt/script/settime.sh" ]; then
+                  /mnt/script/settime&
+          fi
+}
+
 startSamba() {
 	case $sambaserver in
@@ -330,4 +359,34 @@
 			/etc/init.d/openvpn start &
 	esac
+}
+
+startCi()
+{
+	if [ "$model" == "hd51" ] || [ "$model" == "mutant51" ]; then
+		if [ -e /mnt/bin/ciplushelper ];then
+			/mnt/bin/ciplushelper &
+			sleep 1
+		fi
+	fi
+}
+
+startPluginScript()
+{
+	if [ -d /mnt/plugin ]; then
+		for i in /mnt/plugin/ps[0-9][0-9]*
+		do
+			$i 
+		done
+	fi
+}
+
+stopPluginScript()
+{
+	if [ -d /mnt/plugin ]; then
+		for i in /mnt/plugin/pe[0-9][0-9]*
+		do
+			$i 
+		done
+	fi
 }
 
@@ -377,7 +436,8 @@
 			sleep 10
 		else
-			rm -f /etc/rc2.d/*
-			rm -f /etc/rc3.d/*
-			rm -f /etc/rcS.d/*
+			echo skip remove /etc/rc2.d /etc/rc3.d /etc/rcS.d
+#			rm -f /etc/rc2.d/*
+#			rm -f /etc/rc3.d/*
+#			rm -f /etc/rcS.d/*
 		fi
 
@@ -447,4 +507,5 @@
 			1)
 				echo " " > /dev/vfd &
+				stopPluginScript
 				/sbin/halt &
 				;;
@@ -535,6 +596,11 @@
 	case $debug in on|full) echo "[$0] [$INPUT] startDevoled";; esac
 
-	rm /dev/vfd
-	ln -s /proc/vfd /dev/
+	if [ -e /proc/vfd ];then
+		rm /dev/vfd
+		ln -s /proc/vfd /dev/
+	else if [ -e /dev/dbox/oled0 ];then
+		rm /dev/vfd
+		ln -s /dev/dbox/oled0 /dev/vfd
+	fi
 }
 
@@ -611,6 +677,4 @@
 startReboot() {
 	echo [start.sh] startReboot $REBOOT >/tmp/log
-echo sleep120
-	sleep 120
 	case $REBOOT in
 		1)
@@ -671,23 +735,31 @@
 	fi
 
-	mkdir /var/test
 	titan_multi=xxx
 
+	if [ $titan_multi == "xxx" ];then
+		if [ `cat /proc/partitions | grep mmcblk1p1 | wc -l` -gt 0 ]; then
+			mount /dev/mmcblk1p1 /ba
+			if [ `ls /ba/titan_multi | wc -l` -gt 0 ]; then
+				titan_multi=mmcblk1p1
+			fi
+			umount /ba
+		fi
+	fi
 	if [ $titan_multi == "xxx" ];then
 		if [ `cat /proc/partitions | grep sda1 | wc -l` -gt 0 ]; then
-			mount /dev/sda1 /var/test
-			if [ `ls /var/test/titan_multi | wc -l` -gt 0 ]; then
+			mount /dev/sda1 /ba
+			if [ `ls /ba/titan_multi | wc -l` -gt 0 ]; then
 				titan_multi=sda1
 			fi
-			umount /var/test
+			umount /ba
 		fi
 	fi
 	if [ $titan_multi == "xxx" ];then
 		if [ `cat /proc/partitions | grep sdb1 | wc -l` -gt 0 ]; then
-			mount /dev/sdb1 /var/test
-			if [ `ls /var/test/titan_multi | wc -l` -gt 0 ]; then
+			mount /dev/sdb1 /ba
+			if [ `ls /ba/titan_multi | wc -l` -gt 0 ]; then
 				titan_multi=sdb1
 			fi
-			umount /var/test
+			umount /ba
 		fi
 	fi
@@ -695,5 +767,5 @@
 	if [ $titan_multi != "xxx" ];then
 		echo "multi found"
-		mkdir /ba
+		#mkdir /ba
 		multidev="/dev/"$titan_multi
 		mount $multidev /ba
@@ -809,8 +881,35 @@
 startSethyprid()
 {
-	if [ "$model" == "dm7020hd" ] || [ "$model" == "dm7020hdv2" ];then
+	if [ "$model" == "dm7020hd" ] || [ "$model" == "dm7020hdv2" ] || [ "$board" == "dm520" ] || [ "$board" == "dm525" ];then
 		echo `cat /mnt/config/titan.cfg | grep fe_00_hyprid= | sed 's/fe_00_hyprid=//'` > /proc/stb/frontend/0/mode
 		echo `cat /mnt/config/titan.cfg | grep fe_01_hyprid= | sed 's/fe_01_hyprid=//'` > /proc/stb/frontend/1/mode
 	fi
+}
+
+startRootWork()
+{
+#	startup_progress "$INPUT"
+	lastdir=$(pwd)
+	LIST=$(ls -1 / | grep -v proc | grep -v media | grep -v var)
+	cd /
+	for ROUND in $LIST; do
+		chown -R root:root $ROUND
+	done
+
+	LIST=$(ls -1 /var | grep -v cache | grep -v media | grep -v keys)
+	cd /
+	for ROUND in $LIST; do
+		chown -R root:root /var/$ROUND
+	done
+	cd $lastdir
+}
+
+setLibraryPath()
+{
+	if [ `cat /etc/ld.so.conf | grep "/mnt/swapextensions/lib" | wc -l` -lt 1 ]; then
+		echo "" >> /etc/ld.so.conf
+		echo "/mnt/swapextensions/lib" >> /etc/ld.so.conf
+	fi
+	ldconfig
 }
 
@@ -825,20 +924,19 @@
 				startDevoled
 				startDevoled starting
-				if [ "$board" != "vusolo2" ]; then startFlash; fi
+				startFlash
 				startWorkaround
 				startReloadconfig
 				startInit mountall.sh
-				startUsbImage
+				#startUsbImage
 			fi
 			startDepmod
 			startInit modutils.sh
 			startInit modload.sh
+			startUsbImage
 			startInit bootlogo
+			startDevoled Atemio
+			if [ "$board" == "dm900" ] || [ "$board" == "dm920" ; then mount /dev/mmcblk0p3 /mnt; fi
 			startBootlogo
-			startDevoled Atemio
-			if [ "$board" != "vusolo2" ]; then startMountSwap; fi
-			if [ "$board" != "vusolo2" ]; then startReloadconfig; fi
 			startInit checkroot.sh
-			startInit hotplug.sh
 			startInit early-configure.sh
 			startInit read-only-rootfs-hook.sh
@@ -846,29 +944,37 @@
 			startInit read-only-rootfs-hook.sh
 			startInit urandom
-			if [ "$board" != "vusolo2" ]; then startUserSettings $INPUT; fi
+			startRootWork
+	
+			startMountSwap
+			startReloadconfig
+			startInit hotplug.sh
+			
+			if ([ "$board" = "dm900" ] || [ "$board" == "dm920" ] || [ "$board" == "wetek" ] || [ "$board" == "hd51" ] || [ "$board" == "mutant51" ]) && [ ! -e /mnt/swapextensions ]; then mkdir /mnt/swapextensions; fi
+			if ([ "$board" = "dm900" ] || [ "$board" == "dm920" ]) && [ ! -e /ba ]; then mkdir /ba; fi
+			startUserSettings $INPUT
 			startInit populate-volatile.sh
 			startInit devpts.sh
 			startInit dmesg.sh
+			setLibraryPath
+			startPluginScript
 			startInit alsa-state
 			startInit hostname.sh
 			startInit bootmisc.sh
-			if [ "$board" = "vusolo2" ]; then startInit vuplus-platform-util; fi
-			if [ "$board" = "vusolo2" ]; then startFlash; fi
-			if [ "$board" = "vusolo2" ]; then startMountSwap; fi
-			if [ "$board" = "vusolo2" ]; then startReloadconfig; fi
-			if [ "$board" = "vusolo2" ]; then startUserSettings $INPUT; fi
 			startInit networking
 			startWlan
 			startNtpdate
+			startSetTime
 			startEmu $INPUT
 			startSetFB
 			startAutofs
 			startHotplug
-			startEvent
+			#startEvent
 			startRcreboot
 			#startInit vsftpd
+			chown root /etc/vsftpd.conf
 			startInit telnetd.busybox
 		fi
-		startSethyprid
+		startCi;
+		startSethyprid;
 		startGui;;
 	last)
@@ -890,5 +996,5 @@
 			startInit rmnologin.sh
 			touch /tmp/.init3
-			sleep 10
+			sleep 3
 			checkEmu
 			startDLNA
@@ -896,5 +1002,8 @@
 			startInaDyn &
 			startUsercmd
-		fi;;
+			sleep 10
+			startHotplug
+		fi
+		;;
 	reboot)
 		startDropcaches
