From fc08d8d4e96fb638e3ac8c2a50c973322c278d84 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 26 Oct 2015 14:08:14 -0200 Subject: Deploy: apply patches before deployment --- bin/deploy | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'bin') diff --git a/bin/deploy b/bin/deploy index 8d296e9..22e3ea8 100755 --- a/bin/deploy +++ b/bin/deploy @@ -33,6 +33,29 @@ for package in $DEPLOY_DEPENDENCIES; do provision_package $package done +# Parameters that needed dependencies installed +DIST="`facter lsbdistcodename`" + +# Apply patches +if [ -d "$BASEDIR/puppet/files/patches/$DIST" ]; then + ( + # Patches should be generated relativelly to the root folder + cd / + + # Only apply if needed + # Thanks https://unix.stackexchange.com/questions/55780/check-if-a-file-or-folder-has-been-patched-already + for patch in `ls $BASEDIR/puppet/files/patches/$DIST`; do + patch -p0 -N --dry-run --silent < $patch 2> /dev/null + # If the patch has not been applied then the $? which is the exit status + # for last command would have a success status code = 0 + if [ "$?" == "0" ]; then + # Apply the patch + patch -p0 -N < $patch + fi + done + ) +fi + # Run puppet apply PUPPET_OPTS="--confdir=$BASEDIR/puppet --modulepath=$BASEDIR/puppet/modules" $SUDO LC_ALL=C puppet apply $PUPPET_OPTS $PUPPET_MANIFEST" -- cgit v1.2.3