diff --git a/bin/forgehook-notify b/bin/forgehook-notify index f43d052..830bef0 100644 --- a/bin/forgehook-notify +++ b/bin/forgehook-notify @@ -2,18 +2,10 @@ if [[ $EUID != 0 ]]; then # 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 $@ exit $? 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! if [[ $# != 1 ]]; then echo "FATAL ERROR: forgehook-notify can't deal with $# argument(s) (BUG)" @@ -31,9 +23,10 @@ rhex="$(echo -n "$r" | base64)" shopt -s nullglob # 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 - user="$(basename "$i")" + user="$(basename "$user")" user="${user#$rhex.}" sudo -u "$user" forgehook-trigger "$1"