summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-08-10 13:20:35 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-08-10 13:20:35 -0300
commite5862beed7d368b548db97be3f6627804ba90519 (patch)
treea1c553044b11fc80f77d0c0219cfd008da8ba811
parent683c19ba6468926f7e5fa354cb0c75c2900250cb (diff)
downloadhydra-e5862beed7d368b548db97be3f6627804ba90519.tar.gz
hydra-e5862beed7d368b548db97be3f6627804ba90519.tar.bz2
Doing module-verify on module-update
-rwxr-xr-xshare/hydra/module-update8
-rwxr-xr-xshare/hydra/module-verify4
2 files changed, 10 insertions, 2 deletions
diff --git a/share/hydra/module-update b/share/hydra/module-update
index 3887bd2..ac19b57 100755
--- a/share/hydra/module-update
+++ b/share/hydra/module-update
@@ -21,4 +21,12 @@ fi
# Update the module
( cd $PUPPET/modules/$MODULE; git pull origin master )
+
+# Verify the module
+if ! hydra $HYDRA module-verify $MODULE; then
+ echo "ERROR: Updated module doesn't match hash, please verify and update manually."
+ exit 1
+fi
+
+# Commit
( cd $PUPPET; git commit -a -m "Updating module $MODULE"; git push )
diff --git a/share/hydra/module-verify b/share/hydra/module-verify
index 81afbfe..5a4d164 100755
--- a/share/hydra/module-verify
+++ b/share/hydra/module-verify
@@ -17,11 +17,11 @@ elif [ -z "$HYDRA_FOLDER" ] || [ ! -e "$HYDRA_FOLDER/modules" ]; then
fi
cd $PUPPET
-HASH_SUBMODULE="`git submodule | grep "modules/$MODULE " | awk '{ print $1 }'`"
+HASH_SUBMODULE="`git submodule | grep "modules/$MODULE " | awk '{ print $1 }' | sed -e 's/\+//'`"
cd $HYDRA_FOLDER/modules/$MODULE
-HASH_MODULE="`git log -1 | grep "^commit" | awk '{ print $2 }'`"
+HASH_MODULE="`git log -1 | grep "^commit" | awk '{ print $2 }' | sed -e 's/\+//'`"
if [ "$HASH_MODULE" != "$HASH_SUBMODULE" ]; then
echo "Module $MODULE: hash differ!!:"