diff options
Diffstat (limited to 'kiss')
-rwxr-xr-x | kiss | 22 |
1 files changed, 9 insertions, 13 deletions
@@ -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 } |