Created
October 18, 2017 15:18
-
-
Save hrhnick/d0ca81041749331a6eed3f7f87026e1a to your computer and use it in GitHub Desktop.
Mac setup script..
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
#!/bin/bash | |
## A Mac Setup Script by Nicholas Bonczyk | |
## v. 0.1 | |
#### | |
## Clear terminal screen | |
#### | |
clear | |
#### | |
## Check to see if user is root | |
#### | |
if [ "$EUID" -ne 0 ] | |
then printf "This script must be run as root. Use sudo." | |
printf " \n" | |
exit | |
fi | |
#### | |
## Present Welcome Banner | |
#### | |
printf " # # # # \n" | |
printf " # # ## ## ## #### #### \n" | |
printf " # # # # # # # # # # \n" | |
printf " # # # # # # # #### #### \n" | |
printf " # # # # ###### # # \n" | |
printf " # # # # # # # # # # \n" | |
printf " ##### # # # # #### #### \n" | |
printf " \n" | |
printf " Welcome to the UMass Mac Setup Utility! \n" | |
printf " Written by Nicholas Bonczyk. \n" | |
printf " This is pre-release software, please double check all data input. \n" | |
printf " You must be connected to a UMMS network for the setup to work. \n" | |
printf " You must be turn on FileVault and enable McAfee Threat Protection manually. \n" | |
printf " After those two manual steps, restart the computer. \n" | |
printf " \n" | |
printf " \n" | |
printf " \n" | |
#### | |
## Get user credentials and connect to install folder | |
#### | |
printf "Enter your NT username and press [ENTER]: \n" | |
read un | |
printf "Creating mount point... \n" | |
mkdir -p ~/.mount | |
mount -t smbfs smb://[email protected]/bonczykn$/Install ~/.mount | |
#### | |
## Clear terminal screen | |
### | |
clear | |
#### | |
## Get user input for computer name | |
#### | |
printf "Enter the three letter building code and press [ENTER]: \n" | |
read building | |
printf "Enter the single floor number and press [ENTER]: \n" | |
read floor | |
printf "Enter the four character office number and press [ENTER]: \n" | |
read office | |
printf "Enter L for Laptop or D for Desktop and [ENTER]: \n" | |
read hardware | |
printf "Enter the last five of the asset tag, if not UMMS owned, use the last five of the serial, and press [ENTER]: \n" | |
read tag | |
#### | |
## Combine variables | |
#### | |
os=M | |
computername=$building$floor$office$hardware$os$tag | |
#### | |
## Sets computer name | |
#### | |
printf "The computer will be renamed to: \n" | |
printf $computername \n | |
printf " \n" | |
scutil --set ComputerName $computername | |
scutil --set HostName $computername | |
scutil --set LocalHostName $computername | |
defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $computername | |
#### | |
## Package Process | |
#### | |
printf "Copying and installing packages to local machine, this may take a while... \n" | |
printf "Copying Microsoft Office from Network... \n" | |
cp ~/.mount/Packages/Microsoft\ Office\ 2016\ Installer.pkg ~/Desktop/Microsoft\ Office\ 2016\ Installer.pkg | |
cp ~/.mount/Packages/Microsoft\ Office\ 2016\ Serializer.pkg ~/Desktop/Microsoft\ Office\ 2016\ Serializer.pkg | |
printf "Installing Microsoft Office... \n" | |
installer -pkg ~/Desktop/Microsoft\ Office\ 2016\ Installer.pkg -target / | |
installer -pkg ~/Desktop/Microsoft\ Office\ 2016\ Serializer.pkg -target / | |
rm ~/Desktop/Microsoft\ Office\ 2016\ Installer.pkg | |
rm ~/Desktop/Microsoft\ Office\ 2016\ Serializer.pkg | |
printf "Copying McAfee Antivirus from Network... \n" | |
cp ~/.mount/Packages/McAfee\ Agent\ Inataller\ Step\ 1.pkg ~/Desktop/McAfee\ Agent\ Inataller\ Step\ 1.pkg | |
cp ~/.mount/Packages/McAfee\ Endpoint\ Installer\ Step\ 2.pkg ~/Desktop/McAfee\ Endpoint\ Installer\ Step\ 2.pkg | |
printf "Installing McAfee Antivirus... \n" | |
installer -pkg ~/Desktop/McAfee\ Agent\ Inataller\ Step\ 1.pkg -target / | |
installer -pkg ~/Desktop/McAfee\ Endpoint\ Installer\ Step\ 2.pkg -target / | |
rm ~/Desktop/McAfee\ Agent\ Inataller\ Step\ 1.pkg | |
rm ~/Desktop/McAfee\ Endpoint\ Installer\ Step\ 2.pkg | |
printf "Copying Dock Utility from Network... \n" | |
cp ~/.mount/Packages/DockUtil.pkg ~/Desktop/DockUtil.pkg | |
printf "Installing Dock Utility... \n" | |
installer -pkg ~/Desktop/DockUtil.pkg -target / | |
rm ~/Desktop/DockUtil.pkg | |
printf "Copying The Unarchiver from Network... \n" | |
cp ~/.mount/Packages/TheUnarchiver.zip ~/Desktop/TheUnarchiver.zip | |
printf "Installing The Unarchvier... \n" | |
unzip ~/Desktop/TheUnarchiver.zip -d ~/Desktop | |
mv ~/Desktop/The\ Unarchiver.app /Applications | |
rm ~/Desktop/TheUnarchiver.zip | |
printf "Copying Casper Enroller from Network... \n" | |
cp ~/.mount/Packages/QuickAdd.pkg ~/Desktop/QuickAdd.pkg | |
printf "Delaying Casper enrollment until end... \n" | |
printf "Copying misc files from Network... \n" | |
cp ~/.mount/Misc/Mapping\ a\ Network\ Drive.pdf ~/Desktop/Mapping\ a\ Network\ Drive.pdf | |
cp ~/.mount/Misc/Wallpaper1.jpg ~/Pictures/Wallpaper1.jpg | |
cp ~/.mount/Misc/Wallpaper2.jpg ~/Pictures/Wallpaper2.jpg | |
cp ~/.mount/Misc/UserIcon.tif ~/Pictures/UserIcon.tif | |
printf "Copying Google Chrome from Internet... \n" | |
curl -L -O "https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg" | |
printf "Installing Google Chrome... \n" | |
hdiutil mount -nobrowse googlechrome.dmg | |
cp -R "/Volumes/Google Chrome/Google Chrome.app" /Applications | |
hdiutil unmount "/Volumes/Google Chrome" | |
rm googlechrome.dmg | |
#### | |
## Set wallpaper | |
#### | |
printf "Setting wallpaper... \n" | |
sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '~/Pictures/Wallpaper1.jpg'" | |
killall Dock | |
#### | |
## Set user picture NOT WORKING | |
#### | |
# dscl . delete /Users/$USER jpegphoto | |
# dscl . delete /Users/$USER Picture | |
# dscl . create /Users/$USER Picture "~/Pictures/UserLogo.tif" | |
# kextcache -system-caches | |
#### | |
## System Tweaks | |
#### | |
printf "Expanding save panel by default \n" | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true | |
printf "Expanding print panel by default \n" | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true | |
printf "Saving to disk by default \n" | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
printf "Setting printer app to auto quit the print jobs complete \n" | |
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true | |
printf "Enabling right click on Magic Mouse \n" | |
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode TwoButton | |
printf "Showing file extensions by default \n" | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
printf "Restarting Finder..." | |
killall Finder | |
#### | |
## Enabling Remote Access | |
#### | |
printf "Turning on Remote Login... \n" | |
systemsetup -setremotelogin on | |
printf "Turning on Remote Management... \n" | |
/System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -off -restart -agent -privs -all -allowAccessFor -allUsers | |
#### | |
## Installs software updates | |
#### | |
softwareupdate --install --all | |
#### | |
## Enrolls in Casper | |
#### | |
printf "Final Steps... Enrolling in Casper... \n" | |
installer -pkg ~/Desktop/QuickAdd.pkg -target / | |
rm ~/Desktop/QuickAdd.pkg | |
#### | |
## Update Dock Icons | |
#### | |
dockutil --add "/Applications/Microsoft Word.app" --before 'iTunes' --no-restart | |
dockutil --add "/Applications/Microsoft Excel.app" --before 'iTunes' --no-restart | |
dockutil --add "/Applications/Microsoft Powerpoint.app" --before 'iTunes' --no-restart | |
dockutil --add "/Applications/Microsoft OneNote.app" --before 'iTunes' --no-restart | |
dockutil --add "/Applications/Microsoft Outlook.app" --before 'iTunes' --no-restart | |
dockutil --add "/Applications/Self Service.app" --after 'System Preferences' --no-restart | |
dockutil --add "/Applications/Google Chrome.app" --after 'Safari' | |
#### | |
## Exit | |
#### | |
clear | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment