diff options
author | Jameson Graef Rollins <jrollins@finestructure.net> | 2009-02-09 00:47:17 -0500 |
---|---|---|
committer | Jameson Graef Rollins <jrollins@finestructure.net> | 2009-02-09 00:47:17 -0500 |
commit | 55369617d8c00de548fabfbad02ba444f701be43 (patch) | |
tree | 3d571534e13593ecfe65d581435b384e9fd5ae27 /src/share | |
parent | 69354c87864076343793fb270b296ccb89bf3759 (diff) |
break su_monkeysphere_user into common function, since it will likely
be needed by both m-host and m-auth for communicating with keyservers.
Diffstat (limited to 'src/share')
-rw-r--r-- | src/share/common | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/share/common b/src/share/common index 00a1008..2a20c1c 100644 --- a/src/share/common +++ b/src/share/common @@ -90,6 +90,19 @@ log() { 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" |