aboutsummaryrefslogtreecommitdiff
path: root/DEBIAN/postinst
blob: 90637f8fa5a3606879901aab3ce12c4932fee716 (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
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
set -e

lang=$(locale | grep LANG | cut -d= -f2 | cut -d_ -f1)

# Install the module with dkms
dkms add st-lsm6dsx-shift13mi/1.2 || true
dkms build st-lsm6dsx-shift13mi/1.2 || true
dkms install st-lsm6dsx-shift13mi/1.2 || true

# Unload the old module and reload the new module 
modprobe -r st_lsm6dsx_i2c || true
modprobe st_lsm6dsx_i2c || true

# Reload udev and hwdb
systemd-hwdb update
udevadm trigger
systemctl restart iio-sensor-proxy || true

if mokutil --sb-state 2>/dev/null | grep -q "SecureBoot enabled"; then

	MOK_PATH=""
	if [ -f /var/lib/shim-signed/mok/MOK.der ]; then
		MOK_PATH="/var/lib/shim-signed/mok/MOK.der"
	elif [ -f /var/lib/dkms/mok.pub ]; then
		MOK_PATH="/var/lib/dkms/mok.pub"
	fi

	if [ -n "$MOK_PATH" ]; then
		if [ "$lang" == "de" ]; then
            		echo -e "\n#################\nBitte nun ein Passwort eingeben. Dieses wird beim Neustart abgefragt."
        	else
            		echo -e "\n#################\nPlease enter a password. It will be requested on next reboot."
        	fi

        	mokutil --import "$MOK_PATH"

    	else
	
        	if [ "$lang" == "de" ]; then
            		echo "Konnte den MOK-Schlüssel nicht finden. Bitte installier ihn manuell: mokutil --import <pfad-zu-mok>"
        	else
            		echo "Could not find MOK key. Please import it manually with: mokutil --import <path-to-mok>"
        	fi
    	fi

	
	if [ "$lang" == "de" ]; then
		echo "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
		echo "┃   Für alle Secure-Boot-Nutzer:   ┃"
		echo "┃Beim nächsten Neustart werden Sie ┃"
		echo "┃aufgefordert, ein eigenes Zertifi-┃"
		echo "┃kat einzulesen. Dies ist nötig, da┃"
		echo "┃das neue Modul nicht mit dem      ┃"
		echo "┃Ubuntu-Zertifikat signiert wurde. ┃"
		echo "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"

	else

		echo "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"
		echo "┃   For all Secure Boot users:        ┃"
		echo "┃The next time you reboot, you will be┃"
		echo "┃prompted to enroll your own key. This┃"
		echo "┃is necessary because the new module  ┃"
		echo "┃was not signed with the Ubuntu key.  ┃"
		echo "┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛"
	fi
fi