summaryrefslogtreecommitdiffstats
path: root/hosts/alsvid3/postinst
diff options
context:
space:
mode:
Diffstat (limited to 'hosts/alsvid3/postinst')
-rw-r--r--hosts/alsvid3/postinst41
1 files changed, 35 insertions, 6 deletions
diff --git a/hosts/alsvid3/postinst b/hosts/alsvid3/postinst
index eb6f377..892bf70 100644
--- a/hosts/alsvid3/postinst
+++ b/hosts/alsvid3/postinst
@@ -27,12 +27,41 @@ cat >"${target}/boot/grub/libreboot_grub.cfg" <<-EOF
boot
EOF
-# Don't suspend on lid close.
-cp -p "${target}/etc/elogind/logind.conf" \
- "${target}/etc/elogind/logind.conf.dist"
-sed 's/^.*\(HandleLidSwitch.*\)=.*$/\1=ignore/' \
- "${target}/etc/elogind/logind.conf.dist" \
- >"${target}/etc/elogind/logind.conf"
+# Don't suspend on lid close. Turn off screen instead.
+# Unfortunately, colord recursively depends on a logind.
+in_target apt-get -q -y --autoremove purge elogind || return 1
+# Install acpid without acpi-support-base.
+in_target apt-get -q -y --no-install-recommends install acpid
+cat >"${target}/etc/acpi/events/button" <<'EOF'
+event=button.*
+action=/etc/acpi/button.sh %e
+EOF
+cat >"${target}/etc/acpi/button.sh" <<'EOF'
+#!/bin/sh
+
+set -eu
+
+export XAUTHORITY=~pj/.Xauthority
+export DISPLAY=:0
+
+case "${1}" in
+ 'button/lid')
+ case "${3}" in
+ 'open')
+ logger 'acpid: lid opened'
+ xset dpms force on
+ ;;
+ 'close')
+ logger 'acpid: lid closed'
+ xset dpms force off
+ ;;
+ esac
+esac
+# button/sleep could be handled too, but there are two events per press with
+# different $2, $3, and $4.
+# More events may be exposed if thinkpad_acpi is patched to support Taurinus:
+# http://git.proteanos.com/pkg/linux-libre-4.19.git/tree/patches/03_thinkpad_acpi_support-libiquity-taurinus-laptops.patch
+EOF
# Turn on numlock on the VTs.
cat >"${target}/etc/rc.local" <<'EOF'