Register
It is currently Mon Dec 22, 2014 3:32 pm

BASH SCRIPT : "rawrite" for linux script


All times are UTC


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Tue Jan 20, 2004 11:41 pm   
Moderator
User avatar

Joined: Tue Dec 02, 2003 7:48 pm
Posts: 1723
Location: Georgia
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


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


Powered by phpBB © 2012 phpBB Group
© 2003 - 2012 USA LINUX USERS GROUP