Annotation of /trunk/grubby/grubby-bls
Parent Directory | Revision Log
Revision 3144 -
(hide annotations)
(download)
Tue Jul 7 11:20:52 2020 UTC (3 years, 10 months ago) by niro
File size: 16972 byte(s)
Tue Jul 7 11:20:52 2020 UTC (3 years, 10 months ago) by niro
File size: 16972 byte(s)
Make grubby-bls execute grub2-mkconfig on ppc64
1 | niro | 3141 | #!/bin/bash |
2 | # | ||
3 | # grubby wrapper to manage BootLoaderSpec files | ||
4 | # | ||
5 | # | ||
6 | # Copyright 2018 Red Hat, Inc. All rights reserved. | ||
7 | # | ||
8 | # This program is free software; you can redistribute it and/or modify | ||
9 | # it under the terms of the GNU General Public License as published by | ||
10 | # the Free Software Foundation; either version 2 of the License, or | ||
11 | # (at your option) any later version. | ||
12 | # | ||
13 | # This program is distributed in the hope that it will be useful, | ||
14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | # GNU General Public License for more details. | ||
17 | # | ||
18 | # You should have received a copy of the GNU General Public License | ||
19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
20 | |||
21 | readonly SCRIPTNAME="${0##*/}" | ||
22 | |||
23 | CMDLINE_LINUX_DEBUG=" systemd.log_level=debug systemd.log_target=kmsg" | ||
24 | LINUX_DEBUG_VERSION_POSTFIX="_with_debugging" | ||
25 | LINUX_DEBUG_TITLE_POSTFIX=" with debugging" | ||
26 | |||
27 | declare -a bls_file | ||
28 | declare -a bls_title | ||
29 | declare -a bls_version | ||
30 | declare -a bls_linux | ||
31 | declare -a bls_initrd | ||
32 | declare -a bls_options | ||
33 | declare -a bls_id | ||
34 | |||
35 | [[ -f /etc/sysconfig/kernel ]] && . /etc/sysconfig/kernel | ||
36 | [[ -f /etc/os-release ]] && . /etc/os-release | ||
37 | read MACHINE_ID < /etc/machine-id | ||
38 | arch=$(uname -m) | ||
39 | |||
40 | if [[ $arch = 's390' || $arch = 's390x' ]]; then | ||
41 | bootloader="zipl" | ||
42 | else | ||
43 | bootloader="grub2" | ||
44 | fi | ||
45 | |||
46 | print_error() { | ||
47 | echo "$1" >&2 | ||
48 | exit 1 | ||
49 | } | ||
50 | |||
51 | if [[ ${#} = 0 ]]; then | ||
52 | print_error "no action specified" | ||
53 | fi | ||
54 | |||
55 | get_bls_value() { | ||
56 | local bls="$1" && shift | ||
57 | local key="$1" && shift | ||
58 | |||
59 | echo "$(grep "^${key}[ \t]" "${bls}" | sed -e "s,^${key}[ \t]*,,")" | ||
60 | } | ||
61 | |||
62 | set_bls_value() { | ||
63 | local bls="$1" && shift | ||
64 | local key="$1" && shift | ||
65 | local value="$1" && shift | ||
66 | |||
67 | sed -i -e "s,^${key}.*,${key} ${value}," "${bls}" | ||
68 | } | ||
69 | |||
70 | append_bls_value() { | ||
71 | local bls="$1" && shift | ||
72 | local key="$1" && shift | ||
73 | local value="$1" && shift | ||
74 | |||
75 | old_value="$(get_bls_value ${bls} ${key})" | ||
76 | set_bls_value "${bls}" "${key}" "${old_value}${value}" | ||
77 | } | ||
78 | |||
79 | get_bls_values() { | ||
80 | count=0 | ||
81 | for bls in $(ls -vr ${blsdir}/*.conf 2> /dev/null); do | ||
82 | bls_file[$count]="${bls}" | ||
83 | bls_title[$count]="$(get_bls_value ${bls} title)" | ||
84 | bls_version[$count]="$(get_bls_value ${bls} version)" | ||
85 | bls_linux[$count]="$(get_bls_value ${bls} linux)" | ||
86 | bls_initrd[$count]="$(get_bls_value ${bls} initrd)" | ||
87 | bls_options[$count]="$(get_bls_value ${bls} options)" | ||
88 | bls_id[$count]="$(get_bls_value ${bls} id)" | ||
89 | |||
90 | count=$((count+1)) | ||
91 | done | ||
92 | } | ||
93 | |||
94 | get_default_index() { | ||
95 | local default="" | ||
96 | local index="-1" | ||
97 | local title="" | ||
98 | local version="" | ||
99 | if [[ $bootloader = "grub2" ]]; then | ||
100 | default="$(grep '^saved_entry=' ${env} | sed -e 's/^saved_entry=//')" | ||
101 | else | ||
102 | default="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')" | ||
103 | fi | ||
104 | |||
105 | if [[ -z $default ]]; then | ||
106 | index=0 | ||
107 | elif [[ $default =~ ^[0-9]+$ ]]; then | ||
108 | index="$default" | ||
109 | fi | ||
110 | |||
111 | # GRUB2 and zipl use different fields to set the default entry | ||
112 | if [[ $bootloader = "grub2" ]]; then | ||
113 | title="$default" | ||
114 | else | ||
115 | version="$default" | ||
116 | fi | ||
117 | |||
118 | for i in ${!bls_file[@]}; do | ||
119 | if [[ $title = ${bls_title[$i]} || $version = ${bls_version[$i]} || | ||
120 | $i -eq $index ]]; then | ||
121 | echo $i | ||
122 | return | ||
123 | fi | ||
124 | done | ||
125 | } | ||
126 | |||
127 | display_default_value() { | ||
128 | case "$display_default" in | ||
129 | kernel) | ||
130 | echo "${bls_linux[$default_index]}" | ||
131 | exit 0 | ||
132 | ;; | ||
133 | index) | ||
134 | echo "$default_index" | ||
135 | exit 0 | ||
136 | ;; | ||
137 | title) | ||
138 | echo "${bls_title[$default_index]}" | ||
139 | exit 0 | ||
140 | ;; | ||
141 | esac | ||
142 | } | ||
143 | |||
144 | param_to_indexes() { | ||
145 | local param="$1" | ||
146 | local indexes="" | ||
147 | |||
148 | if [[ $param = "ALL" ]]; then | ||
149 | for i in ${!bls_file[@]}; do | ||
150 | indexes="$indexes $i" | ||
151 | done | ||
152 | echo -n $indexes | ||
153 | return | ||
154 | fi | ||
155 | |||
156 | if [[ $param = "DEFAULT" ]]; then | ||
157 | echo -n $default_index | ||
158 | return | ||
159 | fi | ||
160 | |||
161 | for i in ${!bls_file[@]}; do | ||
162 | if [[ $param = "${bls_linux[$i]}" ]]; then | ||
163 | indexes="$indexes $i" | ||
164 | fi | ||
165 | |||
166 | if [[ $param = "TITLE=${bls_title[$i]}" ]]; then | ||
167 | indexes="$indexes $i" | ||
168 | fi | ||
169 | |||
170 | if [[ $param = $i ]]; then | ||
171 | indexes="$indexes $i" | ||
172 | fi | ||
173 | done | ||
174 | |||
175 | if [[ -n $indexes ]]; then | ||
176 | echo -n $indexes | ||
177 | return | ||
178 | fi | ||
179 | |||
180 | echo -n "-1" | ||
181 | } | ||
182 | |||
183 | display_info_values() { | ||
184 | local indexes=($(param_to_indexes "$1")) | ||
185 | |||
186 | for i in ${indexes[*]}; do | ||
187 | echo "index=$i" | ||
188 | echo "kernel=${bls_linux[$i]}" | ||
189 | echo "args=\"${bls_options[$i]}\"" | ||
190 | echo "initrd=${bls_initrd[$i]}" | ||
191 | echo "title=${bls_title[$i]}" | ||
192 | done | ||
193 | exit 0 | ||
194 | } | ||
195 | |||
196 | mkbls() { | ||
197 | local kernel=$1 && shift | ||
198 | local kernelver=$1 && shift | ||
199 | local datetime=$1 && shift | ||
200 | |||
201 | local debugname="" | ||
202 | local flavor="" | ||
203 | |||
204 | if [[ $kernelver == *\+* ]] ; then | ||
205 | local flavor=-"${kernelver##*+}" | ||
206 | if [[ $flavor == "-debug" ]]; then | ||
207 | local debugname="with debugging" | ||
208 | local debugid="-debug" | ||
209 | fi | ||
210 | fi | ||
211 | |||
212 | cat <<EOF | ||
213 | title ${NAME} (${kernelver}) ${VERSION}${debugname} | ||
214 | version ${kernelver}${debugid} | ||
215 | linux ${kernel} | ||
216 | initrd /initramfs-${kernelver}.img | ||
217 | options \$kernelopts | ||
218 | id ${ID}-${datetime}-${kernelver}${debugid} | ||
219 | grub_users \$grub_users | ||
220 | grub_arg --unrestricted | ||
221 | grub_class kernel${flavor} | ||
222 | EOF | ||
223 | } | ||
224 | |||
225 | remove_bls_fragment() { | ||
226 | local indexes=($(param_to_indexes "$1")) | ||
227 | |||
228 | if [[ $indexes = "-1" ]]; then | ||
229 | print_error "The param $1 is incorrect" | ||
230 | fi | ||
231 | |||
232 | for i in ${indexes[*]}; do | ||
233 | rm -f "${bls_file[$i]}" | ||
234 | done | ||
235 | |||
236 | get_bls_values | ||
237 | niro | 3144 | |
238 | update_grubcfg | ||
239 | niro | 3141 | } |
240 | |||
241 | add_bls_fragment() { | ||
242 | local kernel="$1" && shift | ||
243 | local title="$1" && shift | ||
244 | local options="$1" && shift | ||
245 | local initrd="$1" && shift | ||
246 | local extra_initrd="$1" && shift | ||
247 | |||
248 | if [[ $kernel = *"vmlinuz-"* ]]; then | ||
249 | kernelver="${kernel##*/vmlinuz-}" | ||
250 | else | ||
251 | kernelver="${kernel##*/}" | ||
252 | fi | ||
253 | |||
254 | if [[ ! -d "/lib/modules/${kernelver}" || ! -f "/boot/vmlinuz-${kernelver}" ]] && | ||
255 | [[ $bad_image != "true" ]]; then | ||
256 | print_error "The ${kernelver} kernel isn't installed in the machine" | ||
257 | fi | ||
258 | |||
259 | if [[ -z $title ]]; then | ||
260 | print_error "The kernel title must be specified" | ||
261 | fi | ||
262 | |||
263 | if [[ ! -d $blsdir ]]; then | ||
264 | install -m 700 -d "${blsdir}" | ||
265 | fi | ||
266 | |||
267 | bls_target="${blsdir}/${MACHINE_ID}-${kernelver}.conf" | ||
268 | kernel_dir="/lib/modules/${kernelver}" | ||
269 | if [[ -f "${kernel_dir}/bls.conf" ]]; then | ||
270 | cp -aT "${kernel_dir}/bls.conf" "${bls_target}" || exit $? | ||
271 | else | ||
272 | if [[ -d $kernel_dir ]]; then | ||
273 | datetime="$(date -u +%Y%m%d%H%M%S -d "$(stat -c '%y' "${kernel_dir}")")" | ||
274 | else | ||
275 | datetime=0 | ||
276 | fi | ||
277 | mkbls "${kernel}" "${kernelver}" "${datetime}" > "${bls_target}" | ||
278 | fi | ||
279 | |||
280 | if [[ -n $title ]]; then | ||
281 | set_bls_value "${bls_target}" "title" "${title}" | ||
282 | fi | ||
283 | |||
284 | if [[ -n $options ]]; then | ||
285 | set_bls_value "${bls_target}" "options" "${options}" | ||
286 | fi | ||
287 | |||
288 | if [[ -n $initrd ]]; then | ||
289 | set_bls_value "${bls_target}" "initrd" "${initrd}" | ||
290 | fi | ||
291 | |||
292 | if [[ -n $extra_initrd ]]; then | ||
293 | append_bls_value "${bls_target}" "initrd" "${extra_initrd}" | ||
294 | fi | ||
295 | |||
296 | if [[ $MAKEDEBUG = "yes" ]]; then | ||
297 | arch="$(uname -m)" | ||
298 | bls_debug="$(echo ${bls_target} | sed -e "s/\.${arch}/-debug.${arch}/")" | ||
299 | cp -aT "${bls_target}" "${bls_debug}" | ||
300 | append_bls_value "${bls_debug}" "title" "${LINUX_DEBUG_TITLE_POSTFIX}" | ||
301 | append_bls_value "${bls_debug}" "version" "${LINUX_DEBUG_VERSION_POSTFIX}" | ||
302 | append_bls_value "${bls_debug}" "options" "${CMDLINE_LINUX_DEBUG}" | ||
303 | blsid="$(get_bls_value ${bls_debug} "id" | sed -e "s/\.${arch}/-debug.${arch}/")" | ||
304 | set_bls_value "${bls_debug}" "id" "${blsid}" | ||
305 | fi | ||
306 | |||
307 | get_bls_values | ||
308 | |||
309 | if [[ $make_default = "true" ]]; then | ||
310 | set_default_bls "TITLE=${title}" | ||
311 | fi | ||
312 | |||
313 | niro | 3144 | update_grubcfg |
314 | |||
315 | niro | 3141 | exit 0 |
316 | } | ||
317 | |||
318 | update_args() { | ||
319 | local args=$1 && shift | ||
320 | local remove_args=($1) && shift | ||
321 | local add_args=($1) && shift | ||
322 | |||
323 | for arg in ${remove_args[*]}; do | ||
324 | args="$(echo $args | sed -e "s,$arg[^ ]*,,")" | ||
325 | done | ||
326 | |||
327 | for arg in ${add_args[*]}; do | ||
328 | if [[ $arg = *"="* ]]; then | ||
329 | value=${arg##*=} | ||
330 | key=${arg%%=$value} | ||
331 | exist=$(echo $args | grep "${key}=") | ||
332 | if [[ -n $exist ]]; then | ||
333 | args="$(echo $args | sed -e "s,$key=[^ ]*,$key=$value,")" | ||
334 | else | ||
335 | args="$args $key=$value" | ||
336 | fi | ||
337 | else | ||
338 | exist=$(echo $args | grep $arg) | ||
339 | if ! [[ -n $exist ]]; then | ||
340 | args="$args $arg" | ||
341 | fi | ||
342 | fi | ||
343 | done | ||
344 | |||
345 | echo ${args} | ||
346 | } | ||
347 | |||
348 | update_bls_fragment() { | ||
349 | local indexes=($(param_to_indexes "$1")) && shift | ||
350 | local remove_args=$1 && shift | ||
351 | local add_args=$1 && shift | ||
352 | local initrd=$1 && shift | ||
353 | |||
354 | for i in ${indexes[*]}; do | ||
355 | if [[ -n $remove_args || -n $add_args ]]; then | ||
356 | local new_args="$(update_args "${bls_options[$i]}" "${remove_args}" "${add_args}")" | ||
357 | set_bls_value "${bls_file[$i]}" "options" "${new_args}" | ||
358 | fi | ||
359 | |||
360 | if [[ -n $initrd ]]; then | ||
361 | set_bls_value "${bls_file[$i]}" "initrd" "${initrd}" | ||
362 | fi | ||
363 | done | ||
364 | niro | 3144 | |
365 | update_grubcfg | ||
366 | niro | 3141 | } |
367 | |||
368 | set_default_bls() { | ||
369 | local index=($(param_to_indexes "$1")) | ||
370 | |||
371 | if [[ $bootloader = grub2 ]]; then | ||
372 | grub2-editenv "${env}" set saved_entry="${bls_title[$index]}" | ||
373 | else | ||
374 | local default="${bls_version[$index]}" | ||
375 | local current="$(grep '^default=' ${zipl_config} | sed -e 's/^default=//')" | ||
376 | if [[ -n $current ]]; then | ||
377 | sed -i -e "s,^default=.*,default=${default}," "${zipl_config}" | ||
378 | else | ||
379 | echo "default=${default}" >> "${zipl_config}" | ||
380 | fi | ||
381 | fi | ||
382 | } | ||
383 | |||
384 | remove_var_prefix() { | ||
385 | if [[ -n $remove_kernel && $remove_kernel =~ ^/ ]]; then | ||
386 | remove_kernel="/${remove_kernel##*/}" | ||
387 | fi | ||
388 | |||
389 | if [[ -n $initrd ]]; then | ||
390 | initrd="/${initrd##*/}" | ||
391 | fi | ||
392 | |||
393 | if [[ -n $extra_initrd ]]; then | ||
394 | extra_initrd=" /${extra_initrd##*/}" | ||
395 | fi | ||
396 | |||
397 | if [[ -n $kernel ]]; then | ||
398 | kernel="/${kernel##*/}" | ||
399 | fi | ||
400 | |||
401 | if [[ -n $update_kernel && $update_kernel =~ ^/ ]]; then | ||
402 | update_kernel="/${update_kernel##*/}" | ||
403 | fi | ||
404 | } | ||
405 | |||
406 | niro | 3144 | update_grubcfg() |
407 | { | ||
408 | if [[ $arch = 'ppc64' || $arch = 'ppc64le' ]]; then | ||
409 | grub2-mkconfig -o /boot/grub2/grub.cfg >& /dev/null | ||
410 | fi | ||
411 | } | ||
412 | |||
413 | niro | 3141 | print_usage() |
414 | { | ||
415 | cat <<EOF | ||
416 | Usage: grubby [OPTION...] | ||
417 | --add-kernel=kernel-path add an entry for the specified kernel | ||
418 | --args=args default arguments for the new kernel or new arguments for kernel being updated) | ||
419 | --bad-image-okay don't sanity check images in boot entries (for testing only) | ||
420 | -c, --config-file=path path to grub config file to update ("-" for stdin) | ||
421 | --copy-default use the default boot entry as a template for the new entry being added; if the default is not a linux image, or if the kernel referenced by the default image does not exist, the | ||
422 | first linux entry whose kernel does exist is used as the template | ||
423 | --default-kernel display the path of the default kernel | ||
424 | --default-index display the index of the default kernel | ||
425 | --default-title display the title of the default kernel | ||
426 | --env=path path for environment data | ||
427 | --grub2 configure grub2 bootloader | ||
428 | --info=kernel-path display boot information for specified kernel | ||
429 | --initrd=initrd-path initrd image for the new kernel | ||
430 | -i, --extra-initrd=initrd-path auxiliary initrd image for things other than the new kernel | ||
431 | --make-default make the newly added entry the default boot entry | ||
432 | -o, --output-file=path path to output updated config file ("-" for stdout) | ||
433 | --remove-args=STRING remove kernel arguments | ||
434 | --remove-kernel=kernel-path remove all entries for the specified kernel | ||
435 | --set-default=kernel-path make the first entry referencing the specified kernel the default | ||
436 | --set-default-index=entry-index make the given entry index the default entry | ||
437 | --title=entry-title title to use for the new kernel entry | ||
438 | --update-kernel=kernel-path updated information for the specified kernel | ||
439 | --zipl configure zipl bootloader | ||
440 | -b, --bls-directory path to directory containing the BootLoaderSpec fragment files | ||
441 | |||
442 | Help options: | ||
443 | -?, --help Show this help message | ||
444 | |||
445 | EOF | ||
446 | } | ||
447 | |||
448 | OPTS="$(getopt -o c:i:o:b:? --long help,add-kernel:,args:,bad-image-okay,\ | ||
449 | config-file:,copy-default,default-kernel,default-index,default-title,env:,\ | ||
450 | grub2,info:,initrd:,extra-initrd:,make-default,output-file:,remove-args:,\ | ||
451 | remove-kernel:,set-default:,set-default-index:,title:,update-kernel:,zipl,\ | ||
452 | bls-directory:,add-kernel:,add-multiboot:,mbargs:,mounts:,boot-filesystem:,\ | ||
453 | bootloader-probe,debug,devtree,devtreedir:,elilo,efi,extlinux,grub,lilo,\ | ||
454 | output-file:,remove-mbargs:,remove-multiboot:,silo,yaboot -n ${SCRIPTNAME} -- "$@")" | ||
455 | |||
456 | [[ $? = 0 ]] || exit 1 | ||
457 | |||
458 | eval set -- "$OPTS" | ||
459 | |||
460 | while [ ${#} -gt 0 ]; do | ||
461 | case "$1" in | ||
462 | --help|-h) | ||
463 | print_usage | ||
464 | exit 0 | ||
465 | ;; | ||
466 | --add-kernel) | ||
467 | kernel="${2}" | ||
468 | shift | ||
469 | ;; | ||
470 | --args) | ||
471 | args="${2}" | ||
472 | shift | ||
473 | ;; | ||
474 | --bad-image-okay) | ||
475 | bad_image=true | ||
476 | ;; | ||
477 | --config-file|-c) | ||
478 | zipl_config="${2}" | ||
479 | shift | ||
480 | ;; | ||
481 | --copy-default) | ||
482 | copy_default=true | ||
483 | ;; | ||
484 | --default-kernel) | ||
485 | display_default="kernel" | ||
486 | ;; | ||
487 | --default-index) | ||
488 | display_default="index" | ||
489 | ;; | ||
490 | --default-title) | ||
491 | display_default="title" | ||
492 | ;; | ||
493 | --env) | ||
494 | env="${2}" | ||
495 | shift | ||
496 | ;; | ||
497 | --grub2) | ||
498 | bootloader="grub2" | ||
499 | ;; | ||
500 | --info) | ||
501 | display_info="${2}" | ||
502 | shift | ||
503 | ;; | ||
504 | --initrd) | ||
505 | initrd="${2}" | ||
506 | shift | ||
507 | ;; | ||
508 | --extra-initrd|-i) | ||
509 | extra_initrd=" /${2}" | ||
510 | shift | ||
511 | ;; | ||
512 | --make-default) | ||
513 | make_default=true | ||
514 | ;; | ||
515 | --output-file|-o) | ||
516 | output_file="${2}" | ||
517 | shift | ||
518 | ;; | ||
519 | --remove-args) | ||
520 | remove_args="${2}" | ||
521 | shift | ||
522 | ;; | ||
523 | --remove-kernel) | ||
524 | remove_kernel="${2}" | ||
525 | shift | ||
526 | ;; | ||
527 | --set-default) | ||
528 | set_default="${2}" | ||
529 | shift | ||
530 | ;; | ||
531 | --set-default-index) | ||
532 | set_default="${2}" | ||
533 | shift | ||
534 | ;; | ||
535 | --title) | ||
536 | title="${2}" | ||
537 | shift | ||
538 | ;; | ||
539 | --update-kernel) | ||
540 | update_kernel="${2}" | ||
541 | shift | ||
542 | ;; | ||
543 | --zipl) | ||
544 | bootloader="zipl" | ||
545 | ;; | ||
546 | --bls-directory|-b) | ||
547 | blsdir="${2}" | ||
548 | shift | ||
549 | ;; | ||
550 | --add-kernel|--add-multiboot|--mbargs|--mounts|--boot-filesystem|\ | ||
551 | --bootloader-probe|--debug|--devtree|--devtreedir|--elilo|--efi|\ | ||
552 | --extlinux|--grub|--lilo|--output-file|--remove-mbargs|--silo|\ | ||
553 | --remove-multiboot|--slilo|--yaboot) | ||
554 | echo | ||
555 | echo "${SCRIPTNAME}: the option \"${1}\" was deprecated" >&2 | ||
556 | echo "Try '${SCRIPTNAME} --help' to list supported options" >&2 | ||
557 | echo | ||
558 | exit 1 | ||
559 | ;; | ||
560 | --) | ||
561 | shift | ||
562 | break | ||
563 | ;; | ||
564 | *) | ||
565 | echo | ||
566 | echo "${SCRIPTNAME}: invalid option \"${1}\"" >&2 | ||
567 | echo "Try '${SCRIPTNAME} --help' for more information" >&2 | ||
568 | echo | ||
569 | exit 1 | ||
570 | ;; | ||
571 | esac | ||
572 | shift | ||
573 | done | ||
574 | |||
575 | if [[ -z $blsdir ]]; then | ||
576 | blsdir="/boot/loader/entries" | ||
577 | fi | ||
578 | |||
579 | if [[ -z $env ]]; then | ||
580 | env="/boot/grub2/grubenv" | ||
581 | fi | ||
582 | |||
583 | if [[ -z $zipl_config ]]; then | ||
584 | zipl_config="/etc/zipl.conf" | ||
585 | fi | ||
586 | |||
587 | get_bls_values | ||
588 | |||
589 | default_index="$(get_default_index)" | ||
590 | |||
591 | if [[ -n $display_default ]]; then | ||
592 | display_default_value | ||
593 | fi | ||
594 | |||
595 | if [[ -n $display_info ]]; then | ||
596 | display_info_values "${display_info}" | ||
597 | fi | ||
598 | |||
599 | if [[ $bootloader = grub2 ]]; then | ||
600 | remove_var_prefix | ||
601 | fi | ||
602 | |||
603 | if [[ -n $kernel ]]; then | ||
604 | if [[ $copy_default = "true" ]]; then | ||
605 | opts="${bls_options[$default_index]}" | ||
606 | if [[ -n $args ]]; then | ||
607 | opts="${opts} ${args}" | ||
608 | fi | ||
609 | else | ||
610 | opts="${args}" | ||
611 | fi | ||
612 | |||
613 | add_bls_fragment "${kernel}" "${title}" "${opts}" "${initrd}" \ | ||
614 | "${extra_initrd}" | ||
615 | fi | ||
616 | |||
617 | if [[ -n $remove_kernel ]]; then | ||
618 | remove_bls_fragment "${remove_kernel}" | ||
619 | fi | ||
620 | |||
621 | if [[ -n $update_kernel ]]; then | ||
622 | update_bls_fragment "${update_kernel}" "${remove_args}" "${args}" "${initrd}" | ||
623 | fi | ||
624 | |||
625 | if [[ -n $set_default ]]; then | ||
626 | set_default_bls "${set_default}" | ||
627 | fi | ||
628 | |||
629 | exit 0 |
Properties
Name | Value |
---|---|
svn:executable | * |