aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rwxr-xr-xshare/hydra/init4
-rwxr-xr-xshare/hydra/sync63
2 files changed, 41 insertions, 26 deletions
diff --git a/share/hydra/init b/share/hydra/init
index 0821d45..d3ec70f 100755
--- a/share/hydra/init
+++ b/share/hydra/init
@@ -49,9 +49,11 @@ if [ ! -z "$REMOTE" ]; then
# Initialize only the required repositories
for repo in $BASEREPOS; do
+ # There is a superproject, so we try to initialize submodules
if [ -e '.gitmodules' ] && git submodule | grep -q " $repo$"; then
git submodule update --init --recursive $repo
else
+ # No superproject, so we clone each repository
REMOTE="`echo $REMOTE | sed -e 's|/$||'`"
if git ls-remote ${REMOTE}/$repo &> /dev/null; then
@@ -131,4 +133,4 @@ echo "$HYDRA=\"$BASEDIR\"" >> $CONFIG
#read response
# Sync repositories
-hydra $HYDRA sync
+#hydra $HYDRA sync
diff --git a/share/hydra/sync b/share/hydra/sync
index bed3e4f..cd1329f 100755
--- a/share/hydra/sync
+++ b/share/hydra/sync
@@ -45,10 +45,15 @@ function hydra_sync {
git clone ${url}${repository} $HYDRA_FOLDER/$repository
fi
- if [ -d "$HYDRA_FOLDER/$repository/.git" ]; then
+ if [ -e "$HYDRA_FOLDER/$repository/.git" ]; then
echo "Syncing $repository..."
- if [ "$repository" == "bootless" ]; then
+ if [ -d "$HYDRA_FOLDER/$repository/.git/annex" ]; then
+ # Check for requirements.
+ for req in git-annex; do
+ hydra_install_package $req
+ done
+
( cd $HYDRA_FOLDER/$repository && git annex sync )
else
(
@@ -63,6 +68,30 @@ function hydra_sync {
fi
fi
done
+
+ # Sync keyringer at last
+ if [ "$UPDATE_KEYRINGER" == "yes" ]; then
+ hydra_sync_keyringer
+ fi
+}
+
+# Update keyring.
+function hydra_sync_keyringer {
+ if [ "$UPDATE_KEYRINGER" != "no" ]; then
+ if [ ! -e "$HOME/.keyringer/$HYDRA" ]; then
+ if [ -e "$HYDRA_FOLDER/keyring" ]; then
+ if ! which keyringer &> /dev/null; then
+ hydra_install_package keyringer
+ fi
+
+ echo "Initializing keyring for $HYDRA..."
+ keyringer $HYDRA init $HYDRA_FOLDER/keyring
+
+ echo "Syncing keyringer..."
+ keyringer $HYDRA git pull
+ fi
+ fi
+ fi
}
# Basic parameters.
@@ -70,29 +99,13 @@ if [ -z "$1" ]; then
REPOSITORIES="$BASEREPOS"
else
REPOSITORIES="$*"
- UPDATE_KEYRINGER="no"
fi
-# Check for requirements.
-for req in git-annex; do
- hydra_install_package $req
-done
-
-hydra_sync $REPOSITORIES
-
-# Update keyring.
-if [ "$UPDATE_KEYRINGER" != "no" ]; then
- if [ ! -e "$HOME/.keyringer/$HYDRA" ]; then
- if [ -e "$HYDRA_FOLDER/keyring" ]; then
- if ! which keyringer &> /dev/null; then
- hydra_install_package keyringer
- fi
-
- echo "Initializing keyring for $HYDRA..."
- keyringer $HYDRA init $HYDRA_FOLDER/keyring
-
- echo "Syncing keyringer..."
- keyringer $HYDRA git pull
- fi
- fi
+# Check if this hydra uses a superproject
+if [ -d "$HYDRA_FOLDER/.git" ]; then
+ # Update submodules
+ ( cd $HYDRA_FOLDER && git submodule update --recursive )
+else
+ # Sync each repository
+ hydra_sync $REPOSITORIES
fi