Commit a9e3b426 authored by sebt3's avatar sebt3

Added pyrainputctl script

parent 268b5731
......@@ -27,3 +27,4 @@ if (SYSTEMD_FOUND)
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pyrainput.service"
DESTINATION "${SYSTEMD_SERVICES_INSTALL_DIR}")
endif (SYSTEMD_FOUND)
install(FILES "${PROJECT_SOURCE_DIR}/pyrainputctl" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ DESTINATION sbin)
#!/bin/bash
CFG=/etc/pyrainput.cfg
help() {
cat<<ENDHELP
$1 {enable|disable} {keypad|gamepad|mouse}
ENDHELP
}
unsetValue() {
local key=$1
[ ! -e $CFG ] && touch $CFG
sed -ie '/^'"$key"'/d' $CFG
}
setValue() {
local key=$1
local val=$2
unsetValue "$key"
echo "$key = $val">>$CFG
}
case "$1-$2" in
disable-keypad)
setValue keypad.export 0;;
enable-keypad)
unsetValue keypad.export;;
disable-gamepad)
setValue gamepad.export 0;;
enable-gamepad)
unsetValue gamepad.export;;
disable-mouse)
setValue mouse.export 0;;
enable-mouse)
unsetValue mouse.export;;
*)
help $0;exit 1;;
esac
systemctl reload pyrainput
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment