]> git.nbdom.net Git - nb.git/commitdiff
bin/nb-update
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 20 Mar 2019 23:46:56 +0000 (23:46 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 20 Mar 2019 23:46:56 +0000 (23:46 +0000)
bin/nb-install
bin/nb-install-debian [deleted file]
bin/nb-update
lib/sh/nb-update.sh [deleted file]

index 2d5313298334c9f7b3ac145c03de293053e1b0a5..1911ba5239852f364defb8fc1511f41e3f9cb9ef 100755 (executable)
@@ -5,7 +5,6 @@
 #
 ##############################################################################
 main() {
-       # NB 13.12.16 . "${BASH_SOURCE%/*}/../etc/profile" || exit
        . $(dirname "$0")/../etc/profile || exit 1; [ -z "$NB_ROOT" ] && exit
 
        # Export all
@@ -38,23 +37,6 @@ main() {
                case "$@" in *-n*) INSTALL="echo DRY:";; esac
        fi
 
-       ##############################################################################
-       #
-       # Functions
-       #
-       ##############################################################################
-       verbose() {
-               [ -z "$@" ] && return
-               printf '> %s\n' "$@"
-       }
-
-       fdiff() {
-               [ -e "$1" ] || return 0
-               [ -e "$2" ] || return 0
-               [ -n "$(diff -q $1 $2 2>/dev/null)" ] && return 0
-               return 1
-       }
-
        ##############################################################################
        #
        # Cron
@@ -109,7 +91,7 @@ main() {
        cd "$NB_ROOT" || exit
 
        if [ -w .git/hooks -a -r etc/git/hooks/pre-commit ]; then
-       fdiff etc/git/hooks/pre-commit .git/hooks/pre-commit >/dev/null 2>&1 \
+               fdiff etc/git/hooks/pre-commit .git/hooks/pre-commit >/dev/null 2>&1 \
                        && cp -va etc/git/hooks/pre-commit .git/hooks/
        fi
 
@@ -121,4 +103,21 @@ main() {
 
 }
 
-main
+##############################################################################
+#
+# Functions
+#
+##############################################################################
+verbose() {
+       [ -z "$@" ] && return
+       printf '> %s\n' "$@"
+}
+
+fdiff() {
+       [ -e "$1" ] || return 0
+       [ -e "$2" ] || return 0
+       [ -n "$(diff -q $1 $2 2>/dev/null)" ] && return 0
+       return 1
+}
+
+main $@
diff --git a/bin/nb-install-debian b/bin/nb-install-debian
deleted file mode 100755 (executable)
index ab8731d..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-##############################################################################
-#
-# Install - NB 12.02.19
-#
-##############################################################################
-echo apt-install -q -y \
-  curl \
-  git \
-;
index 6b70314ca09688a3fae6bff0cc760a71ff1612ef..463e8028bccdfcf05cdc8e845e9b80b86395bc63 100755 (executable)
@@ -17,7 +17,6 @@ CLEANUP=0
 #
 #####################################################################
 . $(dirname "$0")/../etc/profile || exit 1; [ -z "$NB_ROOT" ] && exit
-! [ -e "$NB_ROOT/lib/sh/$NAME.sh" ] || . "$NB_ROOT/lib/sh/$NAME.sh" || exit
 if ! which git > /dev/null; then
        echo "$NAME: can't find git!" 1>&2
        exit 1
@@ -55,9 +54,21 @@ for dir in $(nb_repos); do
                [ "$match" = "1" ] || continue
        fi
 
+       # branch
        branch=$(git_branch) || continue
        [ -z "$branch" ] && continue
 
+       # preff to post report
+       preff="git.$dir"
+
+       # include extra scripts
+       ! [ -r "$NB_ROOT/$NAME/repo.sh" ] || . "$NB_ROOT/$NAME/repo.sh" || exit
+               # NB 23.04.18: TODEL 
+# NB 24.07.18     [ "$(git config --get remote.origin.url)" = "git@git.nbdom.net:root.git" ] && git remote set-url origin git.nbdom.net:/home/git/root.git
+# NB 24.07.18     [ "$(git config --get remote.origin.url)" = "git@git.nbdom.net:nbdom.git" ] && git remote set-url origin git.nbdom.net:/home/git/nbdom.git
+# NB 24.07.18     [ "$(git config --get remote.origin.url)" = "git@git.nbdom.net:pi.git" ] && git remote set-url origin git.nbdom.net:/home/git/pi.git
+# NB 24.07.18     [ "$(git config --get remote.origin.url)" = "git@big:wp" ] && git remote set-url origin git@git.nbdom.net:wp.git && nb_api_post_host_info "$preff.set-url" "git@git.nbdom.net:wp.git"
+
        #
        # Get user
        #
@@ -100,10 +111,6 @@ for dir in $(nb_repos); do
 
        else
                cmd_root="true"
-               # NB 23.04.18: TODEL 
-# NB 24.07.18     [ "$(git config --get remote.origin.url)" = "git@git.nbdom.net:root.git" ] && git remote set-url origin git.nbdom.net:/home/git/root.git
-# NB 24.07.18     [ "$(git config --get remote.origin.url)" = "git@git.nbdom.net:nbdom.git" ] && git remote set-url origin git.nbdom.net:/home/git/nbdom.git
-# NB 24.07.18     [ "$(git config --get remote.origin.url)" = "git@git.nbdom.net:pi.git" ] && git remote set-url origin git.nbdom.net:/home/git/pi.git
 
                [ -x bin/$name-install ] && cmd_root="$cmd_root && echo '  >$name-install' && bin/$name-install|sed 's/^/    /'"
                if [ "$cmd_root" != "true" ]; then
@@ -114,16 +121,16 @@ for dir in $(nb_repos); do
 
        fi
 
-               #echo nb_api_post_host_info "${NAME}.$dir.name" "$name"
+       [ "$ex" = "0" ] && ex="$(git status --short &> /dev/null; echo $?)"
+
        echo
        echo "  >Post repo infos"
        (
-               preff="git.$dir"
                nb_api_post_host_info "$preff.name" "$name"
                nb_api_post_host_info "$preff.path" "$dir"
                nb_api_post_host_info "$preff.branch" "$branch"
                nb_api_post_host_info "$preff.url" "$(git remote get-url origin)"
-               nb_api_post_host_info "$preff.exit_code" "$(git status --short &> /dev/null; echo $?)"
+               nb_api_post_host_info "$preff.exit_code" "$ex"
        ) 2>/dev/null | sed -E -e 's/^/    /; s/'$'\t''/: /'
        echo
 
diff --git a/lib/sh/nb-update.sh b/lib/sh/nb-update.sh
deleted file mode 100644 (file)
index e69de29..0000000