check for /dev/fd0?

Jeremy Wakeman cael-JTkAzvGkdyMrpQx6IzTi3laTQe2KTcn/ at public.gmane.org
Thu Mar 11 17:20:57 UTC 2004


Ok, everyone, here's a question for you:

I mess with a live linux cd that I use at work (ms-only there) and when
otherwise at a computer without a *nix os.  I have written a small script
that runs during boot up to mount /dev/fd0 and run config files on the floppy
so that a custom setup can be used.  I would like to be able to do this
on a headless networked box (thus the scripts should automatically attempt
to mount /dev/fd0), but I also use the cd on old laptops that don't always
have floppy drives attached (or that no longer have working floppy drives).
When using one of these laptops, the failed mounting of /dev/fd0 can take
several minutes.  I want to be able to mount /dev/fd0 on a headless server,
but to not mount /dev/fd0 on some machines.

As I see it, I have two (usable) options: (1) have the custom scripts mount
the floppy unless some boot time option is changed or (2) write some kind
of test to see if /dev/fd0 is a usable device *before* attempting to mount it.

Are either of these possible?  How would I go about implementing this?
I would like to avoid using runlevel to determine if the floppy mount should
be attempted, as I rely pretty heavily on that to determine which servers
run (if any).

Thanks in advance for any ideas.

-Jeremy

relevant lines of script follow (be warned that my script is probably sloppy
and inconsistant):

<script>
#!/bin/bash

mount /dev/fd0 > /dev/null || exit="yes"
if [ "$exit" == "yes" ] ; then
echo "could not mount /dev/fd0"
umount /dev/fd0 > /dev/null
exit
fi

if [ -e /floppy/config.lcl ] ; then
source /floppy/config.lcl
fi

if [ -e /floppy/bashrc.lcl ] ; then
cp /floppy/bashrc.lcl /home/someone/.bashrc.lcl
chown someone.someone /home/someone/.bashrc.lcl
chmod 644 /home/someone/.bashrc.lcl
fi

if [ -e /floppy/inputrc.lcl ] ; then
cat /floppy/inputrc.lcl >> /home/someone/.inputrc
chown someone.someone /home/someone/.inputrc
chmod 644 /home/someone/.inputrc
fi

if [ -e /floppy/tcshrc.lcl ] ; then
cp /floppy/tcshrc.lcl /home/someone/.tcshrc.lcl
chown someone.someone /home/someone/.tcshrc.lcl
chmod 644 /home/someone/.tcshrc.lcl
fi

umount /floppy > /dev/null
</script>

--

Jeremy John Wakeman
cael-JTkAzvGkdyMrpQx6IzTi3laTQe2KTcn/@public.gmane.org
www.polarhome.com/~cael
linux registered user #125171
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list