File: light.postinst

package info (click to toggle)
light 1.2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid, trixie
  • size: 232 kB
  • sloc: ansic: 1,439; makefile: 44; sh: 9
file content (18 lines) | stat: -rw-r--r-- 782 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

set -e

#DEBHELPER#

# do some udev tricks to make rule effective without reboot if it's not an upgrade
if [ "$1" = configure ] && [ -n "$2" ]; then
    # change udev rule action to 'change' instead of 'add', to have a safer udevadm trigger
    sed -i 's/^ACTION=="add"/ACTION=="change"/g' /usr/lib/udev/rules.d/90-backlight.rules
    # reload and trigger rules to make it effective without a reboot
    udevadm control --reload
    udevadm trigger --subsystem-match=backlight --subsystem-match=leds --action=change --settle
    # reset udev rule action back to 'add'
    sed -i 's/^ACTION=="change"/ACTION=="add"/g' /usr/lib/udev/rules.d/90-backlight.rules
    # reload rules again to make sure original behavior is kept without a reboot
    udevadm control --reload
fi