]> gitweb.fluxo.info Git - hydra.git/commitdiff
Init: use superproject repo
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Oct 2015 15:56:04 +0000 (13:56 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Oct 2015 15:56:04 +0000 (13:56 -0200)
README.md
TODO.md
share/hydra/init

index b9c3780f7fd4d2a73500dc37772c6d6e4f1ab121..758de9ff00a95800910681e7cfbc28abad9abd44 100644 (file)
--- a/README.md
+++ b/README.md
@@ -37,7 +37,7 @@ If you have enough credentials (ssh pubkey set in the server), you can fetch
 all the needed repositories and configurations to a local folder
 `~/file/example` using simply the following command:
 
-    hydra example init ~/file/example git@admin.example.org:config.git
+    hydra example init ~/file/example git@admin.example.org:example.git
 
 Creating a new network
 ----------------------
diff --git a/TODO.md b/TODO.md
index f6653f4e6cb96c6b87d7f1c2fbab9edabb41cf60..2baba046f43940128b1776585b41e9e16c226f64 100644 (file)
--- a/TODO.md
+++ b/TODO.md
@@ -10,7 +10,7 @@ Hydra
   - check, install and test puppet pre-commit via git-hooks on all repositories using module-commit.
 - bootless: properly support `$subdevice` in parted or always use first partition (like `/dev/sdb1`).
 - ssh-config: hydra integration.
-- init: version control in the superproject.
+- init: add new repositories as superproject's submodules.
 - deploy:
   - import keys and certs.
   - use `bin/deploy` from `puppet-bootstrap`?
index 138c5bd3a3155554c53e9503018ad53f688bea35..4a6d0c1456ecd4946be3e020f084bc7d2aaa8f12 100755 (executable)
@@ -36,21 +36,23 @@ elif [ -d "$BASEDIR" ]; then
   exit 1
 fi
 
-# Create base
-mkdir -p $BASEDIR
-
-# Reparse basedir to force absolute folder
-BASEDIR="`cd $BASEDIR && pwd`"
-
-# Add entry
-echo "Registering hydra $HYDRA..."
-chmod 700 $BASEDIR
-echo "$HYDRA=\"$BASEDIR\"" >> $CONFIG
-
 # Clone configuration repository or setup a new hydra
 if [ ! -z "$REMOTE" ]; then
-  git clone $REMOTE $BASEDIR/config
+  git clone $REMOTE $BASEDIR
+
+  (
+    cd $BASEDIR
+
+    # Initialize only the required repositories
+    for repo in $BASEREPOS; do
+      git submodule update --init $repo
+    done
+  )
 else
+  # Create the superproject
+  mkdir -p $BASEDIR
+  hydra_git_init $BASEDIR
+
   # Create config repository
   if [ ! -d "$BASEDIR/config" ]; then
     # Setup repository from template
@@ -82,6 +84,14 @@ else
   fi
 fi
 
+# Reparse basedir to force absolute folder
+BASEDIR="`cd $BASEDIR && pwd`"
+
+# Add entry
+echo "Registering hydra $HYDRA..."
+chmod 700 $BASEDIR
+echo "$HYDRA=\"$BASEDIR\"" >> $CONFIG
+
 cat<<-EOF
 Hydra suite relies heavilly in the address in the form of "admin.example.org"
 as the repository server which hosts configuration.