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"
+ )
+}
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