Contents of /smage/branches/alx-0_6_0/core/grub/alx/files/40_alx_reset
Parent Directory | Revision Log
Revision 2732 -
(show annotations)
(download)
Thu Aug 11 14:46:07 2011 UTC (13 years, 1 month ago) by niro
File size: 5566 byte(s)
Thu Aug 11 14:46:07 2011 UTC (13 years, 1 month ago) by niro
File size: 5566 byte(s)
-let grub search for special boot params for zotac devices and co
1 | #! /bin/sh |
2 | set -e |
3 | |
4 | # grub-mkconfig helper script. |
5 | # Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. |
6 | # |
7 | # GRUB is free software: you can redistribute it and/or modify |
8 | # it under the terms of the GNU General Public License as published by |
9 | # the Free Software Foundation, either version 3 of the License, or |
10 | # (at your option) any later version. |
11 | # |
12 | # GRUB is distributed in the hope that it will be useful, |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | # GNU General Public License for more details. |
16 | # |
17 | # You should have received a copy of the GNU General Public License |
18 | # along with GRUB. If not, see <http://www.gnu.org/licenses/>. |
19 | |
20 | prefix=/usr |
21 | exec_prefix=${prefix} |
22 | bindir=/bin |
23 | libdir=/lib |
24 | . ${libdir}/grub/grub-mkconfig_lib |
25 | |
26 | export TEXTDOMAIN=grub |
27 | export TEXTDOMAINDIR=${prefix}/share/locale |
28 | |
29 | CLASS="--class gnu-linux --class gnu --class os --users alx" |
30 | |
31 | if [ "x${GRUB_CMDLINE_ALX_RESET}" = "x" ]; then |
32 | GRUB_CMDLINE_ALX_RESET="splash=verbose,theme=default alx-reset-settings" |
33 | fi |
34 | |
35 | if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then |
36 | OS="ALX - Reset *all* local settings" |
37 | else |
38 | OS="${GRUB_DISTRIBUTOR} - Reset *all* local settings" |
39 | CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) ${CLASS}" |
40 | fi |
41 | |
42 | if [ "x${GRUB_DEVICE_UUID}" = "x" ] || [ "x${GRUB_DISABLE_LINUX_UUID}" = "xtrue" ] \ |
43 | || ! test -e "/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"; then |
44 | LINUX_ROOT_DEVICE=${GRUB_DEVICE} |
45 | else |
46 | LINUX_ROOT_DEVICE=UUID=${GRUB_DEVICE_UUID} |
47 | fi |
48 | |
49 | if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then |
50 | rootsubvol="`make_system_path_relative_to_its_root /`" |
51 | rootsubvol="${rootsubvol#/}" |
52 | if [ "x${rootsubvol}" != x ]; then |
53 | GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}" |
54 | fi |
55 | fi |
56 | |
57 | # check for special hardware |
58 | if [ -x "`which hwinfo`" ] |
59 | then |
60 | # zotac |
61 | if [ "x`hwinfo --bios --storage --pci | grep -i zotac 2> /dev/null || true`" != x ] |
62 | then |
63 | GRUB_CMDLINE_LINUX="rootdelay=8 ${GRUB_CMDLINE_LINUX}" |
64 | fi |
65 | fi |
66 | |
67 | linux_entry () |
68 | { |
69 | os="$1" |
70 | version="$2" |
71 | recovery="$3" |
72 | args="$4" |
73 | if ${recovery} ; then |
74 | title="$(gettext_quoted "%s [ %s ] (recovery mode)")" |
75 | else |
76 | title="$(gettext_quoted "%s [ %s ]")" |
77 | fi |
78 | printf "menuentry '${title}' ${CLASS} {\n" "${os}" "${version}" |
79 | if ! ${recovery} ; then |
80 | save_default_entry | sed -e "s/^/\t/" |
81 | fi |
82 | |
83 | # Use ELILO's generic "efifb" when it's known to be available. |
84 | # FIXME: We need an interface to select vesafb in case efifb can't be used. |
85 | if [ "x$GRUB_GFXPAYLOAD_LINUX" = x ]; then |
86 | cat << EOF |
87 | load_video |
88 | EOF |
89 | else |
90 | if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then |
91 | cat << EOF |
92 | load_video |
93 | EOF |
94 | fi |
95 | cat << EOF |
96 | set gfxpayload=$GRUB_GFXPAYLOAD_LINUX |
97 | EOF |
98 | fi |
99 | |
100 | cat << EOF |
101 | insmod gzio |
102 | EOF |
103 | |
104 | if [ x$dirname = x/ ]; then |
105 | if [ -z "${prepare_root_cache}" ]; then |
106 | prepare_root_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/\t/")" |
107 | fi |
108 | printf '%s\n' "${prepare_root_cache}" |
109 | else |
110 | if [ -z "${prepare_boot_cache}" ]; then |
111 | prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")" |
112 | fi |
113 | printf '%s\n' "${prepare_boot_cache}" |
114 | fi |
115 | message="$(gettext_printf "Loading Linux %s ..." ${version})" |
116 | cat << EOF |
117 | echo '$message' |
118 | linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args} |
119 | EOF |
120 | if test -n "${initrd}" ; then |
121 | message="$(gettext_printf "Loading initial ramdisk ...")" |
122 | cat << EOF |
123 | echo '$message' |
124 | initrd ${rel_dirname}/${initrd} |
125 | EOF |
126 | fi |
127 | cat << EOF |
128 | } |
129 | EOF |
130 | } |
131 | |
132 | case x`uname -m` in |
133 | xi?86 | xx86_64) |
134 | list=`for i in /boot/vmlinuz-* /vmlinuz-* /boot/kernel-* ; do |
135 | if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi |
136 | done` ;; |
137 | *) |
138 | list=`for i in /boot/vmlinuz-* /boot/vmlinux-* /vmlinuz-* /vmlinux-* /boot/kernel-* ; do |
139 | if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi |
140 | done` ;; |
141 | esac |
142 | |
143 | prepare_boot_cache= |
144 | prepare_root_cache= |
145 | |
146 | while [ "x$list" != "x" ] ; do |
147 | linux=`version_find_latest $list` |
148 | echo "Found linux image: $linux" >&2 |
149 | basename=`basename $linux` |
150 | dirname=`dirname $linux` |
151 | rel_dirname=`make_system_path_relative_to_its_root $dirname` |
152 | version=`echo $basename | sed -e "s,^[^0-9]*-,,g"` |
153 | alt_version=`echo $version | sed -e "s,\.old$,,g"` |
154 | linux_root_device_thisversion="${LINUX_ROOT_DEVICE}" |
155 | |
156 | initrd= |
157 | for i in "initrd-${version}.img" \ |
158 | "initramfs-${version}.img" \ |
159 | "initrd-${alt_version}.img" \ |
160 | "initramfs-${alt_version}.img"; do |
161 | if test -e "${dirname}/${i}" ; then |
162 | initrd="$i" |
163 | break |
164 | fi |
165 | done |
166 | |
167 | config= |
168 | for i in "${dirname}/config-${version}" "${dirname}/config-${alt_version}" "/etc/kernels/kernel-config-${version}" ; do |
169 | if test -e "${i}" ; then |
170 | config="${i}" |
171 | break |
172 | fi |
173 | done |
174 | |
175 | initramfs= |
176 | if test -n "${config}" ; then |
177 | initramfs=`grep CONFIG_INITRAMFS_SOURCE= "${config}" | cut -f2 -d= | tr -d \"` |
178 | fi |
179 | |
180 | if test -n "${initrd}" ; then |
181 | echo "Found initrd image: ${dirname}/${initrd}" >&2 |
182 | elif test -z "${initramfs}" ; then |
183 | # "UUID=" magic is parsed by initrd or initramfs. Since there's |
184 | # no initrd or builtin initramfs, it can't work here. |
185 | linux_root_device_thisversion=${GRUB_DEVICE} |
186 | fi |
187 | |
188 | linux_entry "${OS}" "${version}" false \ |
189 | "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_ALX_RESET}" |
190 | |
191 | list=`echo $list | tr ' ' '\n' | grepvx $linux | tr '\n' ' '` |
192 | done |