From 9468e789a11f48f35c76bfff4eb0fef1be9be342 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Fri, 22 Nov 2024 22:57:02 +0100 Subject: [PATCH] lib/nb-update/repo.sh --- bin/nb-install | 6 ------ bin/nb-repo-update | 2 +- bin/nb-update | 2 ++ lib/nb-update/repo.sh | 6 +++--- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/bin/nb-install b/bin/nb-install index 4a7bb125..8a80055d 100755 --- a/bin/nb-install +++ b/bin/nb-install @@ -42,12 +42,6 @@ main() { case "$@" in *-n*) INSTALL="echo DRY:";; esac fi - ############################################################################## - # - # Dir - # - mkdir -p -v /run/nb - ############################################################################## # # Cron diff --git a/bin/nb-repo-update b/bin/nb-repo-update index f9b27257..d9d9bff5 100755 --- a/bin/nb-repo-update +++ b/bin/nb-repo-update @@ -99,7 +99,7 @@ trap "exec {F_INDENT1}>&-; exec {F_INDENT2}>&-; rm -f '$TMP'" EXIT #(date;false) >&$F_INDENT2; exit # include extra scripts -#! [ -r "$NB_ROOT/lib/nb-update/repo.sh" ] || . "$NB_ROOT/lib/nb-update/repo.sh" || bye +! [ -r "$NB_ROOT/lib/nb-update/repo.sh" ] || . "$NB_ROOT/lib/nb-update/repo.sh" || bye #---------------------------------------------------------- # Git pull diff --git a/bin/nb-update b/bin/nb-update index 602ab333..9b91ef9b 100755 --- a/bin/nb-update +++ b/bin/nb-update @@ -84,6 +84,8 @@ fi ex=0 +mkdir -p -v /run/nb + bye() { rm -f "$LOCK"; exit ${1:-$ex}; } find "$LOCK" -mmin +$((60*60)) -exec rm {} \; >/dev/null 2>&1 if [ ! -e $"$LOCK" ] diff --git a/lib/nb-update/repo.sh b/lib/nb-update/repo.sh index bd09bd3e..0ed7b99a 100644 --- a/lib/nb-update/repo.sh +++ b/lib/nb-update/repo.sh @@ -2,9 +2,9 @@ git_change_url() { local usage="Usage: git_change_url URL_FROM URL_TO" local ufrom=${1:?$usage}; shift local uto=${1:?$usage}; shift - [ "$(exec_user $user git config --get remote.origin.url)" = "$ufrom" ] || return + [ "$(git config --get remote.origin.url)" = "$ufrom" ] || return echo "Update git url for $ufrom to $uto" - exec_user $user git remote set-url origin $uto + git remote set-url origin $uto nb_api_post_host_info "${preff:-git.$(pwd)}.set-url" "$uto" } git_change_url "git@git.nbdom.net:big.git" "git.nbdom.net:/home/git/big.git" @@ -17,5 +17,5 @@ git_change_url "git@big:izideal" "git@git.nbdom.net:izideal.git" git_change_url "git@big:izideal.git" "git@git.nbdom.net:izideal.git" # NB 19.10.24: -exec_user $user git branch | awk '/^\* testing/{ex=1}END{exit ex}' && exec_user $user git checkout master +git branch | awk '/^\* testing/{ex=1}END{exit ex}' || git checkout master return 0 -- 2.47.3