]> git.sev.monster Git - dotfiles.git/blob - syslinux/update-extlinux.conf
librewolf: allow different extension enablement
[dotfiles.git] / syslinux / update-extlinux.conf
1 # we are using the fact that this is a sourced sh script to take over and
2 # handle updating ourselves. config is static and does not need changes.
3
4 version=$version-mod
5 verbose=0
6
7 # replicate existing script
8 everbose() {
9         if [ "$verbose" = "0" ]; then
10                 return
11         fi
12
13         echo $*
14 }
15
16 ewarn() {
17         echo "WARNING:" $@ >&2
18 }
19
20 eerror() {
21         echo "ERROR:" $@ >&2
22         return 1
23 }
24
25 usage() {
26         echo "usage: $0 [-v|--verbose] [--warn-only]"
27 }
28
29 # NOTE: no-op for most options
30 while [ $# -gt 0 ]; do
31         opt="$1"
32         shift
33         case "$opt" in
34         -v|--verbose)
35                 verbose=1
36                 ;;
37         --warn-only)
38                 warn_only=1
39                 ;;
40         --)
41                 break
42                 ;;
43         -*)
44                 usage
45                 exit 1
46                 ;;
47         esac
48 done
49
50 src=/usr/share/syslinux/efi64
51 boot=/boot/EFI/Boot
52 everbose "Installing binaries from $src to $boot"
53 cp $src/*.c32 $src/ldlinux.e64 $boot
54 cp $src/syslinux.efi $boot/bootx64.efi
55
56 ids=/usr/share/hwdata/pci.ids
57 bootids=hdt/pci.ids
58 apkargs="-q --no-progress"
59 if ! apk info -e hwids-pci >/dev/null; then
60         everbose "Installing hwids-pci"
61         if apk $apkargs add hwids-pci; then
62                 undo_hwids=1
63         else
64                 ewarn $(cat <<EOF
65                         Unable to install hwids-pci! If update-extlinux is
66                         being called from syslinux hook during
67                         installation/upgrade, you will need to run
68                         update-extlinux after the apk database is unlocked.
69                         Alternatively, install hwids-pci manually before
70                         upgrading boot-related packages.
71 EOF
72 )
73         fi
74 else
75         everbose "Upgrading hwids-pci"
76         if ! apk $apkargs upgrade hwids-pci; then
77                 ewarn "Upgrade failed for hwids-pci, pci.ids may be out of date"
78         fi
79 fi
80 if [ ! -r "$ids" ]; then
81         ewarn "Cannot read $ids, can't update $boot/$bootids"
82 else
83         everbose "Installing $ids to $boot/$bootids"
84         cp $ids $boot/$bootids
85 fi
86 if [ -n "$undo_hwids" ]; then
87         everbose "Deleting hwids-pci"
88         apk $apkargs del hwids-pci
89 fi
90
91 # exit from parent script
92 exit 0
This page took 0.041537 seconds and 4 git commands to generate.