Created
February 6, 2020 21:47
-
-
Save jimfrenette/0b5d0e90ca9311d56bf02a3ce316570a to your computer and use it in GitHub Desktop.
spin up a AEM 6.5 instance in sibling directory
This file contains hidden or 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
#!/usr/bin/env bash | |
# the directory that contains this script | |
base=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P ) | |
cd $base | |
# param 1, specify port (optional) | |
if [ "$1" != "" ]; then | |
PORT=$1 | |
echo "Installing for author on port $PORT" | |
else | |
PORT=4502 | |
echo "Installing for default author port 4502" | |
fi | |
# look for Quickstart.rar or Quickstart.jar asset to install | |
JAR=AEM_6.5_Quickstart.jar | |
RAR=AEM_6.5_Quickstart.rar | |
if test -f "$JAR"; then | |
echo $JAR " exists" | |
else | |
echo "extract $RAR ..." | |
unrar x $RAR | |
fi | |
AUTHOR="6_5/author" | |
LRAR=license.rar | |
LPROP=license.properties | |
if test -f "$JAR"; then | |
# parent dir of $base | |
cd ../ | |
if [ -d $AUTHOR/crx-quickstart ]; then | |
# confirm | |
read -p "remove existing $AUTHOR/crx-quickstart instance ? [y/n] " cont | |
case "$cont" in | |
y|Y ) | |
rm -rf $AUTHOR/crx-quickstart | |
;; | |
* ) | |
exit 0 | |
;; | |
esac | |
else | |
mkdir -p $AUTHOR | |
fi | |
if test -f "$base/$LPROP"; then | |
cp $base/$LPROP $AUTHOR/ | |
elif test -f "$base/$LRAR"; then | |
cd $base | |
unrar x $LRAR | |
cd ../ | |
cp $base/$LPROP $AUTHOR/ | |
fi | |
cp $base/$JAR $AUTHOR/ | |
mv $AUTHOR/$JAR $AUTHOR/cq5-author-p$PORT.jar | |
cd $AUTHOR | |
java -jar cq5-author-p$PORT.jar -unpack | |
cd $base | |
cd ../ | |
# confirm | |
if [ -d $AUTHOR/crx-quickstart/bin ]; then | |
read -p "start $AUTHOR instance ? [y/n] " cont | |
case "$cont" in | |
y|Y ) | |
cd crx-quickstart/bin | |
./start | |
;; | |
* ) | |
exit 0 | |
;; | |
esac | |
else | |
echo "[ERROR] $AUTHOR/crx-quickstart/bin/start not found" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment