Skip to content

Instantly share code, notes, and snippets.

@kuckmc01
Created July 18, 2017 13:55
Show Gist options
  • Save kuckmc01/310669ea74f3ed2f7dd1958f85163cd4 to your computer and use it in GitHub Desktop.
Save kuckmc01/310669ea74f3ed2f7dd1958f85163cd4 to your computer and use it in GitHub Desktop.
vlt script - a script to simplify vault downloads without using intellivault
#!/usr/bin/env bash
# Usage:
#set SAVETOPATH
# ./vltit.sh - l /content/some/path
USERNAME=admin
PASSWORD=admin
SAVETOPATH="${HOME}/matt.kuckuck/myvlt"]
HOST="http://localhost:4502"
#check that location parameter has been provided
if [[ ! $@ =~ [-l] ]]; then
echo "-l location parameter required"
exit 1
fi
#Argument handling
for i in "$@"; do
case $i in
-l)
LOCATION=$2
echo ${LOCATION}
;;
-p) #optional
PASSWORD=$2
echo ${PASSWORD}
;;
-u) #optional
USERNAME=$2
echo ${USERNAME}
;;
-s) #optional
SAVETOPATH=$2
echo ${SAVETOPATH}
;;
-h) #optional
HOST=$2
echo ${HOST}
;;
esac
shift
done
CD="cd ${SAVETOPATH}"
CMD="vlt --credentials ${USERNAME}:${PASSWORD} co ${HOST}/crx/-/jcr:root${LOCATION} --force"
echo "Running '${CMD}' in ${SAVETOPATH}"
${CD}
${CMD}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment