Skip to content

Instantly share code, notes, and snippets.

@noahcampbell
Created June 8, 2011 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noahcampbell/1015376 to your computer and use it in GitHub Desktop.
Save noahcampbell/1015376 to your computer and use it in GitHub Desktop.
Ctl Patch to Make it Headless
#!/bin/bash
PROJECT=${1:-demo}
NODE=${2:-testnode}
rm -rf ctier/ Get-Properties.patch
grep /opt/ctier/etc/ctierrc .bashrc || cat >> .bashrc <<-'EOF'
export CTL_BASE=$HOME/ctier/ctl
if [ -f /opt/ctier/etc/ctierrc ]; then
. /opt/ctier/etc/ctierrc
else
echo /opt/ctier/etc/ctierrc not found 1>&2
fi
EOF
cat > Get-Properties.patch <<'PropertiesPatch'
38a39,41
> <if>
> <istrue value="${framework.workbench.integration.enabled}"/>
> <then>
43a47,52
> </then>
> <else>
> <get verbose="true" src="${resource.properties.url}" dest="${opts.destfile}"/>
> </else>
> </if>
>
47a57,60
> <if>
> <istrue value="${framework.workbench.integration.enabled}"/>
> <then>
>
52a66,71
> </then>
> <else>
> <touch mkdirs="true" file="${destfile.temp}"/>
> <get verbose="true" src="${resource.properties.url}" dest="${destfile.temp}"/>
> </else>
> </if>
>
PropertiesPatch
source .bashrc
ctl-setup --framework.ctl-project.create.buildfile=/opt/ctier/pkgs/ctl-3.6.0/lib/ant/controllers/ctl/projectsetupCmd.xml -n ${NODE} >/dev/null # reference to a node in the resources.xml
sed -i '/localhost/s/localhost/not-used-localhost/' $CTL_BASE/etc/framework.properties
sed -i "/^modules.url/s/$.context\.project./${PROJECT}/" $CTL_BASE/etc/modules.properties
sed -i "/^resource.properties.url/s/$.context\.project./${PROJECT}/" $CTL_BASE/etc/resource.properties
sed -i /framework.workbench.integration.enabled/s/true/false/ $CTL_BASE/etc/framework.properties
#sed -i 3s/INFO/DEBUG/ $CTL_BASE/etc/log4j.properties
patch -l $CTL_BASE/modules/Deployment/commands/Get-Properties.xml <Get-Properties.patch
ctl-project -p ${PROJECT} -a create
patch -l -R $CTL_BASE/projects/${PROJECT}/modules/Module/commands/Install-Module.xml <<-'PATCH'
66c66
< <get src="${opts.modulesurl}/${opts.module}-${opts.version}.jar" dest="${opts.downloaddir}/${opts.module}-${opts.version}.jar" usetimestamp="true" />
---
> <get src="${opts.modulesurl}/${opts.module}-${opts.version}.jar" dest="${opts.downloaddir}/${opts.module}-${opts.version}.jar" usetimestamp="true" username="${framework.webdav.username}" password="${framework.webdav.password}"/>
74c74
< <get src="${framework.moduleRepo.url}/${opts.module}-${opts.version}.jar" dest="${opts.downloaddir}/${opts.module}-${opts.version}.jar" usetimestamp="true" />
---
> <get src="${framework.moduleRepo.url}/${opts.module}-${opts.version}.jar" dest="${opts.downloaddir}/${opts.module}-${opts.version}.jar" usetimestamp="true" username="${framework.webdav.username}" password="${framework.webdav.password}"/>
PATCH
sed -i "/^project.*.url/s/$.context\.project./${PROJECT}/" $CTL_BASE/projects/${PROJECT}/etc/project.properties
ctl-project -p ${PROJECT} -a install
patch -l $CTL_BASE/projects/${PROJECT}/modules/Deployment/commands/Get-Properties.xml <Get-Properties.patch
ctl-project -p ${PROJECT} -a install
ctl -p demo -t JBossServer -r dukesbankDevelopment -c Packages-Install
sed -i '/username/s/.*/\/>/' ${CTL_BASE}/projects/${PROJECT}/modules/Package/bin/get.xml
ctl -p demo -t JBossServer -r dukesbankDevelopment -c Packages-Install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment