summaryrefslogtreecommitdiffstats
path: root/meta/bin/update
diff options
context:
space:
mode:
authortv <tv@xso>2011-09-06 21:36:16 +0200
committertv <tv@xso>2011-09-06 21:36:16 +0200
commit27d6e714d7a9c5f36d36d113e80e5924758bd855 (patch)
tree2fee97efb455c271b733276310369055c13fd294 /meta/bin/update
parent6cac66363039097f0ee89db1f15e9c91ff698bab (diff)
//meta/bin/update: sudo to correct user
Diffstat (limited to 'meta/bin/update')
-rwxr-xr-xmeta/bin/update11
1 files changed, 7 insertions, 4 deletions
diff --git a/meta/bin/update b/meta/bin/update
index 98a69257..717b9e90 100755
--- a/meta/bin/update
+++ b/meta/bin/update
@@ -1,12 +1,15 @@
#! /bin/sh
set -euf
-if test "${nosudo-false}" != true -a `id -u` != 0; then
+cd $(dirname $(readlink -f $0))/../..
+id=`ls -lnd . | awk '{print$3}'`
+
+echo "// is $PWD owned by $id"
+
+if test "${nosudo-false}" != true -a `id -u` != $id; then
echo "we're going sudo..." >&2
- exec sudo "$0" "$@"
+ exec sudo -u "#$id" "$0" "$@"
exit 23 # go to hell
fi
-set -x
-cd $(dirname $(readlink -f $0))`
git pull