From 55369617d8c00de548fabfbad02ba444f701be43 Mon Sep 17 00:00:00 2001 From: Jameson Graef Rollins Date: Mon, 9 Feb 2009 00:47:17 -0500 Subject: break su_monkeysphere_user into common function, since it will likely be needed by both m-host and m-auth for communicating with keyservers. --- src/share/common | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/share/common') 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" -- cgit v1.2.3