]> git.sev.monster Git - dotfiles.git/blame - syslinux/update-extlinux.conf
zlogout: clean up logic, dont act without data
[dotfiles.git] / syslinux / update-extlinux.conf
CommitLineData
cd5c7e1d 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
4version=$version-mod
5verbose=0
6
7# replicate existing script
8everbose() {
9 if [ "$verbose" = "0" ]; then
10 return
11 fi
12
13 echo $*
14}
15
16ewarn() {
17 echo "WARNING:" $@ >&2
18}
19
20eerror() {
21 echo "ERROR:" $@ >&2
22 return 1
23}
24
25usage() {
26 echo "usage: $0 [-v|--verbose] [--warn-only]"
27}
28
29# NOTE: no-op for most options
30while [ $# -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
48done
49
50src=/usr/share/syslinux/efi64
51boot=/boot/EFI/Boot
52everbose "Installing binaries from $src to $boot"
53cp $src/*.c32 $src/ldlinux.e64 $boot
54cp $src/syslinux.efi $boot/bootx64.efi
55
56ids=/usr/share/hwdata/pci.ids
57bootids=hdt/pci.ids
58apkargs="-q --no-progress"
59if ! 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.
71EOF
72)
73 fi
74else
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
79fi
80if [ ! -r "$ids" ]; then
81 ewarn "Cannot read $ids, can't update $boot/$bootids"
82else
83 everbose "Installing $ids to $boot/$bootids"
84 cp $ids $boot/$bootids
85fi
86if [ -n "$undo_hwids" ]; then
87 everbose "Deleting hwids-pci"
88 apk $apkargs del hwids-pci
89fi
90
91# exit from parent script
92exit 0
This page took 0.055782 seconds and 4 git commands to generate.