#!/bin/sh

make -f ./Makefile
cp   -f ./tinysmbd				/usr/sbin/
cp 	 -f	./tinysmb           	/etc/init.d

if [   -f /etc/rc0.d/K36tinysmb ]; then
	rm -f /etc/rc0.d/K36tinysmb
fi

if [   -f /etc/rc1.d/K36tinysmb ]; then
	rm -f /etc/rc1.d/K36tinysmb
fi

if [   -f /etc/rc2.d/K36tinysmb ]; then
	rm -f /etc/rc2.d/K36tinysmb
fi

if [   -f /etc/rc3.d/S36tinysmb ]; then
	rm -f /etc/rc3.d/S36tinysmb
fi

if [   -f /etc/rc4.d/K36tinysmb ]; then
	rm -f /etc/rc4.d/K36tinysmb
fi

if [   -f /etc/rc5.d/S36tinysmb ]; then
	rm -f /etc/rc5.d/S36tinysmb
fi

if [   -f /etc/rc6.d/K36tinysmb ]; then
	rm -f /etc/rc6.d/K36tinysmb
fi

ln   -s	/etc/init.d/tinysmb	 /etc/rc0.d/K36tinysmb
ln   -s	/etc/init.d/tinysmb	 /etc/rc1.d/K36tinysmb
ln   -s	/etc/init.d/tinysmb	 /etc/rc2.d/K36tinysmb
ln   -s	/etc/init.d/tinysmb	 /etc/rc3.d/S36tinysmb
ln   -s	/etc/init.d/tinysmb	 /etc/rc4.d/K36tinysmb
ln   -s	/etc/init.d/tinysmb	 /etc/rc5.d/S36tinysmb
ln   -s	/etc/init.d/tinysmb	 /etc/rc6.d/K36tinysmb

if [ ! -d /etc/tinysmb ]; then
	mkdir	/etc/tinysmb
fi

if [ ! -f /etc/tinysmb/tinypasswd ]; then
	cp  ./Configuration/tinypasswd   /etc/tinysmb
fi


if [ ! -f /etc/tinysmb/tinysmb.conf ]; then

	if [ ! -d /usr/test ]; then
		mkdir	/usr/test
	fi

	if [ ! -f /usr/test/test.txt ]; then
		echo	"Hallo" >/usr/test/test.txt
	fi


	cp  ./Configuration/tinysmb.conf   /etc/tinysmb

	echo "   "
	echo " test configuration installed"
	echo "   "
	echo "   please check the ip address in /etc/tinysmb/tinysmb.conf "
	echo "   and restart your pc"
	echo "   "
	echo "   use  'test' as login "
	echo "   use  'abc'  as password "
	echo "   "

fi
