aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/copymodules9
-rwxr-xr-xbin/mrconfig4
-rwxr-xr-xbin/submodules13
-rwxr-xr-xbin/subtrees15
-rwxr-xr-xbin/symlinks9
-rwxr-xr-xbin/syncmodules9
6 files changed, 47 insertions, 12 deletions
diff --git a/bin/copymodules b/bin/copymodules
index 85f7499..ab5b405 100755
--- a/bin/copymodules
+++ b/bin/copymodules
@@ -15,6 +15,13 @@ elif [ ! -e "$MODULES" ]; then
echo "Not found: $MODULES"
fi
+# Set puppet folder
+if [ -d "puppet" ]; then
+ PUPPET_FOLDER="puppet"
+else
+ PUPPET_FOLDER="."
+fi
+
# Add module symlinks using absolute folders
for module in `ls $MODULES`; do
if [ "$module" == "bootstrap" ]; then
@@ -26,5 +33,5 @@ for module in `ls $MODULES`; do
fi
path="`cd $MODULES/$module && pwd`"
- ( cd modules &> /dev/null && cp -r $path . )
+ ( cd $PUPPET_FOLDER/modules &> /dev/null && cp -r $path . )
done
diff --git a/bin/mrconfig b/bin/mrconfig
index 48815c1..2d245f8 100755
--- a/bin/mrconfig
+++ b/bin/mrconfig
@@ -11,8 +11,8 @@ WORK="`dirname $0`/.."
# Create a new config
cd $WORK
-rm -f .mrconfig
-touch .mrconfig
+rm -f $WORK/.mrconfig
+touch $WORK/.mrconfig
# Fetch repository list and updtate mrconfig
curl --stderr - $URL | grep "^puppet-" | cut -d ' ' -f 1 | sed -e 's/\.git$//' | while read module; do
diff --git a/bin/submodules b/bin/submodules
index 3abc46d..960d290 100755
--- a/bin/submodules
+++ b/bin/submodules
@@ -12,18 +12,25 @@ function usage {
exit $2
}
+# Set puppet folder
+if [ -d "puppet" ]; then
+ PUPPET_FOLDER="puppet"
+else
+ PUPPET_FOLDER="."
+fi
+
# Get module list
repos="`grep = $DIRNAME/../.mrconfig | cut -d = -f 2 | cut -d ' ' -f 4`"
# Add submodules
for repo in $repos; do
module="`basename $repo .git | sed -e s/^puppet-//`"
- if [ ! -d "modules/$module" ]; then
+ if [ ! -d "$PUPPET_FOLDER/modules/$module" ]; then
echo "Processing puppet module $module..."
- git submodule add -f $repo modules/$module
+ git submodule add -f $repo $PUPPET_FOLDER/modules/$module
elif [ -e "modules/$module/.git" ]; then
# The puppet module exists and is a git submodule, so update it
- ( cd module/$module && git pull origin master )
+ ( cd $PUPPET_FOLDER/modules/$module && git pull origin master )
fi
done
diff --git a/bin/subtrees b/bin/subtrees
index 1858a48..19211f1 100755
--- a/bin/subtrees
+++ b/bin/subtrees
@@ -18,24 +18,31 @@ if ! which git-subtree &> /dev/null; then
exit 1
fi
+# Set puppet folder
+if [ -d "puppet" ]; then
+ PUPPET_FOLDER="puppet"
+else
+ PUPPET_FOLDER="."
+fi
+
# Get module list
repos="`grep = $DIRNAME/../.mrconfig | cut -d = -f 2 | cut -d ' ' -f 4`"
# Add subtrees
for repo in $repos; do
module="`basename $repo .git | sed -e s/^puppet-//`"
- if [ ! -d "modules/$module" ]; then
+ if [ ! -d "$PUPPET_FOLDER/modules/$module" ]; then
echo "Processing puppet module $module..."
git remote add $module $repo
- git subtree add --prefix modules/$module $module master --squash
+ git subtree add --prefix $PUPPET_FOLDER/modules/$module $module master --squash
elif [ ! -d "modules/$module/.git" ]; then
# The puppet module exists and is a subtree, so update it
if ! git remote | grep -qe "^$module$"; then
- git remote add $module $repo
+ git remote add $module $repo
fi
# Update subtrees
git fetch $module master
- git subtree pull --prefix modules/$module $module master --squash
+ git subtree pull --prefix $PUPPET_FOLDER/modules/$module $module master --squash
fi
done
diff --git a/bin/symlinks b/bin/symlinks
index c331261..a2f27cf 100755
--- a/bin/symlinks
+++ b/bin/symlinks
@@ -15,6 +15,13 @@ elif [ ! -e "$MODULES" ]; then
echo "Not found: $MODULES"
fi
+# Set puppet folder
+if [ -d "puppet" ]; then
+ PUPPET_FOLDER="puppet"
+else
+ PUPPET_FOLDER="."
+fi
+
# Add module symlinks using absolute folders
for module in `ls $MODULES`; do
if [ "$module" == "bootstrap" ]; then
@@ -26,5 +33,5 @@ for module in `ls $MODULES`; do
fi
path="`cd $MODULES/$module && pwd`"
- ( cd modules &> /dev/null && ln -sf $path )
+ ( cd $PUPPET_FOLDER/modules &> /dev/null && ln -sf $path )
done
diff --git a/bin/syncmodules b/bin/syncmodules
index 1f5dd07..1585aa4 100755
--- a/bin/syncmodules
+++ b/bin/syncmodules
@@ -15,6 +15,13 @@ elif [ ! -e "$MODULES" ]; then
echo "Not found: $MODULES"
fi
+# Set puppet folder
+if [ -d "puppet" ]; then
+ PUPPET_FOLDER="puppet"
+else
+ PUPPET_FOLDER="."
+fi
+
# Add module symlinks using absolute folders
for module in `ls $MODULES`; do
if [ "$module" == "bootstrap" ]; then
@@ -26,5 +33,5 @@ for module in `ls $MODULES`; do
fi
path="`cd $MODULES/$module && pwd`"
- ( cd modules &> /dev/null && rsync -av --delete $path/ $module/ )
+ ( cd $PUPPET_FOLDER/modules &> /dev/null && rsync -av --delete $path/ $module/ )
done