2008-11-04 15:20:35 +00:00
|
|
|
#! /bin/sh -e
|
|
|
|
|
|
|
|
# grub-mkconfig helper script.
|
2009-04-13 19:48:44 +00:00
|
|
|
# Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
2008-11-04 15:20:35 +00:00
|
|
|
#
|
|
|
|
# GRUB is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# GRUB is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
prefix=@prefix@
|
|
|
|
exec_prefix=@exec_prefix@
|
|
|
|
libdir=@libdir@
|
|
|
|
. ${libdir}/grub/grub-mkconfig_lib
|
|
|
|
|
2009-04-13 19:48:44 +00:00
|
|
|
case "${GRUB_DISTRIBUTOR}" in
|
|
|
|
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
|
|
|
|
*) OS="FreeBSD" ;;
|
|
|
|
esac
|
|
|
|
|
2009-07-05 22:51:05 +00:00
|
|
|
if test -e /boot/device.hints ; then
|
|
|
|
devices=/boot/device.hints
|
2008-11-04 15:20:35 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if test -e /boot/kernel/kernel ; then
|
|
|
|
kfreebsd=/boot/kernel/kernel
|
|
|
|
fi
|
2009-04-13 14:14:40 +00:00
|
|
|
if test -e /boot/kernel/kernel.gz ; then
|
|
|
|
kfreebsd=/boot/kernel/kernel.gz
|
|
|
|
fi
|
2008-11-04 15:20:35 +00:00
|
|
|
|
|
|
|
if [ "x$kfreebsd" != "x" ] ; then
|
|
|
|
echo "Found kernel of FreeBSD: $kfreebsd" >&2
|
|
|
|
|
|
|
|
kfreebsd_basename=`basename $kfreebsd`
|
|
|
|
kfreebsd_dirname=`dirname $kfreebsd`
|
|
|
|
kfreebsd_rel_dirname=`make_system_path_relative_to_its_root $kfreebsd_dirname`
|
|
|
|
|
2009-04-13 14:14:40 +00:00
|
|
|
if [ x"$devices" != "x" ] ; then
|
|
|
|
devices_basename=`basename $devices`
|
|
|
|
devices_dirname=`dirname $devices`
|
|
|
|
devices_rel_dirname=`make_system_path_relative_to_its_root $devices_dirname`
|
|
|
|
fi
|
2008-11-04 15:20:35 +00:00
|
|
|
|
|
|
|
# For "ufs" it's the same. Do we care about the others?
|
|
|
|
kfreebsd_fs=${GRUB_FS}
|
|
|
|
|
|
|
|
cat << EOF
|
2009-04-13 19:48:44 +00:00
|
|
|
menuentry "${OS}" {
|
2008-11-04 15:20:35 +00:00
|
|
|
EOF
|
|
|
|
prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
|
|
|
|
cat << EOF
|
|
|
|
freebsd ${kfreebsd_rel_dirname}/${kfreebsd_basename}
|
2009-04-13 14:14:40 +00:00
|
|
|
EOF
|
|
|
|
|
|
|
|
if [ x"$devices" != "x" ] ; then
|
|
|
|
cat << EOF
|
2008-11-04 15:20:35 +00:00
|
|
|
freebsd_loadenv ${devices_rel_dirname}/${devices_basename}
|
2009-04-13 14:14:40 +00:00
|
|
|
EOF
|
2009-04-13 15:37:38 +00:00
|
|
|
fi
|
2009-04-13 14:14:40 +00:00
|
|
|
cat << EOF
|
2009-08-07 11:55:36 +00:00
|
|
|
set FreeBSD.vfs.root.mountfrom=${kfreebsd_fs}:${GRUB_DEVICE}
|
|
|
|
set FreeBSD.vfs.root.mountfrom.options=rw
|
2008-11-04 15:20:35 +00:00
|
|
|
}
|
|
|
|
EOF
|
|
|
|
fi
|