Created shell script to launch g13d with a .bind file (markdown)

Vangamar 2016-04-23 07:26:36 -05:00
parent 3e3ca9de78
commit b59a93b163

@ -0,0 +1,39 @@
This shell script automates running g13d from the command line and passing in a given .bind file.
**WARNING:** It might not be the best way, but I just do a **sudo chmod +w** on a couple usb/input device folders, so that I can run g13d as normal user vs. root.
If you disagree with this approach, delete the two **sudo chmod** lines, or never use this script, or edit this script to show a better way - this way works, though ;-)
#!/bin/bash
if [ ! -s "./g13d" ] ; then
echo "ERROR:"
echo " Make a sym link to this shell script in the appropriate"
echo " distro sub-dir, then run the sym link from that sub-dir."
echo "EXAMPLE:"
echo " cd Ubuntu15.10 ; ln -s ../load_bind.sh"
exit 1;
fi
if [ "$1" == "" ] ; then
echo "ERROR:"
echo " Enter the G13 Bind File as an argument."
exit 1
fi
if [ -s "$1" ] ; then bindFile="$1"
elif [ -s "$1.bind" ] ; then bindFile="$1.bind"
elif [ -s "../$1" ] ; then bindFile="../$1"
elif [ -s "../$1.bind" ] ; then bindFile="../$1.bind"
else
echo "ERROR:"
echo " The G13 Bind File: \"$1\" does not exist"
exit 1
fi
# This /tmp config file is read in by g13d at startup
cat "$bindFile" > /tmp/g13-0
# Fixes no write access to usb device
sudo chmod a+rw -R /dev/bus/usb/*
sudo chmod a+rw /dev/uinput
./g13d