aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-27 09:29:19 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-27 09:29:19 +0000
commitf9aaeeeb9be8e1a35fc5680496167385b2b09083 (patch)
tree9d0f1d551f33f32f17544bd64520abb42ed2d488
parent24c33e6ad99fae10f33a2b7dd5c3f4b100f44706 (diff)
downloadcpt-f9aaeeeb9be8e1a35fc5680496167385b2b09083.tar.gz
kiss: drop root when running git if needed
FossilOrigin-Name: 57c3fa1303c7b309078eb8dae6cfb33ea15ad89d50be873c185934cc5eb3cc8e
-rwxr-xr-xkiss11
1 files changed, 9 insertions, 2 deletions
diff --git a/kiss b/kiss
index 5107ff7..aa094a3 100755
--- a/kiss
+++ b/kiss
@@ -71,7 +71,7 @@ dosu() {
# command allows you to input a password via stdin. To hide
# the prompt, the command's output is sent to '/dev/tty'
# and the output of 'su' is sent to '/dev/null'.
- echo "$pass" | su -c "$* >/dev/tty" >/dev/null
+ echo "$pass" | su "${drop_to:-root}" -c "$* >/dev/tty" >/dev/null
}
pkg_lint() {
@@ -912,9 +912,16 @@ pkg_updates() {
if [ -w "$PWD" ]; then
git fetch
git merge
+
else
+ log "$PWD" "Need root to update"
+
+ # Find out the owner of the repository and spawn
+ # git as this user below.
+ (drop_to=$(stat -c %U "$PWD")
+
dosu git fetch
- dosu git merge
+ dosu git merge)
fi
}
done