Announcement: Upgrade to macOS Mojave

With features like Dark Mode, Stacks, and four new built-in apps, macOS Mojave helps you get more out of every click. 
Find out how to upgrade to macOS Mojave > https://support.apple.com/macos/mojave

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Question:

Question: First boot settings

I am trying to add a few more controls to my first boot script for setting up Macs as part of an imaging system. I have most things working but I am struggling with the following two items.


First I am trying to turn on some extra menulets as follows.


for USER_TEMPLATE in "/System/Library/User Template"/*
  do
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.bluetooth" -bool true
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.volume" -bool true
    /usr/bin/defaults write "${USER_TEMPLATE}"/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.airport" -bool true
    /usr/libexec/PlistBuddy -c "Add :menuExtras: string '/System/Library/CoreServices/Menu Extras/Bluetooth.menu'" "${USER_TEMPLATE}"/Library/Preferences/com.apple.systemuiserver.plist
    /usr/libexec/PlistBuddy -c "Add :menuExtras: string '/System/Library/CoreServices/Menu Extras/Volume.menu'" "${USER_TEMPLATE}"/Library/Preferences/com.apple.systemuiserver.plist
    /usr/libexec/PlistBuddy -c "Add :menuExtras: string '/System/Library/CoreServices/Menu Extras/AirPort.menu'" "${USER_TEMPLATE}"/Library/Preferences/com.apple.systemuiserver.plist
done


The /usr/bin/defaults commands work but not the PlistBuddy ones although the the same PlistBuddy commands do work if run after first boot.


Note: I have another similar section in the script to apply the above to any existing user home directories, as below.


for USER_HOME in /Users/*
  do
  USER_UID=`basename "${USER_HOME}"`
  if [ ! "${USER_UID}" = "Shared" ]
  then
  if [ ! -d "${USER_HOME}"/Library/Preferences ]
  then
  mkdir -p "${USER_HOME}"/Library/Preferences
  chown "${USER_UID}" "${USER_HOME}"/Library
  chown "${USER_UID}" "${USER_HOME}"/Library/Preferences
  fi
  if [ -d "${USER_HOME}"/Library/Preferences ]
  then
    /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.bluetooth" -bool true
    /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.volume" -bool true
    /usr/bin/defaults write "${USER_HOME}"/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.airport" -bool true
    /usr/libexec/PlistBuddy -c "Add :menuExtras: string '/System/Library/CoreServices/Menu Extras/Bluetooth.menu'" "${USER_HOME}"/Library/Preferences/com.apple.systemuiserver.plist
    /usr/libexec/PlistBuddy -c "Add :menuExtras: string '/System/Library/CoreServices/Menu Extras/Volume.menu'" "${USER_HOME}"/Library/Preferences/com.apple.systemuiserver.plist
    /usr/libexec/PlistBuddy -c "Add :menuExtras: string '/System/Library/CoreServices/Menu Extras/AirPort.menu'" "${USER_HOME}"/Library/Preferences/com.apple.systemuiserver.plist
    chown "${USER_UID}" "${USER_HOME}"/Library/Preferences/com.*.plist 
  fi
done


I am also trying to set the TrackPad/MagicMouse to turn on Right-Click and in the case of the TrackPad to use the bottom right corner for right-click this is not working at all.


The client is running Sierra 10.12.6, it is being imaged via DeployStudio. The first boot script is being run as a postponed i.e. after first boot script.

Posted on

Reply
There are no replies.
User profile for user: John Lockwood

Question: First boot settings