zenidrv-g203/zenidrv-g203-admin
2021-07-09 13:11:37 +02:00

79 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
#############################################################
# Zenity interface for G203 (Prodigy & Ligthsync) driver #
# Last change: 09-07-2021 #
# Author: q3aql #
# Contact: q3aql@protonmail.ch #
# License: GPL v2.0 #
#############################################################
VERSION="1.2"
M_DATE="090721"
# Variables
iconPath="/usr/share/icons/logitech/logitech-black.png"
# Link with gksudo,gksu o bessu
function showRootMessage() {
if [ -f /usr/bin/gksudo ] ; then
gksudo /usr/bin/zenidrv-g203
exit
elif [ -f /bin/gksudo ] ; then
gksudo /usr/bin/zenidrv-g203
exit
elif [ -f /usr/bin/gksu ] ; then
gksu /usr/bin/zenidrv-g203
exit
elif [ -f /bin/gksu ] ; then
gksu /usr/bin/zenidrv-g203
exit
elif [ -f /usr/bin/beesu ] ; then
beesu /usr/bin/zenidrv-g203
exit
elif [ -f /bin/beesu ] ; then
beesu /usr/bin/zenidrv-g203
exit
elif [ -f /bin/sudo ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo zenidrv-g203"
exit
elif [ -f /usr/bin/sudo ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "sudo zenidrv-g203"
exit
elif [ -f /usr/bin/su ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'zenidrv-g203'"
exit
elif [ -f /bin/su ] ; then
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "su -c 'zenidrv-g203'"
exit
else
zenity -h &> /dev/null
output=$?
if [ ${output} -eq 0 ] ; then
zenity --title "zenidrv-g203 ${VERSION} (${M_DATE})" --window-icon=${iconPath} --info \
--text "The 'zenidrv-g203' program could not be run as administrator\n\nPlease run the command 'zenidrv-g203' as root user in terminal"
else
xterm -T "zenidrv-g203 ${VERSION} (${M_DATE})" -fa Monospace -fs 10 -bg white -fg black -e "zenidrv-g203-admin --error"
fi
fi
}
# Function to show error message
function errorMessage() {
echo ""
echo "* ATTENTION!:"
echo ""
echo "* The 'zenidrv-g203' program could not be run as administrator"
echo ""
echo "* Please run the command 'zenidrv-g203' as root user in terminal"
echo ""
echo -n "* Press ENTER to exit... " ; read continue
exit
}
# Startup script
if [ "${1}" == "--error" ] ; then
errorMessage
else
showRootMessage
fi