~ubuntu-branches/ubuntu/wily/grub2/wily

« back to all changes in this revision

Viewing changes to util/grub.d/10_netbsd.in

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2011-01-11 17:11:44 UTC
  • mto: (17.3.26 experimental)
  • mto: This revision was merged to the branch mainline in revision 60.
  • Revision ID: james.westby@ubuntu.com-20110111171144-o2h6luxzei5fivmf
Tags: upstream-1.99~20110111
ImportĀ upstreamĀ versionĀ 1.99~20110111

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
export TEXTDOMAINDIR=@localedir@
28
28
 
29
29
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
30
 
  OS=NetBSD
 
30
  OS="NetBSD"
31
31
else
32
32
  OS="${GRUB_DISTRIBUTOR} NetBSD"
33
33
fi
34
34
 
 
35
netbsd_load_fs_module ()
 
36
{
 
37
  loader="$1"   # "knetbsd" or "multiboot"
 
38
  kernel="$2"   # absolute path to the kernel file
 
39
 
 
40
  case $(zcat -f "${kernel}" | file -bL - | cut -d , -f 2 | tr -d ' ') in
 
41
    Intel80386)
 
42
      karch="i386"
 
43
      ;;
 
44
    x86-64)
 
45
      karch="amd64"
 
46
      ;;
 
47
    *)
 
48
      return
 
49
      ;;
 
50
  esac
 
51
 
 
52
  case $(${grub_probe} --target=fs -d ${GRUB_DEVICE}) in
 
53
    ext2)
 
54
      kmod="ext2fs"
 
55
      ;;
 
56
    fat)
 
57
      kmod="msdosfs"
 
58
      ;;
 
59
    ntfs)
 
60
      kmod="ntfs"
 
61
      ;;
 
62
    ufs*)
 
63
      kmod="ffs"
 
64
      ;;
 
65
    *)
 
66
      return
 
67
      ;;
 
68
  esac
 
69
 
 
70
  kversion=$(zcat -f "${kernel}" | strings | sed -n -e '/^@(#)NetBSD/ { s/^@(#)NetBSD \([0-9\.]*\) .*$/\1/g ; p ; q ; }')
 
71
  kmodule="/stand/${karch}/${kversion}/modules/${kmod}/${kmod}.kmod"
 
72
 
 
73
  if test -z "$karch" -o -z "$kversion" -o ! -f "${kmodule}"; then
 
74
    return
 
75
  fi
 
76
 
 
77
  kmodule_rel=$(make_system_path_relative_to_its_root "$kmodule") || return
 
78
  prepare_grub_to_access_device $(${grub_probe} -t device "${kmodule}") | sed -e 's,^,  ,'
 
79
  case "${loader}" in
 
80
    knetbsd)
 
81
      printf "\tknetbsd_module_elf %s\n" "${kmodule_rel}"
 
82
      ;;
 
83
    multiboot)
 
84
      printf "\tmodule %s\n" "${kmodule_rel}"
 
85
      ;;
 
86
  esac
 
87
}
 
88
 
35
89
netbsd_entry ()
36
90
{
37
91
  loader="$1"   # "knetbsd" or "multiboot"
59
113
        "${kernel}" "${kernel}" "${kroot_device}" "${GRUB_CMDLINE_NETBSD} ${args}"
60
114
      ;;
61
115
  esac
 
116
 
 
117
  netbsd_load_fs_module "${loader}" "${kernel}"
 
118
 
62
119
  printf "}\n"
63
120
}
64
121
 
72
129
  if ! grub_file_is_not_garbage "$k" ; then
73
130
    continue
74
131
  fi
75
 
  if ! ((file -bL "$k" | grep -q "${pattern}") ||
76
 
        (zcat "$k" | file -bL - | grep -q "${pattern}")) 2>/dev/null ; then
 
132
  if ! (zcat -f "$k" | file -bL - | grep -q "${pattern}") 2>/dev/null ; then
77
133
    continue
78
134
  fi
79
135