Don't sudo on unprivileged trigger

This commit is contained in:
southerntofu 2020-04-28 14:14:38 +02:00
parent 85de69aeba
commit dd6d7a208e
1 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,8 @@
#! /bin/bash
# We only take one argument!
if [[ $# != 1 ]]; then
echo "FATAL ERROR: forgehook-trigger can't deal with $# argument(s) (BUG)"
if [[ $# != 1 ]] || [[ "" = "$1" ]]; then
echo "FATAL ERROR: forgehook-trigger can't deal with those $# argument(s) (BUG)"
[[ $# != 0 ]] && echo "Found arguments: "$@""
exit 1
fi
@ -23,12 +23,12 @@ fi
FOUND=0
for f in $gitbuild/*.source; do
if [[ "$r" = "$(cat "$f")" ]]; then
if [[ "$1" = "$(cat "$f")" ]]; then
FOUND=1
task="$(basename "$f" .source)"
echo "$task for $USER"
echo "[forgehook-trigger] Running $task for $USER"
bin="$(which git-build.sh)"
sudo -u "$USER" bash "$bin" "$task"&
"$bin" "$task" > /dev/null &
fi
done