From 9a2890fb2fd1fba2051e37c9c75f57f077a30a39 Mon Sep 17 00:00:00 2001 From: BenCat07 Date: Wed, 11 Sep 2019 17:23:05 +0200 Subject: [PATCH] Fix cathook GUI stuff for the logname changes --- attach | 12 ++++-------- attach-gdb | 12 ++++-------- attach-libnamed.sh | 10 +++------- preload | 5 +++-- 4 files changed, 14 insertions(+), 25 deletions(-) diff --git a/attach b/attach index 15b368e1..75b5a9db 100755 --- a/attach +++ b/attach @@ -1,15 +1,11 @@ #!/usr/bin/env bash -RUNUSER="sudo -u $SUDO_USER" +[[ ! -z "$SUDO_USER" ]] && RUNUSER="$SUDO_USER" || RUNUSER="$LOGNAME" +RUNCMD="sudo -u $RUNUSER" -if [ -z "$SUDO_USER" ]; then - echo This script may not be run without sudo! - exit -fi +$RUNCMD bash ./scripts/updater --autoupdater -$RUNUSER bash ./scripts/updater --autoupdater - -line=$(pgrep -u $SUDO_USER hl2_linux) +line=$(pgrep -u $RUNUSER hl2_linux) arr=($line) inst=$1 if [ $# == 0 ]; then diff --git a/attach-gdb b/attach-gdb index 4d0b3b47..27656298 100755 --- a/attach-gdb +++ b/attach-gdb @@ -1,15 +1,11 @@ #!/usr/bin/env bash -RUNUSER="sudo -u $SUDO_USER" +[[ ! -z "$SUDO_USER" ]] && RUNUSER="$SUDO_USER" || RUNUSER="$LOGNAME" +RUNCMD="sudo -u $RUNUSER" -if [ -z "$SUDO_USER" ]; then - echo This script may not be run without sudo! - exit -fi +$RUNCMD bash ./scripts/updater --autoupdater -$RUNUSER bash ./scripts/updater --autoupdater - -line=$(pgrep -u $SUDO_USER hl2_linux) +line=$(pgrep -u $RUNUSER hl2_linux) arr=($line) inst=$1 if [ $# == 0 ]; then diff --git a/attach-libnamed.sh b/attach-libnamed.sh index b113cf04..feaaab83 100755 --- a/attach-libnamed.sh +++ b/attach-libnamed.sh @@ -3,14 +3,10 @@ # Thank you LWSS # https://github.com/LWSS/Fuzion/commit/a53b6c634cde0ed47b08dd587ba40a3806adf3fe -RUNUSER="sudo -u $SUDO_USER" +[[ ! -z "$SUDO_USER" ]] && RUNUSER="$SUDO_USER" || RUNUSER="$LOGNAME" +RUNCMD="sudo -u $RUNUSER" -if [ -z "$SUDO_USER" ]; then - echo This script may not be run without sudo! - exit -fi - -$RUNUSER bash ./scripts/updater --autoupdater +$RUNCMD bash ./scripts/updater --autoupdater line=$(pgrep -u $SUDO_USER hl2_linux) arr=($line) diff --git a/preload b/preload index 31a4d78f..f7e4b49b 100755 --- a/preload +++ b/preload @@ -4,7 +4,8 @@ if [ $EUID == 0 ]; then echo "This script must not be run as root" exit fi -line=$(pgrep -u $LOGNAME hl2_linux) +[[ ! -z "$SUDO_USER" ]] && RUNUSER=$SUDO_USER || RUNUSER=$LOGNAME +line=$(pgrep -u $RUNUSER hl2_linux) arr=($line) if [ ${#arr[@]} != 0 ]; then @@ -12,7 +13,7 @@ if [ ${#arr[@]} != 0 ]; then exit fi -line=$(pgrep -u $LOGNAME steam) +line=$(pgrep -u $RUNUSER steam) arr=($line) if [ ${#arr[@]} == 0 ]; then