forgehook-notify is database-agnostic
This commit is contained in:
parent
f5930bf2dd
commit
5493d4de22
|
@ -2,18 +2,10 @@
|
||||||
|
|
||||||
if [[ $EUID != 0 ]]; then
|
if [[ $EUID != 0 ]]; then
|
||||||
# We're not root... yet!
|
# We're not root... yet!
|
||||||
# Let's not forget to define the db while we have forgehook $USER
|
|
||||||
# TODO: replace with ~/database
|
|
||||||
db=$HOME/webhooks
|
|
||||||
sudo forgehook-notify $@
|
sudo forgehook-notify $@
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# If the $db is empty/unset, we have a logic bug somewhere!
|
|
||||||
if [ -z $db ]; then
|
|
||||||
echo "FATAL ERROR: Could not find forgehook database (BUG)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We only take one argument!
|
# We only take one argument!
|
||||||
if [[ $# != 1 ]]; then
|
if [[ $# != 1 ]]; then
|
||||||
echo "FATAL ERROR: forgehook-notify can't deal with $# argument(s) (BUG)"
|
echo "FATAL ERROR: forgehook-notify can't deal with $# argument(s) (BUG)"
|
||||||
|
@ -31,9 +23,10 @@ rhex="$(echo -n "$r" | base64)"
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
# Iterate over the hex-encoded URL's subscriptions
|
# Iterate over the hex-encoded URL's subscriptions
|
||||||
for i in $db/"$rhex".*; do
|
IFS= echo "$(forgehook list "$1")" | while read -r user; do
|
||||||
|
#for i in $db/"$rhex".*; do
|
||||||
# Strip $rhex prefix
|
# Strip $rhex prefix
|
||||||
user="$(basename "$i")"
|
user="$(basename "$user")"
|
||||||
user="${user#$rhex.}"
|
user="${user#$rhex.}"
|
||||||
|
|
||||||
sudo -u "$user" forgehook-trigger "$1"
|
sudo -u "$user" forgehook-trigger "$1"
|
||||||
|
|
Reference in New Issue