File: asahi-fwupdate

package info (click to toggle)
asahi-scripts 20250130-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 292 kB
  • sloc: sh: 835; makefile: 97
file content (53 lines) | stat: -rwxr-xr-x 1,099 bytes parent folder | download | duplicates (2)
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
#!/bin/sh
# SPDX-License-Identifier: MIT

set -eu

unset PYTHON

[ -e /etc/default/asahi-fwupdate ] && . /etc/default/asahi-fwupdate

: "${ASAHIFW:=}"
: "${VENDORFW:=}"
: "${VENDORFWTMP:=/run/.vendorfw-tmp}"
: "${PYTHON:=/usr/bin/python3}"

if [ -e "$(dirname "$0")"/functions.sh ]; then
    . "$(dirname "$0")"/functions.sh
else
    . /usr/share/asahi-scripts/functions.sh
fi

umount=false

if [ -z "$ASAHIFW" ] && [ -z "$VENDORFW" ]; then
    mount_sys_esp /run/.system-efi
    ASAHIFW="/run/.system-efi/asahi/"
    VENDORFW="/run/.system-efi/vendorfw"
    umount=true
fi

if [ ! -e "${ASAHIFW}/all_firmware.tar.gz" ]; then
    echo "No firmware tarball found, skipping extraction"
    exit 0
fi

if [ ! -d "$VENDORFW" ]; then
  mkdir -p "$VENDORFW"
fi

if [ ! -d "$VENDORFWTMP" ]; then
  mkdir -p "$VENDORFWTMP"
fi

echo "Upgrading vendor firmware package"
asahi-fwextract "$ASAHIFW" "$VENDORFWTMP"
rm -rf "$VENDORFW".new
mv "${VENDORFWTMP}" "$VENDORFW".new
rm -rf "$VENDORFW"
mv "$VENDORFW".new "$VENDORFW"
rm -rf "$VENDORFWTMP"
echo "Firmware upgraded"

$umount && umount /run/.system-efi
true