
Ich habe Fedora (3.17.2-200.fc20.x86_64) auf meinem neuen Notebook (Lenovo Yoga Pad) installiert und wollte dieses Skript hinzufügen, das immer dann ausgelöst wird, wenn ich meinen Bildschirm umdrehe. Das durch das Ereignis ausgelöste Skript befindet sich in /etc/acpi/actions
root und gehört root.
Das Problem: Als ich den Bildschirm umdrehte, passierte nichts, außer dass SELinux mir verschiedene Warnungen anzeigte (wie „Zugriff verweigert“, einige Dinge über ioctl und Lesen usw., an die ich mich nicht mehr richtig erinnern kann). Jedenfalls wurde mir gesagt, ich solle es ausführen grep tablet_mode.ori /var/log/audit/audit.log | audit2allow -M mypol
und semodule -i mypol.pp
reparieren, was ich auch tat, aber nach einem Neustart passierte nichts, als ich den Bildschirm umdrehte. Jetzt habe ich die mypol-Dateien in meinem Home-Verzeichnis gelöscht, weil ich dachte, ich könnte mir die SELinux-Ausgabe noch einmal ansehen.
Ich stecke jetzt fest und habe Angst, Sicherheitslücken in meinem SELinux zu öffnen. Was ist die richtige Lösung dafür? Das Lustige ist, wenn ich acpid neu starte, sudo killall acpid && sudo acpid
wird das Ereignis ausgelöst und funktioniert. Das einzige, was in diesem Fall nicht funktioniert, ist der Befehl gsettings. Er zeigt keine Fehler an, ändert aber nicht die Einstellungen meines Benutzers (toor).
Dies ist das Skript, das durch das Ereignis ausgelöst wird:
#!/bin/bash
su toor -c "/home/toor/backup/scripts/toggle_keyboard.sh"
touchpad=$(xinput list-props "SynPS/2 Synaptics TouchPad" | grep "Device Enabled" | awk -F ":" '{print $2}')
if [ $touchpad -eq 1 ]; then
/home/toor/backup/scripts/rotate.sh inverted
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 0
else
/home/toor/backup/scripts/rotate.sh normal
xinput --set-prop "SynPS/2 Synaptics TouchPad" "Device Enabled" 1
fi
Dies ist die Datei rotate.sh:
#!/bin/bash
current_orientation(){
xrandr|grep " connected" |awk '{print $4}'
}
rotate_left(){
xrandr -o left
xsetwacom set "Wacom ISDv4 EC Pen stylus" rotate ccw
xsetwacom set "Wacom ISDv4 EC Pen eraser" rotate ccw
xinput set-prop "ELAN Touchscreen" "Coordinate Transformation Matrix" 0 -1 1 1 0 0 0 0 1
}
rotate_right(){
xrandr -o right
xsetwacom set "Wacom ISDv4 EC Pen stylus" rotate cw
xsetwacom set "Wacom ISDv4 EC Pen eraser" rotate cw
xinput set-prop "ELAN Touchscreen" "Coordinate Transformation Matrix" 0 1 0 -1 0 1 0 0 1
}
rotate_inverted(){
xrandr -o inverted
xsetwacom set "Wacom ISDv4 EC Pen stylus" rotate half
xsetwacom set "Wacom ISDv4 EC Pen eraser" rotate half
xinput set-prop "ELAN Touchscreen" "Coordinate Transformation Matrix" -1 0 1 0 -1 1 0 0 1
}
rotate_normal(){
xrandr -o normal
xsetwacom set "Wacom ISDv4 EC Pen stylus" rotate none
xsetwacom set "Wacom ISDv4 EC Pen eraser" rotate none
xinput set-prop "ELAN Touchscreen" "Coordinate Transformation Matrix" 1 0 0 0 1 0 0 0 1
}
orientation=$(current_orientation)
# if the orientation argument was given to this script, sets orientation variable
# according to the way we want to rotate in next loop.
if [ -n "$1" ]; then
if [ "$1" == "normal" ]; then
orientation="right"
fi
if [ "$1" == "left" ]; then
orientation="(normal"
fi
if [ "$1" == "right" ]; then
orientation="inverted"
fi
if [ "$1" == "inverted" ]; then
orientation="left"
fi
fi
# turns 90° counter-clockwise
case $orientation in
"(normal" )
rotate_left
;;
"inverted" )
rotate_right
;;
"right" )
rotate_normal
;;
"left" )
rotate_inverted
;;
* )
echo "it fucked up"
exit 1
;;
esac
exit 0
und dies wäre die toggle_keyboard.sh
#!/bin/bash
# toggle onboard keyboard
obk=$(gsettings get org.gnome.desktop.a11y.applications screen-keyboard-enabled)
if [ $obk == 'false' ]; then
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true
else
gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled false
fi
Hoffentlich könnt ihr mir dabei helfen, ich bin für jede Hilfe dankbar