#!/bin/sh
MOUNTPOINT="/mnt/floppy"
echo "Trying to mount /dev/fd0 on ${MOUNTPOINT}..."
mount -t msdos /dev/fd0 ${MOUNTPOINT} 2>/dev/null
if [ $? = 0 ]; then
    echo "Ok."
else
    echo "failed. Exiting..."
    exit 1
fi;
if [ -f ${MOUNTPOINT}/etc.tar.bz2 ]; then tar jxvpf ${MOUNTPOINT}/etc.tar.bz2 -C /; fi
if [ -f ${MOUNTPOINT}/usrlocaletc.tar.bz2 ]; then tar jxvpf ${MOUNTPOINT}/usrlocaletc.tar.bz2 -C /; fi
if [ -f ${MOUNTPOINT}/var.tar.bz2 ]; then tar jxvpf ${MOUNTPOINT}/var.tar.bz2 -C /; fi
if [ -f ${MOUNTPOINT}/root.tar.bz2 ]; then tar jxvpf ${MOUNTPOINT}/root.tar.bz2 -C /; fi
if [ -f ${MOUNTPOINT}/dev.tar.bz2 ]; then tar jxvpf ${MOUNTPOINT}/dev.tar.bz2 -C /; fi
if [ -f ${MOUNTPOINT}/rc.tar.bz2 ]; then tar jxvpf ${MOUNTPOINT}/rc.tar.bz2 -C /; fi

echo "Finished. Unmounting floppy..."
umount ${MOUNTPOINT}
echo "Ok. You can remove it."
