summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--TODO.md2
-rwxr-xr-xshare/hydra/init34
3 files changed, 24 insertions, 14 deletions
diff --git a/README.md b/README.md
index b9c3780..758de9f 100644
--- 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 f6653f4..2baba04 100644
--- 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`?
diff --git a/share/hydra/init b/share/hydra/init
index 138c5bd..4a6d0c1 100755
--- a/share/hydra/init
+++ b/share/hydra/init
@@ -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.