Fix detection of forgehook user

This commit is contained in:
southerntofu 2020-04-27 16:54:55 +02:00
parent 54ab642da2
commit 9287d77fad
1 changed files with 5 additions and 3 deletions

View File

@ -2,9 +2,11 @@
# Auto-detect owner of webhook-backend on current system
# stat has different syntax on various system so we use find
# TODO: if we don't find webhook-backend, we should error
bin="$(which webhook-backend)"
owner=$(find $bin -maxdepth 0 -printf '%u')
owner=$(find /usr/local/bin/webhook-backend -maxdepth 0 -printf '%u')
if [[ $? != 0 ]]; then
echo "FATAL ERROR: webhook-backend not found in /usr/local/bin"
exit 1
fi
# Start the backend escalating privileges to its owner
# TODO: introduce timeout on a dummy sudo to check sudo rules