X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fshare%2Fcommon;h=2a20c1c9311e203f0f30009da0ba91172fad1ca3;hb=3b81cd012e8224490a3836cccbd7d082a061658e;hp=ef931ca4bc7a20282be621bfa533830c9cfef8bb;hpb=b5cdb9cff70a5ab6982e79c7acd0c9bc0a010c49;p=monkeysphere.git diff --git a/src/share/common b/src/share/common index ef931ca..2a20c1c 100644 --- a/src/share/common +++ b/src/share/common @@ -34,7 +34,8 @@ failure() { # write output to stderr based on specified LOG_LEVEL the first # parameter is the priority of the output, and everything else is what -# is echoed to stderr +# is echoed to stderr. If there is nothing else, then output comes +# from stdin, and is not prefaced by log prefix. log() { local priority local level @@ -79,12 +80,29 @@ log() { output=true fi if [ "$priority" = "$level" -a "$output" = 'true' ] ; then - echo -n "ms: " >&2 - echo "$@" >&2 + if [ "$1" ] ; then + echo -n "ms: " >&2 + echo "$@" >&2 + else + cat >&2 + fi fi done } +# run command as monkeysphere user +su_monkeysphere_user() { + # if the current user is the monkeysphere user, then just eval + # command + if [ $(id -un) = "$MONKEYSPHERE_USER" ] ; then + eval "$@" + + # otherwise su command as monkeysphere user + else + su "$MONKEYSPHERE_USER" -c "$@" + fi +} + # cut out all comments(#) and blank lines from standard input meat() { grep -v -e "^[[:space:]]*#" -e '^$' "$1" @@ -533,12 +551,6 @@ gpg_fetch_userid() { --search ="$userID" > /dev/null 2>&1 returnCode="$?" - # if the user is the monkeysphere user, then update the - # monkeysphere user's trustdb - if [ $(id -un) = "$MONKEYSPHERE_USER" ] ; then - gpg_authentication "--check-trustdb" > /dev/null 2>&1 - fi - return "$returnCode" }