summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-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