malloc->zalloc
[grub2/phcoder.git] / util / grub.d / 10_hurd.in
blobe72198da632dbec46257317a7829714e779590ac
1 #! /bin/sh -e
3 # update-grub helper script.
4 # Copyright (C) 2006,2007,2008 Free Software Foundation, Inc.
6 # GRUB is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # GRUB is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
19 prefix=@prefix@
20 exec_prefix=@exec_prefix@
21 libdir=@libdir@
22 . ${libdir}/grub/grub-mkconfig_lib
24 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
25 OS=GNU
26 else
27 OS="${GRUB_DISTRIBUTOR} GNU/Hurd"
30 at_least_one=false
31 all_of_them=true
33 # FIXME: add l4 here?
34 kernel=
35 for i in /boot/gnumach.gz /boot/gnumach ; do
36 if test -e $i ; then
37 basename=`basename $i`
38 dirname=`dirname $i`
39 rel_dirname=`make_system_path_relative_to_its_root $dirname`
40 echo "Found GNU Mach: $i" >&2
41 kernel=${rel_dirname}/${basename}
42 at_least_one=true
44 done
46 # FIXME: This works for ext2. For other filesystems we might need special-casing
47 case "${GRUB_FS}" in
48 *fs) hurd_fs="${GRUB_FS}" ;;
49 *) hurd_fs="${GRUB_FS}fs" ;;
50 esac
52 for i in /hurd/${hurd_fs}.static /hurd/exec ; do
53 if test -e "$i" ; then
54 echo "Found Hurd module: $i" >&2
55 at_least_one=true
56 else
57 all_of_them=false
59 done
61 if ${at_least_one} ; then : ; else
62 # no hurd here, aborting silently
63 exit 0
66 if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else
67 echo "Some Hurd stuff found, but not enough to boot." >&2
68 exit 1
71 cat << EOF
72 menuentry "${OS}" {
73 EOF
74 prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/"
75 cat << EOF
76 multiboot ${kernel} root=device:${GRUB_DEVICE}
77 module /hurd/${hurd_fs}.static --readonly \\
78 --multiboot-command-line='\${kernel-command-line}' \\
79 --host-priv-port='\${host-port}' \\
80 --device-master-port='\${device-port}' \\
81 --exec-server-task='\${exec-task}' -T typed '\${root}' \\
82 '\$(task-create)' '\$(task-resume)'
83 module /lib/ld.so.1 /hurd/exec '\$(exec-task=task-create)'
85 EOF