From: Nicolas Boisselier Date: Thu, 10 Oct 2024 08:19:01 +0000 (+0200) Subject: bin/nb-repo-update X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=1edddf1503444473d0e953e30d52bd920d98b40e;p=nb.git bin/nb-repo-update --- diff --git a/bin/nb-repo-update b/bin/nb-repo-update index 8b335012..f5da6358 100755 --- a/bin/nb-repo-update +++ b/bin/nb-repo-update @@ -58,14 +58,12 @@ Git pull repos # ################################################################################# CLEANUP=0 -PULL=0 DEBUG=0 VERBOSE=0 while [ $# -gt 0 ]; do case "$1" in --cleanup|-c) CLEANUP=1 ;; - --pull|-pull) PULL=1 ;; -*help|-h) usage | pod2text --width 250; exit 0 ;; --man) usage | pod2man | man -l -; exit 0 ;; @@ -91,7 +89,6 @@ exec {F_INDENT1}> >(sed 's/^/ /') exec {F_INDENT2}> >(sed -e 's/\r/\n/g' -e 's/^ *//' -e 's/^/ /') trap 'exec {F_INDENT1}>&-; exec {F_INDENT2}>&-;' EXIT -if [ "$PULL" = "1" ]; then #V=1 #echo ${V:-2} @@ -122,7 +119,6 @@ then fi #echo -fi # PULL #---------------------------------------------------------- # Git hooks # diff --git a/bin/nb-update b/bin/nb-update index ad306f85..45723717 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -37,7 +37,6 @@ Git pull repos DEBUG=0 CLEANUP=0 POST_INFO=1 -PULL=1 ################################################################################# # # Args @@ -49,7 +48,6 @@ REPO_NAME_FILTER="" while [ $# -gt 0 ]; do case "$1" in - --pull|-pull) PULL=1 ;; --cleanup|-cleanup|-c) CLEANUP=1 ;; --no-post|-nop) POST_INFO=0 ;; @@ -177,76 +175,13 @@ for dir in $(nb_repos); do # include extra scripts ! [ -r "$NB_ROOT/lib/$NAME/repo.sh" ] || . "$NB_ROOT/lib/$NAME/repo.sh" || bye -if [ "$PULL" = "1" ] -then #exec {F_INDENT}> >(sed 's/^/ /') - opt="--pull" + opt="" [ "$CLEANUP" = "1" ] && opt="$opt --cleanup" opt="${opt# *}" exec_user $user "nb-repo-update $opt" #>&$F_INDENT 2>&1 ex_repo=$? [ "$ex_repo" = "0" ] || ex=$ex_repo - #echo $ex_repo - #exec {F_INDENT}>&- -else # PULL - # - # Build command - # - cmd="" - - # - # Check ssh agent sh file - # - agent=$(eval realpath ~$user/.ssh/agent.sh) - [ -r "$agent" ] && cmd=". $agent && " - #[ -r "$agent" ] && echo "Found agent $agent" - - # - # Pull - # - ex_repo=0 - echo ">Pull $name branch=$branch user=$user path=$dir" - - cmd="${cmd}GIT_SSH=$GIT_SSH cd \"$dir\" && git pull" - [ "$CLEANUP" = "1" ] && cmd="$cmd && git gc" - - # NB 08.10.24 if [ 1 = 1 ] && ! exec_user $user git_conn_check; then - if ! exec_user $user git_conn_check; then - continue - elif [ "$USER" = "$user" ]; then - bash -c "$cmd" - elif [ "$USER" = "root" ]; then - su - $user -c "$cmd" - else - echo "Wrong user current user=$USER repo user=$user" - false - fi - echo - ex_cmd=$? - - # - # *-install - # - ex_cmd_root=0 - if [ "$ex_cmd" != "0" ]; then - ex_repo=$ex_cmd - echo ">err $ex_cmd" - - else - cmd_root="true" - - exec_user $user "nb-repo-install" | sed 's/^/ /' - ex_cmd_root=$? - if [ "$ex_cmd_root" -gt "0" ]; then - ex_repo=$ex_cmd_root - echo ">err $ex_cmd_root" - fi - - fi - - [ "$ex_repo" = "0" ] && ex_repo="$(exec_user $user git status --short &> /dev/null; echo $?)" - [ "$ex_repo" = "0" ] || ex=$ex_repo -fi # PULL if [ "$POST_INFO" = "1" ] then