From f8c90d57f673d9accaa616620660aff70f0d9246 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Fri, 28 Feb 2014 13:58:41 -0300 Subject: Repository initialization --- README | 39 --------------------------------------- README.md | 39 +++++++++++++++++++++++++++++++++++++++ lib/hydra/git | 16 ++++++++++++++++ share/hydra/init | 20 +++++--------------- 4 files changed, 60 insertions(+), 54 deletions(-) delete mode 100644 README create mode 100644 README.md diff --git a/README b/README deleted file mode 100644 index 5f635d8..0000000 --- a/README +++ /dev/null @@ -1,39 +0,0 @@ -Hydra Suite - Cloud Command and Control -======================================= - -The Hydra Suite is a complete set of tools for orchestration and management -of computers. - -This suite is made of three commands: - - - hydractl: issues commands in the current host. - - hydra: issues commands on multiple hosts. - - hydras: issues commands to multiple sets of hosts. - -Installation ------------- - -First, clone the code: - - git clone git://git.sarava.org/hydra.git - cd hydra && git tag -v - -Then add hydra folder to your `$PATH` or run the following command to install -if under `/usr/local`: - - ./hydractl provision - -Managing an existing network ----------------------------- - -If you have enough credentials, you can fetch all the needed repositories and configurations -using simply the following command: - - hydra example init ~/file/example ssh://gitolite@admin.example.org/config.git - -Creating a new network ----------------------- - -To create the needed repositories to start a new network, use a similar command: - - hydra example init ~/file/example diff --git a/README.md b/README.md new file mode 100644 index 0000000..5f635d8 --- /dev/null +++ b/README.md @@ -0,0 +1,39 @@ +Hydra Suite - Cloud Command and Control +======================================= + +The Hydra Suite is a complete set of tools for orchestration and management +of computers. + +This suite is made of three commands: + + - hydractl: issues commands in the current host. + - hydra: issues commands on multiple hosts. + - hydras: issues commands to multiple sets of hosts. + +Installation +------------ + +First, clone the code: + + git clone git://git.sarava.org/hydra.git + cd hydra && git tag -v + +Then add hydra folder to your `$PATH` or run the following command to install +if under `/usr/local`: + + ./hydractl provision + +Managing an existing network +---------------------------- + +If you have enough credentials, you can fetch all the needed repositories and configurations +using simply the following command: + + hydra example init ~/file/example ssh://gitolite@admin.example.org/config.git + +Creating a new network +---------------------- + +To create the needed repositories to start a new network, use a similar command: + + hydra example init ~/file/example diff --git a/lib/hydra/git b/lib/hydra/git index 34ba053..0908f54 100644 --- a/lib/hydra/git +++ b/lib/hydra/git @@ -31,3 +31,19 @@ function hydra_is_git { fi fi } + +# Initialize a repository +function hydra_git_init { + local repo="$1" + + if [ -z "$repo" ] || [ ! -d "$repo" ] || [ -d "$repo/.git" ]; then + return + fi + + ( + cd $repo + git init + git add . + git commit -m "Initial import" + ) +} diff --git a/share/hydra/init b/share/hydra/init index 9b817d0..81898a7 100755 --- a/share/hydra/init +++ b/share/hydra/init @@ -55,25 +55,15 @@ if [ ! -z "$REMOTE" ]; then else # No remote was given, so we assume this is a shiny new hydra! if [ ! -d "$BASEDIR/config" ]; then - mkdir -p "$BASEDIR/config" - ( - cd $BASEDIR/config - echo "Hydra $HYDRA config repository" > README.md - git init - git add . - git commit -m "Initial import" - ) + # Setup repository from template + cp -r $APP_BASE/share/config $BASEDIR/config + hydra_git_init $BASEDIR/config fi if [ ! -d "$BASEDIR/doc" ]; then mkdir -p "$BASEDIR/doc" - ( - cd $BASEDIR/doc - echo "Use this repository for notes about Hydra $HYDRA" > README.md - git init - git add . - git commit -m "Initial import" - ) + echo "Use this repository for notes about Hydra $HYDRA" > $BASEDIR/doc/README.md + hydra_git_init $BASEDIR/doc fi fi -- cgit v1.2.3