blob: 61600b7698ec068089a7b519b7b8ccec039cfca0 (
plain)
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
|
post_install() {
echo -e "You can use command \033[4mmemtest86-efi --install\033[0m as root to install MemTest86 in your ESP."
}
pre_upgrade() {
if [[ $(vercmp "$2" "1:9.4build1000-4") -lt 0 ]]; then
rm /usr/share/libalpm/hooks/memtest86-efi-remove.hook
echo "Updating /etc/memtest86-efi/memtest86-efi.conf..."
echo -e "\033[4mCurrent file:\033[0m"
grep -v '^\s*$\|^\s*\#' /etc/memtest86-efi/memtest86-efi.conf
source /etc/memtest86-efi/memtest86-efi.conf
if [[ $install == 0 ]]; then
cat > /etc/memtest86-efi/memtest86-efi.conf <<EOF
#
# /etc/memtest86-efi/memtest86-efi.conf
#
MEMTEST86_PATH=/usr/share/memtest86-efi
esp_partition=@ESP_PARTITION@
esp_mount_path=@ESP_MOUNT_PATH@
memtest86_esp_path=@MEMTEST86_ESP_PATH@
memtest86_esp_bin=@MEMTEST86_ESP_BIN@
choice=@CHOICE@
install=0
EOF
else
sed -i "s/^partition=/esp_partition=/" "/etc/memtest86-efi/memtest86-efi.conf"
sed -i "s/^esp=/esp_mount_path=/" "/etc/memtest86-efi/memtest86-efi.conf"
case "$(uname -m)" in
i686) ARCH="ia32";;
x86_64) ARCH="x64";;
aarch64) ARCH="aa64";;
esac
case $choice in
1)
memtest86_esp_path="/"
memtest86_esp_bin="shell$ARCH.efi"
;;
2|3|4)
memtest86_esp_path="/EFI/memtest86"
memtest86_esp_bin="memtest$ARCH.efi"
;;
esac
sed -i "/^esp_mount_path=.*/a memtest86_esp_path=$memtest86_esp_path" /etc/memtest86-efi/memtest86-efi.conf
sed -i "/^memtest86_esp_path=.*/a memtest86_esp_bin=$memtest86_esp_bin" /etc/memtest86-efi/memtest86-efi.conf
fi
echo -e "\033[4mNew file:\033[0m"
grep -v '^\s*$\|^\s*\#' /etc/memtest86-efi/memtest86-efi.conf
fi
}
pre_remove() {
/usr/bin/memtest86-efi --remove
}
|