diff options
Diffstat (limited to 'share')
-rwxr-xr-x | share/hydra/sync | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/share/hydra/sync b/share/hydra/sync index ea19146..44f6f14 100755 --- a/share/hydra/sync +++ b/share/hydra/sync @@ -18,6 +18,30 @@ source $APP_BASE/lib/hydra/functions || exit 1 hydra_config_load +# Sync each repository. +function hydra_sync { + for repository in $*; do + if [ "$repository" == "keyringer" ]; then + UPDATE_KEYRINGER="yes" + continue + fi + + if [ ! -d "$HYDRA_FOLDER/$repository/.git" ]; then + git clone $PRIVATE_REPOS/$repository $HYDRA_FOLDER/$repository + fi + + if [ -d "$HYDRA_FOLDER/$repository/.git" ]; then + echo "Syncing $repository..." + + if [ "$repository" == "bootless" ]; then + ( cd $HYDRA_FOLDER/$repository && git annex sync ) + else + ( cd $HYDRA_FOLDER/$repository && git pull origin master && git submodule update --init ) + fi + fi + done +} + # Basic parameters. if [ -z "$1" ]; then REPOSITORIES="bootless dns gitolite/public gitolite/private gitosis/public gitosis/private puppet" @@ -31,40 +55,18 @@ for req in git-annex; do hydra_install_package $req done -# Sync each repository. # TODO: split between public and private repositories -for repository in $REPOSITORIES; do - if [ "$repository" == "keyringer" ]; then - UPDATE_KEYRINGER="yes" - continue - fi - - if [ ! -d "$HYDRA_FOLDER/$repository/.git" ]; then - git clone $PRIVATE_REPOS/$repository $HYDRA_FOLDER/$repository - fi - - if [ -d "$HYDRA_FOLDER/$repository/.git" ]; then - echo "Syncing $repository..." - - if [ "$repository" == "keyringer" ]; then - if ! which keyringer &> /dev/null; then - echo "Please install keyringer for a full hydra experience." - elif [ ! -e "$HOME/.keyringer/$HYDRA" ]; then - echo "Initializing keyring for $HYDRA..." - keyringer $HYDRA init $HYDRA_FOLDER/$repository - fi - fi - - if [ "$repository" == "bootless" ]; then - ( cd $HYDRA_FOLDER/$repository && git annex sync ) - else - ( cd $HYDRA_FOLDER/$repository && git pull origin master && git submodule update --init ) - fi - fi -done +hydra_sync $REPOSITORIES # Update keyring. if [ "$UPDATE_KEYRINGER" != "no" ]; then + if ! which keyringer &> /dev/null; then + echo "Please install keyringer for a full hydra experience." + elif [ ! -e "$HOME/.keyringer/$HYDRA" ]; then + echo "Initializing keyring for $HYDRA..." + keyringer $HYDRA init $HYDRA_FOLDER/$repository + fi + echo "Syncing keyringer..." keyringer $HYDRA git pull fi |