Skip to content

Instantly share code, notes, and snippets.

@knennigtri
Created July 1, 2016 21:41
Show Gist options
  • Save knennigtri/458236f87c68e0770850c086fde40505 to your computer and use it in GitHub Desktop.
Save knennigtri/458236f87c68e0770850c086fde40505 to your computer and use it in GitHub Desktop.
Upload and Install a content package via cURL
##
# This is a script to upload and install a list of packages to an AEM server. All Packages
# must be located in PACKAGE_LOCATION and then listed in the PACKAGES array. The package
# file name must be the same as the package name.
#
# Author:
# knennig213@gmail.com
# o--o
# Version 1.0.2
#
##
# Server information
SERVER_URL='http://localhost:4502'
S_USER='admin'
S_PASS='admin'
# Location for all packages
PACKAGE_LOCATION='packages/'
# Location for all curl responses
LOGS_LOCATION='logs/'
# package manager curl configs
INSTALL_PACKAGE=true
FORCE_INSTALL=true
##
# The package name and the zip file have to be the exact same.
# ex: name='tags-reset' .zip='tags-reset.zip'
#
# If you want/need to return /content to the original state, you need to
# uncomment out all-the-content-reset and update the indexes
##
#A list of content packages to install. Do no include ".zip".
PACKAGES[0]="<package-name>"
PACKAGES[1]="<package-name>"
PACKAGES[2]="<package-name>"
PACKAGES[3]="<package-name>"
# Upload and Install
for ((i = 0; i < ${#PACKAGES[@]}; i++))
do
echo "Curl command for: "${PACKAGES[i]}
curl -u ${S_USER}:${S_PASS} -F file=@${PACKAGE_LOCATION}${PACKAGES[i]}'.zip' -F name="'"${PACKAGES[i]}"'" -F force=${FORCE_INSTALL} -F install=${INSTALL_PACKAGE} ${SERVER_URL}/crx/packmgr/service.jsp > ${LOGS_LOCATION}${PACKAGES[i]}'_response.log'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment