about summary refs log tree commit diff
path: root/pkgs/tools/misc/grub/grub1.patches.sh
blob: a7db25afb64f310eac59a52cd6fee279f54b2af3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env nix-shell
#!nix-shell -p nix -i bash --pure

# Does like `maintainers/scripts/debian-patches.sh`, but specialized for
# grub1 patches, and using the new salsa service.

# Most common usage: `pkgs/tools/misc/grub/grub1.patches.sh pkgs/tools/misc/grub/grub1.patches.nix`
# That is, after updating the script with the new list from the series file,
# removing (by commenting) patches as required.

set -e
set -u

# https://salsa.debian.org/grub-team/grub-legacy/tree/master/debian/patches
SERIES=(
    snapshot.patch
    menu.lst_gnu-hurd.patch
    graphics.patch
    raid.patch
    raid_cciss.patch
    xfs_freeze.patch
    2gb_limit.patch
    grub-special_device_names.patch
    grub-xvd_drives.patch
    initrd_max_address.patch
    splashimage_help.patch
    grub-install_addsyncs.patch
    grub-install_regexp.patch
    grub-install_aoe_support.patch
    grub-install_xvd.patch
    geometry-26kernel.patch
    print_func.patch
    mprotect.patch
    savedefault.patch
    find-grub-dir.patch
    intelmac.patch
    crossreference_manpages.patch
    ext3_256byte_inode.patch
    # Breaks on NixOS.
    #use_grub-probe_in_grub-install.patch
    objcopy-absolute.patch
    no-reorder-functions.patch

    # We aren't building amd64 binaries, see #244498
    #fix_amd64_compile.patch
    modern-automake.patch
    no-combine-stack-adjustments.patch
    no-pie.patch
)

# Revision mapping to current tip of the 0.97-73 branch.
rev="1dad5507d74ef97fdd3c6cf2a028084f6f2850c3"
prefix="https://salsa.debian.org/grub-team/grub-legacy/raw/${rev}/debian/patches"
FILE="$1"
shift

cat <<EOF > "$FILE"
# Generated by grub1-patches.sh
let
  prefix = "${prefix}";
in
[
EOF

for PATCH in "${SERIES[@]}"; do
    URL="$prefix/$PATCH"
    HASH="$(nix-prefetch-url "$URL")"
    echo "{ url = \"\${prefix}/$PATCH\"; sha256 = \"$HASH\"; }" >> "$FILE"
done
echo "]" >> "$FILE"