Code:
#!/bin/bash
# Author: Joshua Bailey
# Name: floppywrite
# Syntax: floppywrite fileToBeWritten.img
# This script writes an image file to a floppy
# Uncomment next line to unmount for auto-mounting systems
# umount /dev/fd0
COMPL=0
while [[ $COMPL -eq 0 ]]
do
if [[ ! -e /dev/fd0 ]]
then
echo "Your floppy doesn't appear to be at /dev/fd0"
read -p "Please type the path to your floppy drive: " FLOPPY
else
FLOPPY=/dev/fd0
fi
if [[ $# -eq 1 ]]
then
FILEN=$1
fi
if [[ ${#FILEN} = 0 ]]
then
read -p "Please specify a target file to be written: " FILEN
fi
if [[ -f $FILEN ]]
then
dd if=$FILEN of=$FLOPPY bs=1024 conv=sync ; sync
COMPL=1
echo "*** Done ***"
else
echo "$FILEN does not exist or the path is incorrect!"
read -p "Try again? [y|n] " ANS
ANS=`echo $ANS | tr [:upper:] [:lower:]`
if [[ ${ANS:0:1} = "n" ]]
then
exit
else
read -p "Please specify a target file to be written: " FILEN
fi
fi
done
for those of you who hate using a windows box to make your boot image floppies
and...i think i forgot to add a umount command...so make sure you unmount the floppy drive (if it's an auto-mount) before you run this