Fix the trouble with logname

This commit is contained in:
bencat07 2019-09-11 16:58:45 +02:00
parent 2cb4de353a
commit 2c36212e41
5 changed files with 27 additions and 8 deletions

10
attach
View File

@ -1,9 +1,15 @@
#!/usr/bin/env bash
RUNUSER="sudo -u $(logname)"
RUNUSER="sudo -u $SUDO_USER"
if [ -z "$SUDO_USER" ]; then
echo This script may not be run without sudo!
exit
fi
$RUNUSER bash ./scripts/updater --autoupdater
line=$(pgrep -u $(logname) hl2_linux)
line=$(pgrep -u $SUDO_USER hl2_linux)
arr=($line)
inst=$1
if [ $# == 0 ]; then

View File

@ -1,6 +1,12 @@
#!/usr/bin/env bash
RUNUSER="sudo -u $(logname)"
RUNUSER="sudo -u $SUDO_USER"
if [ -z "$SUDO_USER" ]; then
echo This script may not be run without sudo!
exit
fi
$RUNUSER bash ./scripts/updater --autoupdater
line=$(pgrep -u $SUDO_USER hl2_linux)

View File

@ -3,7 +3,13 @@
# Thank you LWSS
# https://github.com/LWSS/Fuzion/commit/a53b6c634cde0ed47b08dd587ba40a3806adf3fe
RUNUSER="sudo -u $(logname)"
RUNUSER="sudo -u $SUDO_USER"
if [ -z "$SUDO_USER" ]; then
echo This script may not be run without sudo!
exit
fi
$RUNUSER bash ./scripts/updater --autoupdater
line=$(pgrep -u $SUDO_USER hl2_linux)

View File

@ -1,14 +1,15 @@
#!/usr/bin/env bash
[[ ! -z "$SUDO_USER" ]] && user=$SUDO_USER || user=$LOGNAME
if ! [ -d "/opt/cathook/data" ]; then
echo "Creating cathook data directory at /opt/cathook/data"
mkdir -p "/opt/cathook/data"
chown -R $USER "/opt/cathook/data"
chown -R $user "/opt/cathook/data"
chmod -R 777 "/opt/cathook/data"
fi
echo "Installing cathook data to /opt/cathook/data"
rsync -avh --progress "data/" "/opt/cathook/data"
rsync -avh --ignore-existing --progress "config_data/" "/opt/cathook/data"
chown -R $(logname) "/opt/cathook/data"
chown -R $user "/opt/cathook/data"
chmod -R 777 "/opt/cathook/data"

View File

@ -4,7 +4,7 @@ if [ $EUID == 0 ]; then
echo "This script must not be run as root"
exit
fi
line=$(pgrep -u $(logname) hl2_linux)
line=$(pgrep -u $LOGNAME hl2_linux)
arr=($line)
if [ ${#arr[@]} != 0 ]; then
@ -12,7 +12,7 @@ if [ ${#arr[@]} != 0 ]; then
exit
fi
line=$(pgrep -u $(logname) steam)
line=$(pgrep -u $LOGNAME steam)
arr=($line)
if [ ${#arr[@]} == 0 ]; then