
新しいノートブック (Lenovo Yoga Pad) に Fedora (3.17.2-200.fc20.x86_64) をインストールし、画面を反転するたびにトリガーされるこのスクリプトを追加したいと考えました。イベントでトリガーされたスクリプトは、ルートにあり/etc/acpi/actions
、ルートによって所有されています。
問題: 画面を裏返しても、SELinux がさまざまな警告 (アクセス拒否、ioctl や読み取りに関するいくつかのことなど、正確には思い出せない) を表示する以外、何も起こりませんでした。とにかく、実行して修正するように指示されたのでgrep tablet_mode.ori /var/log/audit/audit.log | audit2allow -M mypol
、semodule -i mypol.pp
それを実行しましたが、再起動後に画面を裏返しても何も起こりませんでした。ここで、SELinux の出力を再び確認できると思ったので、ホーム ディレクトリの mypol ファイルを削除しました。
私は今行き詰まっていて、SELinux にセキュリティ ホールが開くのではないかと心配しています。これに対する適切な解決策は何でしょうか? 面白いのは、sudo killall acpid && sudo acpid
イベントがトリガーされて動作する状態で acpid を再起動すると、この場合に動作しないのは gsettings コマンドだけであり、エラーは表示されませんが、ユーザー (toor) の設定は変更されないことです。
これはイベントによってトリガーされるスクリプトです:
#!/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
これは 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
これは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
うまくいけば、あなたはこれを手伝ってくれるでしょう、どんな助けでも感謝します