]> git.nbdom.net Git - nb.git/commitdiff
bin/nb-repo-update
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 10 Oct 2024 08:19:01 +0000 (10:19 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 10 Oct 2024 08:19:01 +0000 (10:19 +0200)
bin/nb-repo-update
bin/nb-update

index 8b335012262a1d7a472b3577f74fa571e34765b0..f5da6358507b7c6d08eeea2d9c9ae20e908a82b4 100755 (executable)
@@ -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
 #
index ad306f85044f15b1c198ec41eb89940bfa9efd19..45723717bd65a4b55d6ddf583505b67039ea21bc 100755 (executable)
@@ -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