aboutsummaryrefslogtreecommitdiff
path: root/DEBIAN
diff options
context:
space:
mode:
Diffstat (limited to 'DEBIAN')
-rw-r--r--DEBIAN/control7
-rw-r--r--DEBIAN/postinst44
-rw-r--r--DEBIAN/prerm7
3 files changed, 58 insertions, 0 deletions
diff --git a/DEBIAN/control b/DEBIAN/control
new file mode 100644
index 0000000..7299807
--- /dev/null
+++ b/DEBIAN/control
@@ -0,0 +1,7 @@
+Package: st-lsm6dsx-shift13mi
+Version: 0.1-1
+Architecture: amd64
+Maintainer: Milan Misic <twoexem@gmail.com>
+Depends: dkms, linux-headers, iio-sensor-proxy, mokuntil
+Description: LSM6DSO IMU driver fix for the SHIFT13mi/SHIFTbook
+ Patches the st_lsm6dsx_i2c kernel module to recognise the SMOCF00 ACPI ID used by the STM LSM6DSO IMU in the SHIFT13mi/SHIFTbook tablet, fixing automatic screen rotation under Linux.
diff --git a/DEBIAN/postinst b/DEBIAN/postinst
new file mode 100644
index 0000000..371346d
--- /dev/null
+++ b/DEBIAN/postinst
@@ -0,0 +1,44 @@
+#!/bin/bash
+set -e
+
+lang=$(locale | grep LANG | cut -d= -f2 | cut -d_ -f1)
+
+# Install the module with dkms
+dkms add st-lsm6dsx-shift13mi/0.1
+dkms build st-lsm6dsx-shift13mi/0.1
+dkms install st-lsm6dsx-shift13mi/0.1
+
+# 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
+
+if mokutil --sb-state 2>/dev/null | grep -q "SecureBoot enabled"; then; then
+
+ mokutil --import /var/lib/dkms/mok.pub
+
+ 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
+
diff --git a/DEBIAN/prerm b/DEBIAN/prerm
new file mode 100644
index 0000000..acdc994
--- /dev/null
+++ b/DEBIAN/prerm
@@ -0,0 +1,7 @@
+#/bin/bash
+set -e
+
+dkms remove st-lsm6dsx-shift13mi/0.1 --all || true
+
+modprobe -r st_lsm6dsx_i2c || true
+modprobe st_lsm6dsx_i2c || true