summaryrefslogtreecommitdiff
path: root/src/share/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/common')
-rw-r--r--src/share/common13
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"