#num_steps=`cat /var/etc/autostart/start.sh | sed 's/\t\+/ /g' | sed 's/ \+/ /g' | sed 's/^ //g' | tr ' ' '~' | tr '\n' ' ' | sed 's/.*first)/\nprozstrat=/g' | grep ^proz | sed 's/;; last)/\nerror/g' | grep ^proz | tr ' ' '\n' | grep -v startup_progress | grep ^start | wc -l`
num_steps=`cat /var/etc/autostart/start.sh | sed 's/\t\+/ /g' | sed 's/ \+/ /g' | sed 's/^ //g' | tr ' ' '~' | tr '\n' ' ' | sed 's/.*first)/\nprozstrat=/g' | grep ^proz | sed 's/;; last)/\nerror/g' | grep ^proz | tr ' ' '\n' | grep -v startup_progress | sed "s/~then~/~then~\n/g" | grep ^start | sort -u | wc -l`
progress_size=100
step_change=1
first_step=0
step_change=1
step=0
count=0
		
startup_progress()
{
	if [ "$1" == "first" ];then
		count=$(($count + 1))
	
	    step=$(($step + $step_change))
	
	    if [ "$num_steps" != "0" ]; then
	        progress=$(($step * $progress_size / $num_steps))
	    else
	        progress=$progress_size
	    fi
		if [ $progress -gt 0 -a -e /proc/vfd ] && [ "$progress" -lt "101" ]; then
	        echo Loading $progress % > /proc/vfd
		elif [ $progress -gt 0 -a -e /proc/progress ] && [ "$progress" -lt "101" ]; then
	        echo $(($progress)) > /proc/progress
		fi
	fi
}

backuptpk()
{
	tpkbackupdir="/tmp/tpk.sich"
	tpkrestoredir="/mnt/tpk"

	oldifs="$IFS"
	IFS=$'\n'
	unset dirlist
	
	rm -r "$tpkbackupdir" > /dev/null 2>&1
	mkdir -p "$tpkbackupdir"
	dirlist=`find "$tpkrestoredir"/*`

	for dir in $dirlist; do
		if [ -d "$dir" ]; then
			grep -q "^Installpath: /mnt/swapextensions" "$dir/control"
			ret1=$?
			grep -q "^/mnt/swapextensions/" "$dir/restore.tpk"
			ret2=$?
			if [ $ret1 -ne 0 ] && [ $ret2 -ne 0 ]; then
				echo "[$0] backup $dir"
				cp -a "$dir" "$tpkbackupdir"
			fi
		fi
	done
	
	cp -a "$tpkrestoredir/"*.del "$tpkbackupdir"

	IFS="$oldifs"
}

restoretpk()
{
	tpkbackupdir="/tmp/tpk.sich"
	tpkrestoredir="/mnt/tpk"

	oldifs="$IFS"
	IFS=$'\n'
	unset dirlist
	
	mkdir -p "$tpkrestoredir"
	
	cp -a "$tpkbackupdir"/* "$tpkrestoredir"

	rm -r "$tpkbackupdir"
	IFS="$oldifs"
}

fastgrep()
{
	# fastgrep input search
	# fgr = output
	oldifs="$IFS"
	IFS=$'\n'
	fgr=""
	for line in $1; do
		line1=${line/$2}
		if [ "$line" != "$line1" ]; then
				fgr="$line"
		fi
	done
	IFS="$oldifs"
}

fastcut()
{
	# fastcut input delimiter field
	#	fcr = output
	oldifs="$IFS"
	IFS="$2"
	fcr=""
	count=0
	for part in $1; do
		count=$((count+1))
		if [ $3 -eq $count ]; then
				fcr="$part"
				break
		fi
	done
	IFS="$oldifs"
}

startUserSettings() 
{
	if [ ! -e /tmp/.init3 ];then
		startup_progress $1
		echo "[$0] startUserSettings"

# samba workaround reset allways smb.cfg
		checksmb=`cat /mnt/config/smb.conf | grep "\[global\]" | wc -l`

		if [ ! -e /mnt/config/smb.conf ] || [ "$checksmb" == "0" ];then
			cp -a /etc/titan.restore/mnt/config/smb.conf /mnt/config/smb.conf
		fi

		sed -e "2,/\[/s/\[/|/" -e "/|/,$ d" -e 's/ \+/ /g' -e '/^$/d' -i /mnt/config/smb.conf
		echo -e "\n" >> /mnt/config/smb.conf
		echo "[media]" >> /mnt/config/smb.conf
		echo "comment = Media Files" >> /mnt/config/smb.conf
		echo "path = /media" >> /mnt/config/smb.conf
		echo "read only = no" >> /mnt/config/smb.conf
		echo "public = yes" >> /mnt/config/smb.conf
		echo "guest ok = yes" >> /mnt/config/smb.conf

		arch=`cat /etc/.arch`
		error=0
		if [ ! -e /mnt/swapextensions ]; then error="/mnt/swapextensions"; fi
	
	#### user network
		if [ "$error" = "0" ] && [ ! -e /mnt/network ]; then mkdir /mnt/network || error="/mnt/network"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/network/resolv.conf ]; then cp -a /etc/titan.restore/mnt/network/resolv.conf /mnt/network/resolv.conf || error="/mnt/network/resolv.conf"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/network/hosts ]; then cp -a /etc/titan.restore/mnt/network/hosts /mnt/network/hosts || error="/mnt/network/hosts"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/network/hostname ]; then cp -a /etc/titan.restore/mnt/network/hostname /mnt/network/hostname || error="/mnt/network/hostname"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/network/interfaces ]; then cp -a /etc/titan.restore/mnt/network/interfaces /mnt/network/interfaces || error="/mnt/network/interfaces"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/network/auto.misc ]; then cp -a /etc/titan.restore/mnt/network/auto.misc /mnt/network/auto.misc || error="/mnt/network/auto.misc"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/network/default_gw ]; then cp -a /etc/titan.restore/mnt/network/default_gw /mnt/network/default_gw || error="/mnt/network/default_gw"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/network/passwd ]; then cp -a /etc/titan.restore/mnt/network/passwd /mnt/network/passwd || error="/mnt/network/passwd"; fi
	 
	#### user config
		if [ "$error" = "0" ] && [ ! -e /mnt/config ]; then mkdir /mnt/config || error="/mnt/config"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/start-config ]; then cp -a /etc/titan.restore/mnt/config/start-config /mnt/config/start-config || error="/mnt/config/start-config"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/usercmd.sh ]; then cp -a /etc/titan.restore/mnt/config/usercmd.sh /mnt/config/usercmd.sh || error="/mnt/config/usercmd.sh"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/usercmd.after.rec.sh ]; then cp -a /etc/titan.restore/mnt/config/usercmd.after.rec.sh /mnt/config/usercmd.after.rec.sh || error="/mnt/config/usercmd.after.rec.sh"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/titan.cfg ]; then cp -a /etc/titan.restore/mnt/config/titan.cfg /mnt/config/titan.cfg || error="/mnt/config/titan.cfg"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/rcconfig ]; then cp -a /etc/titan.restore/mnt/config/rcconfig /mnt/config/rcconfig || error="/mnt/config/rcconfig"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/browserfav ]; then cp -a /etc/titan.restore/mnt/config/browserfav /mnt/config/browserfav || error="/mnt/config/browserfav"; fi
	
		if [ "$error" = "0" ] && [ ! -e /mnt/config/hbbtvfav ]; then cp -a /etc/titan.restore/mnt/config/hbbtvfav /mnt/config/hbbtvfav || error="/mnt/config/hbbtvfav"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/inadyn.conf ]; then cp -a /etc/titan.restore/mnt/config/inadyn.conf /mnt/config/inadyn.conf || error="/mnt/config/inadyn.conf"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/rcmap ]; then cp -a /etc/titan.restore/mnt/config/rcmap /mnt/config/rcmap || error="/mnt/config/rcmap"; fi			
		if [ "$error" = "0" ] && [ ! -e /mnt/config/stock ]; then cp -a /etc/titan.restore/mnt/config/stock /mnt/config/stock || error="/mnt/config/stock"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/timers.xml ]; then cp -a /etc/titan.restore/mnt/config/timers.xml /mnt/config/timers.xml || error="/mnt/config/timers.xml"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/weather ]; then cp -a /etc/titan.restore/mnt/config/weather /mnt/config/weather || error="/mnt/config/weather"; fi
	
		if [ "$error" = "0" ] && [ ! -e /mnt/config/smb.conf ]; then cp -a /etc/titan.restore/mnt/config/smb.conf /mnt/config/smb.conf || error="/mnt/config/smb.conf"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/exports ]; then cp -a /etc/titan.restore/mnt/config/exports /mnt/config/exports || error="/mnt/config/exports"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/extepg ]; then cp -a /etc/titan.restore/mnt/config/extepg /mnt/config/extepg || error="/mnt/config/extepg"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/playlist ]; then cp -a /etc/titan.restore/mnt/config/playlist /mnt/config/playlist || error="/mnt/config/playlist"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/mostzap ]; then cp -a /etc/titan.restore/mnt/config/mostzap /mnt/config/mostzap || error="/mnt/config/mostzap"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/lastsubtitle ]; then cp -a /etc/titan.restore/mnt/config/lastsubtitle /mnt/config/lastsubtitle || error="/mnt/config/lastsubtitle"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/skinconfig ]; then cp -a /etc/titan.restore/mnt/config/skinconfig* /mnt/config/ || error="/mnt/config/skinconfig"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/config/choices ]; then cp -a /etc/titan.restore/mnt/config/choices /mnt/config/choices || error="/mnt/config/choices"; fi
	
	#### user bougets
		if [ "$error" = "0" ] && [ ! -e /mnt/settings ]; then mkdir /mnt/settings || error="/mnt/settings"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/settings/bouquets.cfg ]; then
			cp -a /etc/titan.restore/mnt/settings/bouquets.cfg /mnt/settings/bouquets.cfg || error="/mnt/settings/bouquets.cfg" 
			cp -a /etc/titan.restore/mnt/settings/bouquets.*.tv /mnt/settings
			cp -a /etc/titan.restore/mnt/settings/bouquets.*.radio /mnt/settings
		fi
		if [ "$error" = "0" ] && [ ! -e /mnt/settings/channel ]; then cp -a /etc/titan.restore/mnt/settings/channel /mnt/settings/channel || error="/mnt/settings/channel"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/settings/provider ]; then cp -a /etc/titan.restore/mnt/settings/provider /mnt/settings/provider || error="/mnt/settings/provider"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/settings/transponder ]; then cp -a /etc/titan.restore/mnt/settings/transponder /mnt/settings/transponder || error="/mnt/settings/transponder"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/settings/transponderencoding ]; then cp -a /etc/titan.restore/mnt/settings/transponderencoding /mnt/settings/transponderencoding || error="/mnt/settings/transponderencoding"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/settings/satellites ]; then cp -a /etc/titan.restore/mnt/settings/satellites /mnt/settings/satellites || error="/mnt/settings/satellites"; fi
		if [ "$error" = "0" ] && [ ! -e /mnt/settings/epgchannel ]; then cp -a /etc/titan.restore/mnt/settings/epgchannel /mnt/settings/epgchannel || error="/mnt/settings/epgchannel"; fi
	
	#### user tpk
		if [ "$error" = "0" ] && [ ! -e /mnt/tpk ]; then mkdir /mnt/tpk || error="/mnt/tpk"; fi
	
	#### user script
		if [ "$error" = "0" ] && [ ! -e /mnt/script ]; then mkdir /mnt/script || error="/mnt/script"; fi
	
	#### enigma2
		if [ "$arch" == "mipsel" ] && [ -e "/usr/bin/enigma2" ] && [ "$error" = "0" ] && [ ! -e /mnt/enigma2 ]; then cp -a /etc/titan.restore/mnt/enigma2 /mnt || error="/mnt/enigma2"; fi
	
		if [ "$error" = "0" ] && [ -e /var/etc/.firststart ]; then
			cp -a /etc/titan.restore/mnt/config/rcconfig /mnt/config/rcconfig
			sync-start-config.sh $arch
			sync-titan-config.sh $arch
			sync-rcconfig.sh $arch
			sed "s!auto,sync,noatime!auto,noatime!g" -i /mnt/network/auto.misc

			MVERSION=`cat /etc/version-svn | cut -d"_" -f2 | sed 's/M//'`
			if [ "$MVERSION" == "39147" ];then
				# zwangs restore on stable 1.85
				cp -a /etc/titan.restore/mnt/config/skinconfig* /mnt/config/
				startUserRestore without_channelsettings
				# override rcconfig auto on firstboot
				cp -a /etc/titan.restore/mnt/config/rcconfig /mnt/config/rcconfig
			fi

			rm -f /var/etc/.firststart
			if [ "$arch" == "mipsel" ];then sync; fi
			touch /tmp/.syncing.done
		fi
	
	#### on error format swap mtd
		if [ "$error" != "0" ]; then
			touch /var/etc/.erasemtd
			echo "[$0] startUserSettings: found errorcode in: cant create $error (autoformat this device)"
			sysinfo.sh
			cat /tmp/sysinfo.txt
		fi
	fi
}

startUserRestore() 
{
	echo "[$0] startUserRestore: start"

# backup channel settings
	if [ ! -z "$1" ] && [ "$1" == "without_channelsettings" ];then
		FE=`cat /mnt/config/titan.cfg | grep ^fe_`
		echo "[$0] startUserRestore: $1 save FE=$FE"
		CHANNELLIST=`cat /mnt/config/titan.cfg | grep ^channellist=`
		echo "[$0] startUserRestore: $1 save CHANNELLIST=$CHANNELLIST"
		SERVICEID=`cat /mnt/config/titan.cfg | grep ^serviceid=`
		echo "[$0] startUserRestore: $1 save SERVICEID=$SERVICEID"
		echo "[$0] startUserRestore: $1 save /mnt/settings > /mnt/save.settings"
		rm -rf /mnt/save.settings
		mv -f /mnt/settings /mnt/save.settings
	fi

	rm -rf /mnt/settings
	rm -rf /mnt/config
	rm -rf /mnt/network
	if [ "$arch" == "mipsel" ];then rm -rf /mnt/enigma2; fi

# copy restore data
	echo "[$0] startUserRestore: copy /etc/titan.restore/* /"
	cp -r /etc/titan.restore/* /

# backup channel settings
	if [ ! -z "$1" ] && [ "$1" == "without_channelsettings" ];then
		if [ -e "/mnt/save.settings" ];then
			echo "[$0] startUserRestore: $1 remove /mnt/settings"
			rm -rf /mnt/settings
			echo "[$0] startUserRestore: $1 save /mnt/save.settings > /mnt/settings"
			mv /mnt/save.settings /mnt/settings
		fi
		echo " " >> /mnt/config/titan.cfg
		if [ ! -z "$FE" ];then
			sed 's/^fe_.*//g' -i /mnt/config/titan.cfg
			echo "[$0] startUserRestore: $1 write titan.cfg with FE=$FE"
			echo "$FE" >> /mnt/config/titan.cfg
		fi
	
		if [ ! -z "$CHANNELLIST" ];then
			sed 's/^channellist=.*//g' -i /mnt/config/titan.cfg
			echo "[$0] startUserRestore: $1 write titan.cfg with CHANNELLIST=$CHANNELLIST"
			echo "$CHANNELLIST" >> /mnt/config/titan.cfg
		fi
	
		if [ ! -z "$SERVICEID" ];then
			sed 's/^serviceid=.*//g' -i /mnt/config/titan.cfg
			echo "[$0] startUserRestore: $1 write titan.cfg with SERVICEID=$SERVICEID"
			echo "$SERVICEID" >> /mnt/config/titan.cfg
		fi
	fi
}

startWaitfor()
{
	# $1 = file auf das wir warten
	# $2 = maximale zeit
	w=$(($2*4))
	a=0
	while [ ! -e "$1" ]; do
		usleep 250000
		a=$(($a+1))
		if [ $a -gt $w ]; then
			echo "[$0] startWaitfor timed out: maxwaittime=$2 sec waitfor=$1"
			return
		fi
	done
}

startFsck() {
	echo "[$0] startFsck parameter1=$1 parameter2=$2"
	
	read model < /etc/model
	
	TYPE=`blkid -w /dev/null -c /dev/null -s TYPE | grep -m1 "/dev/$1" | sed 's/^.*TYPE="//;s/".*$//'`
	if [ "$1" ]; then
		case $2 in swap) swap.sh swapfileoff "$SWTYPE" "$model";; esac
		start_sec.sh 10 umount "/dev/$1"
		case $TYPE in
			fat|vfat|msdos) /sbin/fsck.vfat -y "/dev/$1";;
			ext2|ext3)      /sbin/fsck."$TYPE" -f -p "/dev/$1";;
			jfs)            /sbin/jfs_fsck -a -f -p "/dev/$1";;
		esac
		case $2 in swap) swap.sh "" "$SWTYPE" "$model";; esac
	fi
}

startEmu() {
	startup_progress $1
	case $emu in
		off) ;;
		*)
			case $debug in on|full) echo "[$0] start $emu";; esac
			emu.sh "start" "" &;;
	esac
}

startBlkid()
{
	blkid=`blkid -w /dev/null -c /dev/null /dev/sd*`
	devlist=`blkid -w /dev/null -c /dev/null /dev/sd* | cut -d":" -f1 | sed "s!/dev/!!g"`
	echo "[blkid] set auto.misc entry /mnt/network/auto.misc"
	
	for device in $devlist; do
		blkidline=`echo -e "$blkid" | grep -m1 "^/dev/$device:"`

		fastgrep "$blkidline" "SEC_TYPE="; fgr=${fgr/*TSEC_TYPE=\"/}; fgr=${fgr/\"*/}; type=${fgr//[ -]/}	
		if [ -z "$type" ]; then
			fastgrep "$blkidline" "TYPE="; fgr=${fgr/*TYPE=\"/}; fgr=${fgr/\"*/}; type=${fgr//[ -]/}	
		fi
		if [ ! -z "$type" ]; then
			devline="$device	-fstype=$type,sync,noatime,nodiratime	:/dev/$device"
			echo "[blkid] write: $devline"
			sed "s!$device	.*!$devline!" -i /mnt/network/auto.misc
		else
			devline="$device	-fstype=auto,sync,noatime,nodiratime	:/dev/$device"
			echo "[blkid] write: $devline"
			sed "s!$device	.*!$devline!" -i /mnt/network/auto.misc		
		fi
	done
}

startSetFB()
{
	board=`cat /etc/.board`

	startup_progress "$INPUT"
	case $debug in on|full) echo "[$0] [$INPUT] startSetFB: start";; esac
	if [ $board = "inihde" ] || [ $board = "inihde2" ] || [ $board = "inihde2am" ] || [ $board = "inihdp" ];then
		fbset 1280x720-0
	elif [ $board = "dm7020hd" ];then	
		fbset 1280x720-43
	elif [ $board = "dm900" ] || [ $board = "dm520" ] || [ $board = "dm525" ];then	
		fbset 1280x720-43
	elif [ $board = "vusolo2" ];then	
		fbset 1920x1080-32newtuner
	else
		fbset 1280x720-25
	fi
}

startcec()
{
	read model < /etc/model
	if [ "$model" == "spark7162" ]; then
		echo "[$0] startcec"
		sed "s/options cec activemode=.*/options cec activemode=1/" -i /etc/modprobe.d/_spark7162.conf
	fi
}

starthyprid()
{
	read model < /etc/model
	if [ "$model" == "spark7162" ]; then
		echo "[$0] starthyprid"

		if [ `cat /mnt/config/titan.cfg | grep ^"hypridtuner=" | cut -d "=" -f2 | wc -l` -eq 1 ]; then
			tuner=`cat /mnt/config/titan.cfg | grep ^"hypridtuner=" | cut -d "=" -f2`
			echo "[$0] starthyprid: find hypridtuner=$tuner entry in titan.cfg"
		else
			tuner=c
			echo "[$0] starthyprid: use default newtuner"
		fi

		echo "[$0] starthyprid: set UnionTunerType=$tuner"

		sed "s/options spark7162 UnionTunerType=.*/options spark7162 UnionTunerType=$tuner/" -i /etc/modprobe.d/_spark7162.conf
		startcec
		if [ "$1" == "mnt" ];then
			chmod -R 644 /mnt/network
			rm /var/etc/.firstboot
			touch /var/etc/.firstok

			echo "[$0] starthyprid: Tuner needs reboot"
			init 6
		fi
	fi
}

startipsec()
{
	echo "[$0] startipsec: check"
	activ=$(cat /mnt/config/start-config | sed -nr "s/.*ipsec=([^*]+)*/\1/p")
	if [ "$activ" == "y" ];	then
		ARCH=$(cat /etc/.arch)
		if [ "$ARCH" == "sh4" ];then
			sleep 30
		else
			activ=$(cat /mnt/config/start-config | sed -nr "s/.*wlan=([^*]+)*/\1/p")
			if [ "$activ" == "y" ];	then
				echo "[$0] startipsec: sleep 10"
				sleep 2
			fi
		fi
		echo "[$0] startipsec: starting"
		ipsec.sh start
		emu.sh restart
	fi
}

starthostname()
{
    IP=""
	while [ -z "$IP" ]
	do
		IP=$(ifconfig | sed 's/^$/#/g' | tr '\n' ' ' | tr '#' '\n' | grep inet | grep Bcast | awk '{print $7}' | cut -d":" -f2 | cut -d"." -f4)
        echo "[$0] starthostname: sleep 1 IP=$IP" 
		sleep 1
	done

	startipsec

    MODEL=$(cat /etc/model) 
#    hostname "$MODEL ($IP)"
    echo "$MODEL-$IP" > /etc/hostname
    sysctl "kernel.hostname=$MODEL-$IP.local.host"
    hostname -F /etc/hostname
#disable smb pass
#    mv -f /etc/samba/private/smbpasswd /etc/samba/private/smbpasswd.org
#    /etc/init.d/samba restart
#    /etc/init.d/vsftpd restart
#    /etc/init.d/dropbear restart
    /etc/init.d/avahi-daemon restart
}

startudev()
{
#not used curently, oebuild is autofs to late we use mount
	echo "[$0] startudev"

	DEVICES=$(fdisk -l | grep /dev/ | grep -v /dev/ram | grep -v /dev/mmc | grep -v "Disk /dev/sd" | sed 's/^Disk //g' | awk '{ print $1 }'  | cut -d":" -f1 | sed 's!/dev/mapper/!crypt-!g' | sed 's!/dev/!!g')
	for DEV in $DEVICES; do

		[ -L /media/hdd ] && [ ! -e $(readlink /media/hdd) ] && rm /media/hdd && rm /media/.moviedev
		[ ! -e /media/hdd ] && [ -d /media/autofs/${DEV}/movie ] && ln -s "/media/autofs/${DEV}" /media/hdd && echo "$DEV#$FSTYPE#$LABEL" > /media/.moviedev

		[ -L /var/backup ] && [ ! -e $(readlink /var/backup) ] && rm /var/backup && rm /media/.backupdev
		[ ! -e /var/backup ] && [ -d /media/autofs/$DEV}/backup ] && ln -s "/media/autofs/${DEV}/backup" /var/backup && echo "$DEV#$FSTYPE#$LABEL" > /media/.backupdev

		[ -L /var/swapextensions ] && [ ! -e $(readlink /var/swapextensions) ] && rm /var/swapextensions && rm /media/.swapextensionsdev
		[ ! -e /var/swapextensions ] && [ -d /media/autofs/${DEV}/swapextensions ] && ln -s "/media/autofs/${DEV}/swapextensions" /var/swapextensions && echo "$DEV#$FSTYPE#$LABEL" > /media/.swapextensionsdev

	done
	touch /tmp/.startudev
}

