Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
AEM Deploy Script
#!/bin/bash
#GLOBAL
HTTPRESPONSE="json"
SUCCESS="success"
#TEST
#UIARTFCT="target/package.zip"
#UILOC="./target/"
#AUTHORHOST="localhost"
#AUTHORPORT="4502"
#AUTHORPROTOCOL="http://"
#USER="someuser"
#PASSWORD="somepassword"
#VERSION="LOCAL"
#Deploy
UIARTFCT="package.zip"
UILOC="./target"
AUTHORHOST="localhost"
AUTHORPORT="4502"
AUTHORPROTOCOL="http://"
USER="someuser"
PASSWORD="somepassword"
VERSION=$(echo git rev-parse HEAD)
cd ${UILOC}
echo
echo 'Uploading Package'
UPLOAD=$(curl -u "${USER}":"${PASSWORD}" -F package=@"${UIARTFCT}" -F force=true "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/?cmd=upload")
echo $UPLOAD
if [[ $UPLOAD == *uploaded* ]]
then
echo "Upload Successful"
else
echo "Upload Unsuccessful"
exit 1
fi
echo
echo 'Installing Package:'
echo "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}?cmd=install"
INSTALL=$(curl -u "${USER}":"${PASSWORD}" -X POST "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}?cmd=install")
echo $INSTALL
if [[ $INSTALL == *installed* ]]
then
echo "Installation Successful"
else
echo "Installation Unsuccessful"
exit 1
fi
echo
echo 'Replicating Package:'
echo "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}?cmd=replicate"
REPLICATE=$(curl -u "${USER}":"${PASSWORD}" -X POST "${AUTHORPROTOCOL}${AUTHORHOST}:${AUTHORPORT}/crx/packmgr/service/.${HTTPRESPONSE}/etc/packages/${UIARTFCT}?cmd=replicate")
echo $REPLICATE
if [[ $REPLICATE == *replicated* ]]
then
echo "Replication Successful"
else
echo "Replication to Pulisher Unsuccessful"
exit 0
fi
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment