cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit fa43f8ae4fe5ddb86e22c1c15e72693c691296d2
parent b53e3be56f9e8072134fd5ee97acc2d938812933
Author: Cem Keylan <cem@ckyln.com>
Date:   Thu, 28 May 2020 03:13:44 +0300

kiss: adapt submodule pulling

Diffstat:
Mkiss | 22+++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/kiss b/kiss @@ -1236,10 +1236,7 @@ pkg_fetch() { if [ -w "$PWD" ] && [ "$uid" != 0 ]; then git fetch git merge - ! [ -e .gitmodules ] || { - git submodule init - git submodule update - } + git submodule update --remote --init -f else [ "$uid" = 0 ] || log "$PWD" "Need root to update" @@ -1259,15 +1256,14 @@ pkg_fetch() { [ "$user" = root ] || log "Dropping permissions to $user for pull" - case $su in - su) "$su" -c "git fetch && git merge && { ! [ -e .gitmodules ] || { git submodule init ; git submodule update ;} ;}" "$user" ;; - *) "$su" -u "$user" git fetch - "$su" -u "$user" git merge - ! [ -e .gitmodules ] || { - "$su" -u "$user" git submodule init - "$su" -u "$user" git submodule update - } - esac + git_cmd="git fetch && git merge && git submodule update --remote --init -f" + case $su in *su) git_cmd="'$git_cmd'"; esac + + # Spawn a subshell to run multiple commands as + # root at once. This makes things easier on users + # who aren't using persist/timestamps for auth + # caching. + user=$user as_root sh -c "$git_cmd" ) fi }