Skip to content

Instantly share code, notes, and snippets.

@calum-github
Created November 3, 2015 22:37
Show Gist options
  • Select an option

  • Save calum-github/4b687e8a5103e4024f56 to your computer and use it in GitHub Desktop.

Select an option

Save calum-github/4b687e8a5103e4024f56 to your computer and use it in GitHub Desktop.
ACNBI script
#!/bin/bash
######################################################################################
# #
# Author: Calum Hunter #
# Date: 27/10/2015 #
# Version: 0.7 #
# Purpose: Script to clean up an AutoCasperNBI for use with DEC Strapper. #
# #
# #
######################################################################################
# Everyones favourite buddy
plistbuddy="/usr/libexec/PlistBuddy"
main(){
root_check
show_description
get_program_paths
check_for_ds
fix_NBImageInfo
enforce_SMB1
remove_casper_imaging_startup
kill_finder
remove_apps
remove_widgets
remove_system_library_files
remove_menu_extras
remove_dodgy_frameworks
remove_unneccesary_Agents_Daemons
finish_up
# install_additional_packages
# convert_to_sparse
}
finish_up(){
echo "*** Unmounting $nbivol"
hdiutil detach $nbivol
sleep 3
echo "*** Compacting sparseimage"
hdiutil compact $nb_folder/$nb_dmg_name
echo "*** Finishing up, renaming NetBoot.sparseimage to NetBoot.dmg"
mv $nb_folder/$nb_dmg_name $nb_folder/NetBoot.dmg
}
root_check(){
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
fi
}
remove_unneccesary_Agents_Daemons(){
echo "*** Removing unneeded LaunchAgents"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.AddressBook.abd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.AddressBook.AssistantService.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.AddressBook.SourceSync.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.AirPlayUIAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.AirPortBaseStationAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.appstoreupdateagent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.cloudfamilyrestrictionsd-mac.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.DictationIM.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.gamed.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.helpd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.icloud.fmfd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.iCloudUserNotifications.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.IMLoggingAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.java.InstallOnDemand.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.java.updateSharing.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.ManagedClientAgent.agent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.ManagedClientAgent.enrollagent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.Maps.pushdaemon.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.mdmclient.agent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.mdmclient.cloudconfig.agent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.softwareupdate_notify_agent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.TMHelperAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.TMHelperAgent.SetupOffer.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.VoiceOver.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.bluetoothUIServer.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.CalendarAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.CalendarAgentLauncher.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.Finder.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.findmymacmessenger.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.icbaccountsd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.icloud.AOSNotificationAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.icloud.AOSNotificationLoginAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.ManagedClient.agent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.ManagedClient.enrollagent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.PCIESlotCheck.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.safaridavclient.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.SafariNotificationAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.soagent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.speech.feedbackservicesserver.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.speech.recognitionserver.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.speech.speechdatainstallerd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.speech.speechsynthesisd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.speech.synthesisserver.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.ubd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.cloudd.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.cloudpaird.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.fontd.useragent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/ccom.apple.FontRegistryUIAgent.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.FontValidator.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.FontValidatorConduit.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.FontWorker.plist"
rm -rf "${nbivol}/System/Library/LaunchAgents/com.apple.notificationcenterui.plist"
echo "*** Removing unneeded LaunchDaemons"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.ManagedClient.startup.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.GameController.gamecontrollerd.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.AirPlayXPCHelper.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.backupd-auto.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.backupd.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.bluetoothaudiod.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.cmio.AppleCameraAssistant.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.cmio.AVCAssistant.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.cmio.IIDCVideoAssistant.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.cmio.VDCAssistant.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.dvdplayback.setregion.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.findmymac.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.findmymacmessenger.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.iCloudStats.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.ManagedClient.cloudconfigurationd.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.ManagedClient.enroll.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.ManagedClient.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.ManagedClient.startup"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.mbicloudsetupd.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.mdmclient.daemon.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.PCIELaneConfigTool.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.periodic-daily.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.periodic-monthly.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.periodic-weekly.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.postgres.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.printtool.daemon"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.racoon.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.remotepairtool.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.systemstats.analysis.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.systemstats.daily.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.systemstatsd.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/org.cups.cups-lpd.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/org.cups.cupsd.plist"
# rm -rf "${nbivol}/System/Library/LaunchDaemons/org.postfix.master.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/telnet.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.fontd.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.fontmover.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.FontWorker.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.icloud.findmydeviced.plist"
rm -rf "${nbivol}/System/Library/LaunchDaemons/com.apple.ocspd.plist"
}
remove_dodgy_frameworks(){
echo "*** Removing buggy frameworks"
rm -rf "${nbivol}/System/Library/PrivateFrameworks/ShareKit.framework"
echo "*** Removing ShareKit (Note: Removing this prevents Console.app from launching)"
echo "*** Removing Console.app - as its not going to work anyway"
rm -rf "${nbivol}/Applications/Utilities/Console.app"
}
show_description(){
echo "****************************************************************"
echo "* Post Processor for AutoCasperNBI to create NBI for DOE *"
echo "* *"
echo "* This script will add the extra files and applications *"
echo "* to a NBI for use in the DOE environment *"
echo "****************************************************************"
}
enforce_SMB1(){
echo "*** Enforcing SMB1 connections"
echo "[default]" >> "${nbivol}/etc/nsmb.conf"
echo "smb_neg=smb1_only" >> "${nbivol}/etc/nsmb.conf"
}
get_program_paths(){
echo ""
echo "* We need some paths first. Please provide the path"
echo "* to the AutoCasperNBI.nbi folder. "
read nb_folder
echo ""
echo "Your AutoCasperNBI.nbi path is $nb_folder"
echo ""
echo "Assuming your NetBoot dmg is named NetBoot.dmg"
echo "Is this correct? [y/n]"
read nb_dmg_name_correct
if [ $nb_dmg_name_correct = "n" ];
then
echo "Please give me the name of your netboot disk image"
read nb_dmg_name
else
nb_dmg_name="NetBoot.dmg"
fi
echo "* Please give me the location to the DeployStudio DMG"
read ds_dmg
echo "* Please give me the location to the DS Server Plist package"
read ds_plist_pkg
echo "* Please give me the location to the Base Fonts package"
read base_fonts_pkg
echo "* Fixing the permissions on the NBI Folder"
chmod -R g+w "$nb_folder"
echo "* Mounting the DeployStudio DMG"
hdiutil attach "$ds_dmg"
echo "* Getting mount point for DS DMG"
ds_mount_point=`mount | grep DeployStudio | awk '{print $3}'`
echo "* Found mount point at: $ds_mount_point"
echo "* Finding DS installer pkg"
ds_server_pkg=`ls $ds_mount_point | grep .mpkg`
echo "* - Found DS installer pkg at: " "${ds_mount_point}/${ds_server_pkg}"
echo "* Renaming your DMG so it mounts as RW (sparseimage)"
mv $nb_folder/$nb_dmg_name $nb_folder/NetBoot.sparseimage
nb_dmg_name="NetBoot.sparseimage"
echo "* Now mounting your DMG"
echo ""
nbivol=`hdiutil attach ${nb_folder}/${nb_dmg_name} | awk '/Volumes/ {print $3}'`
echo "* DMG mounted at $nbivol"
nbimageinfo="${nb_folder}/NBImageInfo.plist"
echo ""
echo "Path to NBI Image Info is $nbimageinfo"
echo ""
# echo "Please provide the path to the folder containing additional PKG's that need to be installed"
# read pkg_location
# echo ""
# echo "Found the following Packages:"
# pkgs_to_install=`ls $pkg_location`
# echo $pkgs_to_install
# echo ""
echo "- Installing DS Server mpkg to NBI DMG"
installer -verbose -pkg "${ds_mount_point}/${ds_server_pkg}" -target "$nbivol"
echo "- Installing DS Server PLIST to NBI DMG"
installer -verbose -pkg "$ds_plist_pkg" -target "$nbivol"
echo "- Unmounting deploystudio dmg"
hdiutil detach "$ds_mount_point"
echo "Ready to go. "
echo "Running Cleanup...."
echo ""
}
install_additional_packages(){
echo "*** Installing additional packages from $pkg_location"
for package in $pkgs_to_install
do
installer -dumplog -verbose -pkg "$pkg_location/$package" -target $nbivol
done
}
convert_to_sparse(){
cd $nb_folder
echo "*** Unmounting $nbivol"
hdiutil detach $nbivol
sleep 3
echo "*** Converting $nb_dmg_name to sparse image"
hdiutil convert -format UDSP $nb_dmg_name -o NetBoot.reduced.sparseimage
echo "*** Removing ${nb_dmg_name} ***"
rm ${nb_dmg_name}
echo "*** Renaming NetBoot.reduced.sparseimage to NetBoot.reduced.dmg"
mv NetBoot.reduced.sparseimage NetBoot.reduced.dmg
echo "*** Done ***"
}
fix_NBImageInfo(){
echo "*** Removing disabled systems from $nbimageinfo"
$plistbuddy -c "delete :DisabledSystemIdentifiers" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers array" $nbimageinfo
echo "*** Adding list of unsupported MacBookPro systems to $nbimageinfo"
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBookPro3,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBookPro2,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBookPro1,2" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBookPro1,1" $nbimageinfo
echo "*** Adding list of unsupported MacBook systems to $nbimageinfo"
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBook5,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBook4,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBook3,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBook2,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBook1,1" $nbimageinfo
echo "*** Adding list of unsupported MacBookAir systems to $nbimageinfo"
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacBookAir1,1" $nbimageinfo
echo "*** Adding list of unsupported Macmini systems to $nbimageinfo"
$plistbuddy -c "add :DisabledSystemIdentifiers: string Macmini3,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string Macmini2,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string Macmini1,1" $nbimageinfo
echo "*** Adding list of unsupported iMac systems to $nbimageinfo"
$plistbuddy -c "add :DisabledSystemIdentifiers: string iMac7,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string iMac6,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string iMac5,2" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string iMac5,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string iMac4,2" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string iMac4,1" $nbimageinfo
echo "*** Adding list of unsupported MacPro systems to $nbimageinfo"
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacPro3,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacPro3,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacPro2,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string MacPro1,1" $nbimageinfo
echo "*** Adding list of unsupported Xserve systems to $nbimageinfo"
$plistbuddy -c "add :DisabledSystemIdentifiers: string Xserve3,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string Xserve2,1" $nbimageinfo
$plistbuddy -c "add :DisabledSystemIdentifiers: string Xserve1,1" $nbimageinfo
}
remove_menu_extras(){
echo "*** Removing Menu Extras"
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/Bluetooth.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/TimeMachine.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/Displays.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/Eject.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/ExpressCard.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/Fax.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/HomeSync.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/iChat.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/Ink.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/IrDA.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/PPP.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/PPPoE.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/RemoteDesktop.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/Script\ Menu.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/TextInput.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/UniversalAccess.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/User.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/Volume.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/VPN.menu
rm -rf "${nbivol}"/System/Library/CoreServices/Menu\ Extras/WWAN.menu
}
remove_apps(){
echo "*** Removing uneeded extra apps"
rm -rf $nbivol/Applications/Casper\ Imaging.app
rm -rf $nbivol/Applications/Launchpad.app
rm -rf $nbivol/Applications/Safari.app
rm -rf $nbivol/Applications/TextEdit.app
rm -rf $nbivol/Applications/Utilities/Activity\ Monitor.app
rm -rf $nbivol/Applications/Utilities/Grab.app
rm -rf $nbivol/Applications/Utilities/System\ Information.app
rm -rf $nbivol/Applications/Utilities/Keychain\ Access.app
}
remove_casper_imaging_startup(){
echo "*** Removing LaunchAgent for Casper Imaging startup"
rm $nbivol/Library/LaunchAgents/com.AutoCasperNBI.CasperImaging.plist
}
check_for_ds(){
if [ ! -d "${nbivol}/Applications/Utilities/DeployStudio Admin.app" ]; then
echo "*******************************************************************************************"
echo "* WARNING!!! *"
echo "* DeployStudio Server does not appear to be installed on the NBI! *"
echo "* *"
echo "* Please install the latest version of DeployStudio on the NBI! *"
echo "* Once your finished installing make sure to UNMOUNT the DMG and re-run this script *"
echo "*******************************************************************************************"
exit 0
fi
}
kill_finder(){
echo "*** Removing Finder to prevent those pesky kids getting access to the file system "
rm -rf $nbivol/System/Library/CoreServices/Finder.app
}
remove_system_library_files(){
echo "*** Removing unneeded files from system library"
rm -rf $nbivol/System/Library/CoreServices/Setup\ Assistant.app
rm -rf $nbivol/System/Library/CoreServices/Certificate\ Assistant.app
rm -rf $nbivol/System/Library/CoreServices/Network\ Setup\ Assistant.app
rm -rf $nbivol/System/Library/CoreServices/ManagedClient.app
rm -rf $nbivol/System/Library/CoreServices/Network\ Diagnostics.app
rm -rf $nbivol/System/Library/CoreServices/Install\ Command\ Line\ Developer\ Tools.app
rm -rf $nbivol/System/Library/CoreServices/AddPrinter.app
rm -rf $nbivol/System/Library/CoreServices/Applications/Directory\ Utility.app
rm -rf $nbivol/System/Library/CoreServices/Applications/Feedback\ Assistant.app
rm -rf $nbivol/System/Library/CoreServices/Applications/RAID\ Utility.app
rm -rf $nbivol/System/Library/CoreServices/Applications/System\ Image\ Utility.app
rm -rf $nbivol/System/Library/CoreServices/Applications/Screen\ Sharing.app
rm -rf $nbivol/System/Library/CoreServices/Applications/Wireless\ Diagnostics.app
rm -rf $nbivol/System/Library/CoreServices/AppleScript\ Utility.app
rm -rf $nbivol/System/Library/CoreServices/Expansion\ Slot\ Utility.app
rm -rf $nbivol/System/Library/CoreServices/File\ Sync.app
rm -rf $nbivol/System/Library/CoreServices/Spotlight.app
rm -rf $nbivol/System/Library/CoreServices/Ticket\ Viewer.app
rm -rf $nbivol/System/Library/CoreServices/Voice\ Over.app
rm -rf $nbivol/System/Library/CoreServices/Photo\ Library\ Migration\ Utility.app
rm -rf $nbivol/System/Library/CoreServices/cloudphotosd.app
rm -rf $nbivol/System/Library/CoreServices/AirPort\ Base\ Station\ Agent.app
rm -rf $nbivol/System/Library/Assistant
rm -rf $nbivol/System/Library/CoreServices/Bluetooth\ Setup\ Assistant.app
rm -rf $nbivol/System/Library/CoreServices/BluetoothUIServer.app
rm -rf $nbivol/System/Library/CoreServices/CalendarFileHandler.app
rm -rf $nbivol/System/Library/CoreServices/Folder\ Actions\ Setup.app
rm -rf $nbivol/System/Library/CoreServices/HelpViewer.app
rm -rf $nbivol/System/Library/CoreServices/Notification\ Center.app
rm -rf $nbivol/System/Library/CoreServices/ODSAgent.app
rm -rf $nbivol/System/Library/CoreServices/RAWCamera.bundle
rm -rf $nbivol/System/Library/CoreServices/RAWCameraSupport.bundle
echo "*** Removing unneeded Fonts"
rm -rf $nbivol/System/Library/Fonts
echo "- Installing Base Fonts to NBI DMG"
installer -verbose -pkg "${base_fonts_pkg}" -target "$nbivol"
echo "*** Removing unneeded Input Methods"
rm -rf $nbivol/System/Library/Image\ Capture
rm -rf $nbivol/System/Library/Input\ Methods/KoreanIM.app
rm -rf $nbivol/System/Library/Input\ Methods/JapaneseIM.app
rm -rf $nbivol/System/Library/Input\ Methods/CharacterPalette.app
rm -rf $nbivol/System/Library/Input\ Methods/Switch\ Control.app
rm -rf $nbivol/System/Library/Input\ Methods/Dictation.app
echo "*** Removing unneeded Internet Account plugins"
rm -rf $nbivol/System/Library/InternetAccounts
echo "*** Removing unneeded Components"
rm -rf $nbivol/System/Library/QuickTime
echo "*** Removing unneeded Package receipts"
rm -rf $nbivol/System/Library/Receipts/com.apple.pkg.Essentials.bom
rm -rf $nbivol/System/Library/Receipts/com.apple.pkg.iTunesx.bom
echo "*** Removing unneeded .services"
rm -rf $nbivol/System/Library/Services/ImageCaptureService.app
rm -rf $nbivol/System/Library/Services/Summary\ Service.app
rm -rf $nbivol/System/Library/Services/AppleSpell.service
echo "*** Removing unneeded frameworks"
rm -rf $nbivol/System/Library/Frameworks/AddressBook.framework
rm -rf $nbivol/System/Library/Frameworks/Automator.framework
rm -rf $nbivol/System/Library/Frameworks/CoreTelephony.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/PhotoLibraryPrivate.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/Slideshows.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/iLifeMediaBrowser.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/TelephonyUtilities.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/Safari.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/SystemMigration.framework
rm -rf $nbivol/System/Library/Frameworks/DVDPlayback.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/AirTrafficHost.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/CoreHandwriting.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/CoreLKSD.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/CoreLKSDMSE.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/GameCenterFoundation.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/GameCenterPrivateUIMac.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/GameCenterUI.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/MobileDevice.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/OfficeImport.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/ProKit.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/ProofReader.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/PSNormalizer.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/VideoConference.framework
rm -rf $nbivol/System/Library/PrivateFrameworks/VideoProcessing.framework
echo "*** Removing unneeded prefpanes"
rm -rf $nbivol/System/Library/PreferencePanes/Network.prefPane
rm -rf $nbivol/System/Library/PreferencePanes/SharingPref.prefPane
rm -rf $nbivol/System/Library/PreferencePanes/Displays.prefPane
}
remove_widgets(){
echo "*** Removing Widgets and extras"
rm -rf $nbivol/Library/QuickLook
rm -rf $nbivol/Library/Widgets/*
rm -rf $nbivol/Library/Spotlight/*
rm -rf $nbivol/Library/Image\ Capture
rm -rf $nbivol/Library/Messages/*
}
# Run the functions defined inside the main function
main
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment