coren has submitted this change and it was merged.

Change subject: Add script "become".
......................................................................


Add script "become".

Change-Id: Icc0094d8aba34c571d930eafd79904f748e10ad7
---
A usr/local/bin/become
1 file changed, 21 insertions(+), 0 deletions(-)

Approvals:
  coren: Verified; Looks good to me, approved



diff --git a/usr/local/bin/become b/usr/local/bin/become
new file mode 100755
index 0000000..eab5657
--- /dev/null
+++ b/usr/local/bin/become
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+
+if [ $# -lt 1 ]; then
+  echo "usage: $(basename $0) <toolname> [command [args...]]" >&2
+  exit 1
+fi
+if ! id "local-$1" >/dev/null 2>&1
+then
+  echo "$(basename $0): no such tool '$1'" >&2
+  exit 1
+fi
+if ! [ -d "/data/project/$1" ]
+then
+  echo "$(basename $0): no such tool '$1'" >&2
+  exit 1
+fi
+user="$1"
+shift
+exec /usr/bin/sudo -niu "local-$user" "$@"
+

-- 
To view, visit https://gerrit.wikimedia.org/r/62349
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Icc0094d8aba34c571d930eafd79904f748e10ad7
Gerrit-PatchSet: 3
Gerrit-Project: labs/toollabs
Gerrit-Branch: master
Gerrit-Owner: Petrb <[email protected]>
Gerrit-Reviewer: Tim Landscheidt <[email protected]>
Gerrit-Reviewer: coren <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to