Grub on floppy
Phil Schaffner
P.R.Schaffner at IEEE.org
Sun May 22 12:31:09 UTC 2005
On Fri, 2005-05-20 at 09:49 -0400, Bill Case wrote:
> Hi;
>
> I have been playing with this for three or four days and still haven't
> got it right. Any help would be appreciated.
>
> I run Fedora on my own basement machine. I have installed Ubantu on my
> wife's WindowsXP upstairs - with her very grudging permission. Family
> diplomacy suggestes that I do not make her machine a dual boot. (Dual
> booting would just serve has a constant reminder that I have been
> screwing around with her machine. Any time something goes wrong it will
> be Linux's and consequently my fault.)
>
> What grub files should I but on a floppy to give me a dual boot into her
> system? I would use the floppy as sort of a key.
Have done this for my wife and kids for some years now. [Fortunately,
they have all pretty well outgrown the need for the boot floppy, and all
use both OSs. Still haven't gotten to the state where I can blow away
the Evil Empire OS due to games and one or two apps the wife won't give
up.] I use the script below (as root) and edit the grub.conf file on
the floppy to change the default stanza to boot. Your case may be a bit
harder as you don't seem to have a dual-boot grub setup to start from,
as the script expects. Would need much more detail on the system to
help create the correct grub.conf stanza[s]. Hope studying the script
will give a clue or two.
> Will I still want or
> need /root?
Don't quite understand the question, but don't think you can live
without /root which is root's home directory.
> Is there a way that I can get to the Linux on her system
> while I am on my own Fedora downstairs?
Yes - ssh will get you there - assuming it is booted under Linux, and
the machines are networked, wired or wireless. [Don't really think you
want to get into Cygwin with the sensitivity to messing up the spouse's
system, so won't go there.]
> Are any of you married? Can I really get into big trouble doing this?
Yup.
Good luck,
Phil
------------------------ Cut Here -----------------------
#!/bin/bash
# mkgrubmenu
#
# Written by Phil Schaffner <p.r.schaffner at ieee.org>
# based on mkbootdisk by Erik Troan <ewt at redhat.com>
pause=yes
format=yes
device=/dev/fd0
unset verbose
GRUBDIR=/boot/grub
MOUNTDIR=/tmp/mkgrubmenu
PATH=/sbin:$PATH
export PATH
VERSION=0.2
usage () {
cat >&2 <<EOF
usage: `basename $0` [--version] [--noprompt] [--noformat]
[--device <devicefile>] [--grubdir <dir>] [--verbose -v]
(ex: `basename $0` --device /dev/fd1)
EOF
exit $1
}
while [ $# -gt 0 ]; do
case $1 in
--device)
shift
device=$1
;;
--grubdir)
shift
GRUBDIR=$1
;;
--help)
usage 0
;;
--noprompt)
unset pause
;;
--noformat)
unset format
;;
-v)
verbose=true
;;
--verbose)
verbose=true
;;
--version)
echo "mkgrubdisk: version $VERSION"
exit 0
;;
*)
usage
;;
esac
shift
done
[ -d $GRUBDIR ] || {
echo "$GRUBDIR is not a directory!" >&2
exit 1
}
if [ -e "$device" ]; then {
[ -n "$pause" ] && {
echo -n "Insert a"
[ -n "$format" ] || echo -n " vfat formatted"
echo " disk in $device."
echo "Any information on the disk will be lost."
echo -n "Press <Enter> to continue or ^C to abort: "
read aline
}
[ -n "$format" ] && {
[ -n "$verbose" ] && echo "Formatting $device... "
fdformat $device || exit 0
mkfs.msdos $device > /dev/null 2>/dev/null || exit 0
[ -n "$verbose" ] && echo "done."
}
rm -rf $MOUNTDIR
mkdir $MOUNTDIR || {
echo "Failed to create $MOUNTDIR" >&2
exit 1
}
[ -d $MOUNTDIR ] || {
echo "$MOUNTDIR is not a directory!" >&2
exit 1
}
mount -wt vfat $device $MOUNTDIR || {
rmdir $MOUNTDIR
exit 1
}
mkdir $MOUNTDIR/grub
[ -n "$verbose" ] && echo -n "Copying $GRUBDIR files... "
cd $GRUBDIR
cp -a stage1 stage2 grub.conf device.map $MOUNTDIR/grub
[ -n "$verbose" ] && echo "done."
[ -n "$verbose" ] && echo -n "Setting up GRUB... "
grub --device-map=$MOUNTDIR/grub/device.map --batch <<EOF
root (fd0)
setup (fd0)
quit
EOF
[ -n "$verbose" ] && echo "done."
umount $MOUNTDIR
rmdir $MOUNTDIR
[ -n "$verbose" ] && echo "done setting up GRUB."
echo "edit (fd0)/grub/grub.conf to customize."
}
else
echo "$device does not exist"
fi
More information about the fedora-list
mailing list