# Script to save off the current SSH configuration to floppy
# So the next time we boot, we have our old settings.
# CD-ROM users will want to copy the -.tgz files to the
# /trinux/tux/etc/pkg/
# folder, then create a new iso.
# Revised tburt 11-07-01

umount /dev/fd0 > /dev/null 2> /dev/null

cd /

#tar czvf /etc/tux/pkg/opensshd/sshroot.tgz /.ssh
# tar czvf /etc/tux/pkg/opensshd/sshhost.tgz /usr/local/etc/ssh*


[ -d /etc/tux/pkg/opensshd ] || mkdir -p /etc/tux/pkg/opensshd


tar cvf - /.ssh | gzip > /etc/tux/pkg/opensshd/sshroot.tgz 
tar cvf - /usr/local/etc/ssh* | gzip > /etc/tux/pkg/opensshd/sshhost.tgz 

if [ -f /etc/proc/boot ]
then
	BOOT=`cat /etc/proc/boot`
else
	BOOT="/dev/fd0"	
fi

if [ "$BOOT" = "/dev/fd0" ]
then
	echo -n "Enter boot floppy and hit RETURN:"
	read blah
else
	PREFIX="trinux/"
fi

if mount -t vfat $BOOT /boot
then

	cd /boot/${PREFIX}
	[ -d tux/pkg/opensshd ] || mkdir -p tux/pkg/opensshd

	cp /etc/tux/pkg/opensshd/sshroot.tgz .
	cp /etc/tux/pkg/opensshd/sshhost.tgz .

	cd /
	sync

	umount /boot
else
	echo "Unable to mount $BOOT"
fi
