You are not logged in.

Announcement

[2017.09.08] DeployStudio build v1.7.8 (checksum, release note).
[2016.08.26] DeployStudio build v1.6.19 (release note).
[2013.02.23] DeployStudio last universal build v1.5.17 (release note).

#1 2017-12-15 15:31:56

jelockwood
Member
Registered: 2009-11-11

Couple of first boot queries

I am trying to add a few more controls to my first boot script for setting up Macs as part of my DeployStudio workflow. 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 in Terminal or even via Apple Remote Desktop Admin.

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.

Offline

#2 2017-12-18 16:41:06

jelockwood
Member
Registered: 2009-11-11

Re: Couple of first boot queries

Solved it myself,

For the PlistBuddy commands you need something like -

    /usr/libexec/PlistBuddy -c "Add menuExtras string array" "${USER_TEMPLATE}"/Library/Preferences/com.apple.systemuiserver.plist
    /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

Offline

Board footer

Powered by FluxBB