aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-11-11 00:30:26 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-11-11 00:30:26 -0200
commitc8c013a4e9a6e051b96632e00ca0ef9d8dbd0204 (patch)
tree1ee7f7480ef57c667a528ab1a480125a7f394ba2
parentae81b5792157b0e9828dec0264c906f65159c47e (diff)
downloadhydra-c8c013a4e9a6e051b96632e00ca0ef9d8dbd0204.tar.gz
hydra-c8c013a4e9a6e051b96632e00ca0ef9d8dbd0204.tar.bz2
Detecting puppet repository
-rwxr-xr-xshare/hydra/register12
1 files changed, 11 insertions, 1 deletions
diff --git a/share/hydra/register b/share/hydra/register
index 677a73d..5ef0a9d 100755
--- a/share/hydra/register
+++ b/share/hydra/register
@@ -4,6 +4,7 @@
#
CONFIG="$HOME/.hydra/config"
+PREFERENCES="$HOME/.hydra/$HYDRA"
BASEDIR="$1"
if [ -z "$BASEDIR" ]; then
@@ -15,12 +16,21 @@ elif grep -q -e "^$HYDRA=" $CONFIG &> /dev/null; then
fi
# Folder setup
-#PUPPET="$(dirname `find $BASEDIR -name puppet.conf`)"
mkdir -p `dirname $CONFIG`
# Reparse basedir to force absolute folder
BASEDIR="`cd $BASEDIR && pwd`"
# Add entry
+echo "Registering hydra $HYDRA..."
chmod 700 $BASEDIR
echo "$HYDRA=\"$BASEDIR\"" >> $CONFIG
+
+# Puppet configuration
+echo "Searching for a puppet repository at $BASEDIR..."
+PUPPET="$(dirname `find $BASEDIR -name puppet.conf | tail -n 1`)"
+
+if [ ! -z "$PUPPET" ]; then
+ echo "Found puppet repository at $PUPPET."
+ echo "PUPPET=$PUPPET" >> $PREFERENCES
+fi