diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-27 09:29:19 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2020-01-27 09:29:19 +0000 |
commit | f9aaeeeb9be8e1a35fc5680496167385b2b09083 (patch) | |
tree | 9d0f1d551f33f32f17544bd64520abb42ed2d488 /kiss | |
parent | 24c33e6ad99fae10f33a2b7dd5c3f4b100f44706 (diff) | |
download | cpt-f9aaeeeb9be8e1a35fc5680496167385b2b09083.tar.gz |
kiss: drop root when running git if needed
FossilOrigin-Name: 57c3fa1303c7b309078eb8dae6cfb33ea15ad89d50be873c185934cc5eb3cc8e
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -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 |