
새 노트북(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
이것은 회전.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
그리고 이것은 전환_키보드.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
이 문제로 나를 도와주실 수 있기를 바랍니다. 도움을 주시면 감사하겠습니다.