blob: 81fa0123c5d83c64cebd201ef48e8478894ac043 (
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
|
get_valid_users() {
_l="/etc/login.defs"
_p="/etc/passwd"
## get min and max UID limit ##
l=$(grep "^UID_MIN" "$_l")
l1=$(grep "^UID_MAX" "$_l")
## use awk to print if UID >= $MIN and UID <= $MAX and shell is not /sbin/nologin ##
awk -F':' -v "min=${l##UID_MIN}" -v "max=${l1##UID_MAX}" '{
if ($3 >= min && $3 <= max && $7 != "/sbin/nologin") print $0
}' "$_p" | cut -d: -f1
}
add_users() {
users=$(get_valid_users)
for i in $users; do
echo "Adding user '$i' to user-group 'input,video'"
usermod -a -G input "$i"
usermod -a -G video "$i"
done
}
disable_gestures() {
users=$(get_valid_users)
for i in $users; do
echo "Disabling libinput-gestures.service for user '$i'"
sudo systemctl --machine "$i"@ disable --now --user libinput-gestures.service
done
}
add_group() {
getent group "input" &>/dev/null || groupadd -r input -g 97
getent group "video" &>/dev/null || groupadd -r video -g 91
add_users
}
post_install() {
post_upgrade
}
post_upgrade() {
add_group
cat <<EOF
********************"
If you need advanced gesture support, run the command:
libinput-gestures-setup service autostart start
for your user,and to disable it, run:
libinput-gestures-setup service autostop stop
********************"
EOF
}
pre_remove() {
disable_gestures
}
|