Last active
November 18, 2015 18:05
-
-
Save opshope/d020156227a4522897d2 to your computer and use it in GitHub Desktop.
Install some admin tools on our OSX workstation via autopkg
This file contains 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 | |
#enter the user to run the script as | |
user="oh" | |
sudo -s | |
if which git; then | |
echo 'git is installed' | |
else | |
#stolen from munkiinabox.sh | |
osx_vers=$(sw_vers -productVersion | awk -F "." '{print $2}') | |
cmd_line_tools_temp_file="/tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress" | |
# Installing the latest Xcode command line tools on 10.9.x or 10.10.x | |
if [[ "$osx_vers" -ge 9 ]] ; then | |
# Create the placeholder file which is checked by the softwareupdate tool | |
# before allowing the installation of the Xcode command line tools. | |
touch "$cmd_line_tools_temp_file" | |
# Find the last listed update in the Software Update feed with "Command Line Tools" in the name | |
cmd_line_tools=$(softwareupdate -l | awk '/\*\ Command Line Tools/ { $1=$1;print }' | tail -1 | sed 's/^[[ \t]]*//;s/[[ \t]]*$//;s/*//' | cut -c 2-) | |
#Install the command line tools | |
softwareupdate -i "$cmd_line_tools" -v | |
# Remove the temp file | |
if [[ -f "$cmd_line_tools_temp_file" ]]; then | |
rm "$cmd_line_tools_temp_file" | |
fi | |
fi | |
fi | |
AUTOPKG_LATEST=$(curl https://api.github.com/repos/autopkg/autopkg/releases | python -c 'import json,sys;obj=json.load(sys.stdin);print obj[0]["assets"][0]["browser_download_url"]') | |
curl -L "${AUTOPKG_LATEST}" -o autopkg-latest1.pkg | |
sudo installer -pkg autopkg-latest1.pkg -target / | |
${LOGGER} "AutoPkg Installed" | |
echo "AutoPkg Installed" | |
#add relevant repos | |
su - "$user" -c "/usr/local/bin/autopkg repo-add joshua-d-miller-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add gregneagle-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add hansen-m-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add wardsparadox-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add rtrouton-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add hjuutilainen-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add homebysix-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add jleggat-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add keeleysam-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add grahamgilbert-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add jessepeterson-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add cgerke-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add jaharmi-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add triti-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add timsutton-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add jps3-recipes" | |
su - "$user" -c "/usr/local/bin/autopkg repo-add golbiga-recipes" | |
#install our admin tools | |
su - "$user" -c "/usr/local/bin/autopkg install DeployStudioAdmin MunkiAdmin Atom CreateUserPkg AutoDMG Iceberg Packages SuspiciousPackageQLP LaunchControl SourceTree TeamViewer" | |
su - "$user" -c "cd /Users/$user/Documents; git clone https://github.com/timsutton/mcxToProfile.git" | |
#install homebrew | |
su - "$user" -c 'ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"' | |
#update rsync | |
su - "$user" -c "/usr/local/bin/brew install https://raw.github.com/Homebrew/homebrew-dupes/master/rsync.rb" | |
su - "$user" -c "/usr/local/bin/brew install ssh-copy-id" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment