Created
August 29, 2012 13:12
-
-
Save bmoussaud/3512269 to your computer and use it in GitHub Desktop.
Deployit: Patch an existing file during a deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "patching ${deployed.configurationFile}" | |
touch snippet.conf | |
echo "${deployed.comment} ${deployed.beginMarkup}" >> snippet.conf | |
echo "aValue ${deployed.avalue}" >> snippet.conf | |
echo "anotherValue ${deployed.anotherValue}" >> snippet.conf | |
echo "${deployed.comment} ${deployed.endMarkup}" >> snippet.conf | |
cat snippet.conf | |
cat snippet.conf >> ${deployed.configurationFile} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<type type="filex.PatchedFile" extends="generic.ExecutedScript" | |
deployable-type="filex.Resource" container-type="overthere.Host"> | |
<generate-deployable type="filex.Resource" extends="generic.Resource"/> | |
<property name="avalue" /> | |
<property name="anotherValue" /> | |
<property name="home" default="/tmp"/> | |
<property name="configurationFile" default="${deployed.home}/config.conf"/> | |
<property name="comment" hidden="true" default="#"/> | |
<property name="beginMarkup" hidden="true" default="patched by deployit"/> | |
<property name="endMarkup" hidden="true" default="/patched by deployit"/> | |
<property name="createScript" hidden="true" default="filex/patch"/> | |
<property name="destroyScript" hidden="true" default="filex/unpatch"/> | |
</type> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "unpatching ${deployed.configurationFile}" | |
sed --in-place '/${deployed.comment} ${deployed.beginMarkup}/,/${deployed.comment} \${deployed.endMarkup}/d' ${deployed.configurationFile} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment