Skip to content

Instantly share code, notes, and snippets.

@adamchilcott
Last active February 24, 2021 05:20
Show Gist options
  • Save adamchilcott/0a4c2b3b0386552db6066fdc41a70ea8 to your computer and use it in GitHub Desktop.
Save adamchilcott/0a4c2b3b0386552db6066fdc41a70ea8 to your computer and use it in GitHub Desktop.
imagingTasks.sh
#!/usr/bin/env bash
##########################################
# Perform iMac Imaging Tasks Interactively
##########################################
##########################
# Enable Location Services
##########################
## Activates After Reboot
sudo /usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1
sudo /usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool true
###################
# Set Computer Name
###################
printf "Please Enter A New Computer Name e.g. IMAC-XXXX-00: "
read -r computerName
sudo scutil --set HostName "$computerName"
sudo scutil --set LocalHostName "$computerName"
sudo scutil --set ComputerName "$computerName"
dscacheutil -flushcache
#####################
# Enable Remote Login
#####################
## Enable Remote Login for Members of the Admin Group
sudo systemsetup -setremotelogin on
sudo dseditgroup com.apple.access_ssh
sudo dseditgroup -o create -q com.apple.access_ssh
sudo dseditgroup -o edit -a admin -t group com.apple.access_ssh
## Different Method to Above. Apparently Above is Depreciated
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist
##########################
# Enable Remote Management
##########################
## Enable Remote Management for Admin Users
## sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart --help
sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -users Tech -access -on -privs -all -allowAccessFor -specifiedUsers -restart -agent -menu
#####################
# Install Adobe Suite
#####################
declare tmpMountPoint='/tmp/mnt/'
declare srcLocation='aus-svr.lcgs.local/c$/ADOBE/PACKAGES'
declare dstLocation='/Users/Tech/Desktop'
printf "Please Enter Your LCGS UserName e.g. achilcott: "
read -r userName
## Create Temporary Mount Point
mkdir "$tmpMountPoint"
## Mount Remote Server
mount -t smbfs //"$userName"@"$srcLocation" "$tmpMountPoint"
## Copy Package Folder
ditto "$tmpMountPoint/ART-MAC-LCGS-2020" "$dstLocation/ART-MAC-LCGS-2020"
## Install *.pkg
sudo installer -pkg "$dstLocation/ART-MAC-LCGS-2020/Build/ART-MAC-LCGS-2020_Install.pkg" -target /
## Update All Adobe Applications
# sudo /usr/local/bin/RemoteUpdateManager --action=install
## Clean-Up
rm -f -d -r "$dstLocation/ART-MAC-LCGS-2020"
sleep .5
umount -f "$tmpMountPoint"
#############
# START NOTES
#############
## NOTE: This Script Assumes The Device is Already Pre-Enrolled In Apple School Manager
## Reference:
## <https://gist.github.com/adamchilcott/736bcfa77146e8bff100c9d4ac6da332>
## <https://apple.stackexchange.com/questions/287760/set-the-hostname-computer-name-for-macos>
## <https://apple.stackexchange.com/questions/278744/command-line-enable-remote-login-and-remote-management>
# 2-clause license ("Simplified BSD License" or "FreeBSD License")
#
# Copyright © 2019, Adam Brian Chilcott
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# The views and conclusions contained in the software and documentation are those
# of the authors and should not be interpreted as representing official policies,
# either expressed or implied, of the FreeBSD Project.
###########
# END NOTES
###########
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment