]> git.nbdom.net Git - nb.git/commitdiff
Update other repo, function git create
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 19 Feb 2015 22:56:15 +0000 (22:56 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Thu, 19 Feb 2015 22:56:15 +0000 (22:56 +0000)
bin/nb-update
etc/bashrc.function
etc/cron/nb

index 0e6faedb814aab1136c3fc72742e92cd6442297b..0a5aaa4c8bcdfbc2406ecdd2b24b51bb68538f3d 100755 (executable)
@@ -1,14 +1,40 @@
 #!/usr/bin/env bash
+#####################################################################
+#
+# Call by cron/etc/nb
+#
+#####################################################################
+
 . "${BASH_SOURCE%/*}/../etc/profile.sh" || exit
 declare -r NAME="$(basename "${0}")"
 
 #####################################################################
 # Git pull
 #
+echo ">git pull $NB_ROOT"
 cd $NB_ROOT || exit
 git pull
 
 #####################################################################
 # Install
 #
+echo ">nb-install"
 nb-install
+
+#####################################################################
+# Others git repos from nbdom
+#
+for repo in \
+  /etc/puppet/data \
+; do
+  [ -d "$repo/.git" ] || continue
+  cd "$repo" || continue
+
+  echo ">git pull $repo"
+  git pull
+done
+
+#####################################################################
+# End
+#
+echo ">OK"
index 20643597447824d275ab106616fbef077767e36f..778bee52617f2fb5f134f1ac7b265d1f3fa560bc 100644 (file)
@@ -24,18 +24,44 @@ case "$OSTYPE" in darwin*)
 
 esac
 
+# NB 19.02.15 root@pi:puppet# nb-git-create puppet/data
+# NB 19.02.15 Initialized empty Git repository in /home/git/puppet/data.git/
+# NB 19.02.15 Cloning into 'data'...
+# NB 19.02.15 warning: You appear to have cloned an empty repository.
+# NB 19.02.15 Got to directory: data
+# NB 19.02.15 Reinitialized existing Git repository in /etc/puppet/data/.git/
+# NB 19.02.15 [master (root-commit) 3ea2a65] Created by nb-git-create
+# NB 19.02.15  1 file changed, 7 insertions(+)
+# NB 19.02.15  create mode 100644 README.md
+# NB 19.02.15 Counting objects: 3, done.
+# NB 19.02.15 Compressing objects: 100% (2/2), done.
+# NB 19.02.15 Writing objects: 100% (3/3), 272 bytes, done.
+# NB 19.02.15 Total 3 (delta 0), reused 0 (delta 0)
+# NB 19.02.15 To git@git.nbdom.net:puppet/data.git
+# NB 19.02.15  * [new branch]      master -> master
+# NB 19.02.15 Branch master set up to track remote branch master from origin.
+# NB 19.02.15 fatal: remote origin already exists.
+# NB 19.02.15 Branch master set up to track remote branch master from origin.
+# NB 19.02.15 Everything up-to-date
 function nb-git-create() {
   declare name="${1%.git}"
   declare dir=$(basename $name)
   declare repo='git@git.nbdom.net'
-  [ -e "$dir" ] && echo "$dir already exists!" 1>&2 && return 1
+
+  #
+  # Check, create repo on server
+  #
+  [ -e "$dir" ] && echo ">$dir already exists!" 1>&2 && return 1
 
   ssh git@git.nbdom.net "git init --bare ${name}.git" || return
   git clone $repo:${name}.git || return
 
-  echo "Got to directory: $dir"
+  echo ">Got to directory: $dir"
   cd $dir || return
 
+  #
+  # Create files
+  #
   echo "$name
 =============
 
@@ -43,12 +69,15 @@ function nb-git-create() {
 
 DESCRIPTION
 " > README.md
+
+  #
+  # Update repo
+  #
   git init
   git add *
   git commit -m "Created by $FUNCNAME"
   git push --set-upstream origin master
   git remote add origin $repo:${name}.git
-  git push -u origin master
 }
 
 function nb-git-clone() {
index 57bee986aefc5a00d404429c563b8865b393d726..bdc742df013e68918cfdb858fd2261f5fb8f3c11 100644 (file)
@@ -4,9 +4,10 @@
 #LANG=C
 SHELL=/bin/bash
 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/nb/bin
+NB_LOG=/var/log/nb.log
 
 #####################################################################
 # m h dom mon dow user  command
 #
-*/15  9-00 * * * root nb-update &>/dev/null
-*/60 00-08 * * * root nb-update &>/dev/null
+*/15  9-00 * * * root nb-update &>$NB_LOG
+*/60 00-08 * * * root nb-update &>$NB_LOG