forked from AsahiLinux/asahi-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasahi-fwextract
executable file
·48 lines (37 loc) · 1023 Bytes
/
asahi-fwextract
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
#!/bin/sh
# SPDX-License-Identifier: MIT
set -eu
[ -e /etc/default/asahi-fwextract ] && . /etc/default/asahi-fwextract
: "${ASAHIFW:=}"
: "${VENDORFW:=}"
: "${VENDORFWTMP:=/run/.vendorfw-tmp}"
: "${PYTHON:=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"
"$PYTHON" -m asahi_firmware.update "$ASAHIFW" "$VENDORFWTMP"
mv -f ${VENDORFWTMP}/* "$VENDORFW"
rmdir "$VENDORFWTMP"
echo "Firmware upgraded"
$umount && umount /run/.system-efi
true