Skip to content

Instantly share code, notes, and snippets.

@armcknight
Last active October 7, 2015 15:36
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 armcknight/9f7c145f849ac276e156 to your computer and use it in GitHub Desktop.
Save armcknight/9f7c145f849ac276e156 to your computer and use it in GitHub Desktop.
Broad remote deployment of Xcode using DSH
#!/bin/sh
#
# deploy_xcode.sh
#
# Created by Andrew McKnight on 9/24/15.
#
# takes a local copy of a downloaded Xcode .dmg and install_xcode.sh and copies them to a collection of remote machines, and runs the install script on each
#
DSH_GROUP_NAME="${1}"
PATH_TO_XCODE_DMG="${2}"
PATH_TO_INSTALL_XCODE_SCRIPT="${3}"
XCODE_APP_BUNDLE_NAME="${4}"
# if no custom name for the final installed Xcode app bundle is provided, default to Xcode.app
if [[ -z $"{XCODE_APP_BUNDLE_NAME}" ]]; then
XCODE_APP_BUNDLE_NAME="Xcode.app"
fi
REMOTE_DMG_PATH="~/Downloads/new-xcode.dmg"
REMOTE_SCRIPT_PATH="~/Desktop/install_xcode.sh"
# copy DMG and install script to each remote machine
for machine in $(<~/.dsh/group/"${DSH_GROUP_NAME}"); do
scp -p "${PATH_TO_XCODE_DMG}" "${machine}:${REMOTE_DMG_PATH}"
scp -p "${PATH_TO_INSTALL_XCODE_SCRIPT}" "${machine}:${REMOTE_SCRIPT_PATH}"
done
# invoke install script on all machines concurrently
dsh -Mcg "${DSH_GROUP_NAME}" "${REMOTE_SCRIPT_PATH} ${REMOTE_DMG_PATH} Xcode.app"
@armcknight
Copy link
Author

@armcknight
Copy link
Author

Must have dancer's shell installed brew install dsh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment