aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2013-10-22 23:21:37 -0200
committerSilvio Rhatto <rhatto@riseup.net>2013-10-22 23:21:37 -0200
commitb3c36890b5804a1ebc2a8cb4b6049b513abacf74 (patch)
tree4d35ced303b8f89c787cc79e664696fcebacb719
parent084644fd8088e0a2f1c618ee838f3d2447a5e7cb (diff)
downloadhydra-b3c36890b5804a1ebc2a8cb4b6049b513abacf74.tar.gz
hydra-b3c36890b5804a1ebc2a8cb4b6049b513abacf74.tar.bz2
Hydra sync: fix keyringer routines (2)
-rwxr-xr-xshare/hydra/sync62
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