1 # Build recipe for grub.
3 # Copyright (c) 2017-2021 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
24 # Define a category for the output of the package name
27 tarname=${program}-${version}.tar.gz
30 fetch=https://ftp.gnu.org/gnu/grub/$tarname
33 A multiboot boot loader.
35 GNU GRUB is a Multiboot boot loader. It was derived from GRUB,
36 the GRand Unified Bootloader, which was originally designed and
37 implemented by Erich Stefan Boleyn.
40 homepage=https://www.gnu.org/software/grub
43 # Source documentation
44 docs="AUTHORS BUGS COPYING NEWS README THANKS TODO"
45 docsdir="${docdir}/${program}-${version}"
49 unpack "${tardir}/$tarname"
53 # Add support to detect "/boot/initrd.gz" or "/boot/initrd.lz" images
54 patch -Np1 -i "${worktree}/patches/grub/initrd_naming.diff"
56 # Force enabling os-prober to detect other operating systems
57 patch -Np1 -i "${worktree}/patches/grub/grub-mkconfig-enable-os-prober.diff"
59 # Set sane permissions
60 chmod -R u+w,go-w,a+rX-s .
64 --libdir=/usr/lib${libSuffix} \
68 --enable-device-mapper \
70 --disable-grub-mkfont \
74 --build="$(gcc -dumpmachine)"
77 make -j${jobs} DESTDIR="$destdir" \
78 bashcompletiondir=/usr/share/bash-completion/completions \
81 # Remove generated charset.alias
82 rm -f "${destdir}/usr/lib${libSuffix}/charset.alias"
84 # Make required directories
85 mkdir -p "${destdir}/boot/grub/" "${destdir}/etc/default"
87 # Insert file for default settings
88 cp -p "${worktree}/archive/grub/etc/default/grub" "${destdir}/etc/default/"
89 chmod 644 "${destdir}/etc/default/grub"
91 # Manage config (.new) file(s)
92 touch "${destdir}/etc/default/.graft-config" \
93 "${destdir}/etc/grub.d/.graft-config" \
94 "${destdir}/usr/share/bash-completion/completions/.graft-config"
96 # Compress info documents deleting index file for the package
97 if test -d "${destdir}/$infodir"
99 rm -f "${destdir}/${infodir}/dir"
100 lzip -9 "${destdir}/${infodir}"/*
103 # Compress and link man pages (if needed)
104 if test -d "${destdir}/$mandir"
107 cd "${destdir}/$mandir"
108 find . -type f -exec lzip -9 {} +
109 find . -type l | while read -r file
111 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
118 mkdir -p "${destdir}/$docsdir"
119 cp -p $docs "${destdir}/$docsdir"