Wednesday, January 22, 2014

Files become hidden on network share

Had a colleague today that had a small rsync script that synced a local folder to a network share. Since he upgraded to OS X 10.9 all the files synced to the network share got the hidden flag set, so the files became invisible. First I thought it was rsync that made some strange things to the files, but after some testing I found out that if you mapped the network share through smb1 (cifs://) and not smb2 (smb://) the sync worked as expected!

Apples implementation of smb2 seems a bit unstable. This is not the first problem we experience with smb2 on OS X 10.9.

Friday, December 13, 2013

Deploying iLife '13 and iWork '13

Just thought I would share my experiences regarding deploying the new versions of iLife and iWork that is only available through Mac App Store (MAS).

The best way to deploy iLife and iWork '13 according to me, after quite extensive testing, is to download the MAS installer packages the same way as Rich Trouton describes here: http://derflounder.wordpress.com/2013/08/22/downloading-apples-server-app-installer-package/

BUT! If you deploy these packages, GarageBand will fail to launch. It will say that the application is damaged. The solution to this is to create an empty MAS receipt file inside GarageBand.app (mkdir GarageBand.app/Contents/_MASReceipt || touch GarageBand.app/Contents/_MASReceipt/receipt).
I've just added a script in our DeployStudio workflow that creates this file, that way we keep the installer packages unmodified.

Now to the "funny" things... 
  • MAS will not fully recognize the installed applications. It sees that the applications is installed, but shows there are updates to them, even if it's the same version that is installed.
  • If you add a dummy receipt file inside the application, MAS will not show any updates for that application, even if there are updates. I tested this with iPhoto 9.5. The latest version at the time of writing is 9.5.1. What I did was to add this dummy receipt file inside iPhoto.app, launch MAS and checked for updates. No updates available. If I searched iPhoto in MAS, it said it would cost 109 kr (SEK). If I then deleted the receipt file, suddenly an update was available in MAS for iPhoto.
  • Because of the behavior I've experienced with the dummy receipt file, MAS will most likely not show any updates for GarageBand once an update is released. And without the dummy receipt, GarageBand will fail to launch.
  • If you package the applications from your own computer, they will be tied to your Apple ID and none other than you can update them on the machines you deploy them to.

So the conclusion is this:
  1. Download and install the new iLife and iWork applications the same way Rich describes in the link above.
  2. Create the dummy receipt file inside GarageBand.app. Up to this point, users can use the apps, but not update GarageBand.
  3. To update iLife and iWork apps; go to MAS and install all the available updates, even if it's the same version as the version installed.
  4. Search MAS for GarageBand (since MAS will not list any updates for GarageBand because of the empty receipt file) and install it over the old one (MAS will ask you if you want to buy it, click "Buy", it's free anyway...
  5. Now the apps works as supposed and has a real receipt file, but are tied to the Apple ID that installed the updates.
This is not an acceptable method according to me, but the only I've found out working. Luckily, in our organization, there aren't many using GarageBand...
If anyone has a better solution, please share it!

Monday, August 20, 2012

Suppress iCloud dialog at first login

Greg Neagle writes about it here, using MCX. But for me this didn't work (tried it as a local MCX and a profile).
This is how I do it: The information that the iCloud panel has been shown is stored inside ~/Library/Preferences/com.apple.SetupAssistant.plist and the keys is the same as you find in Greg's article, namely:

 "DidSeeCloudSetup"
and
"LastSeenCloudProductVersion"

"DidSeeCloudSetup" should be set to "true" (boolean) and "LastSeenCloudProductVersion" to 10.8 (string). This is what I put in my firstboot.sh for this to work:


OSVERS=$(sw_vers | awk -F. '/ProductVersion/  {print $2}')
USERTEMPLATES=$(find "/System/Library/User Template" -type d -maxdepth 1)
USERHOMES=$(find "/Users" -type d -maxdepth 1 | grep -v Shared)



if [ "$OSVERS" = "8" ]; then
echo "This is OS X 10.8, running specific tasks for 10.8"
#Suppress iCloud dialog when logging in
echo "Suppressing iCloud dialog at login"
for templates in $USERTEMPLATES; do
defaults write "$templates/Library/Preferences/com.apple.SetupAssistant" DidSeeCloudSetup -bool true
defaults write "$templates/Library/Preferences/com.apple.SetupAssistant" LastSeenCloudProductVersion -string 10.8
done
for userhome in $USERHOMES; do
defaults write "$userhome/Library/Preferences/com.apple.SetupAssistant" DidSeeCloudSetup -bool true
defaults write "$userhome/Library/Preferences/com.apple.SetupAssistant" LastSeenCloudProductVersion -string 10.8
done
fi
The first for loop takes care of the user templates so any new user that is created gets this preference. The second loop writes the preference to any existing home directory. Quite ugly, but it works...

Monday, August 13, 2012

Adobe Provisioning Tool errors

My sincere belief is that Adobe can't do anything correct. To begin with, as they now released CS6 they demand that every user have to register their product with that user's AdobeID. Or else the product will not start after 7 days. As an enterprise customer you can work around this by repackaging all the CS6 products with Adobe's AAMEE tool (Adobe Application Manager Enterprise Edition). Adobe calls this a "minor impact" in their document describing this. Well, I can tell you, repackaging about 10 products in both English and Swedish on two platforms, summing up to a total of 40 products takes a few hours... And not a single word to us customers that this was going to happen! Well, enough about that... When I got to repackage Acrobat Pro X, the errors continues. For Windows there is a tool called Acrobat Customization Wizard, this is not available for Mac. We have to use a tool called Adobe Provisioning Tool. Everything is explained in Adobe's PDF for enterprise deployment. It involves creating a new package that will install a zipped copy of the Adobe Acrobat X package and adobe_provisioning_tool.app to /tmp. Then a postinstall script unzips the installer, running the installer and then runs three adobe_provisioning_tool commands to serialize, accept the EULA and suppress the AdobeID dialog. Ok, not THAT complicated. BUT the postinstall script Adobe thinks we should run contains some errors: The if statement after installation is really not after the installation takes place, no it's after the rm -rf "Installfile.pkg". And since it tests if $? equals 0, it tests the rm command, not the install command. So as long as the deletion went fine, the script reports that the installation went fine... The other is that the PDF says you should input the serial like this: "1118-xxxx-xxxx-xxxx-xxxx-xxxx". But if you run "adobe_provisioning_tool.app/Contents/MacOS/adobe_provisioning_ tool" without statements, the help text says you should pass the serial without dashes! From the help text: "adobe_provisioning_tool -C -a -s This is to validate the serial number against the application.sif file. The caller is expected to pass the clear serial number w/o any dashes ('-')." I hope I have helped someone with this complaint! And a tip: if you plan on using this method, make sure to include any Acrobat updates in the customized package and edit the postinstall script to install the update too.

Monday, July 30, 2012

Mountain Lion PreCheck for DeployStudio

A quick and dirty version that checks if the Mac you're deploying is Mountain Lion compatible.



#!/bin/bash

# Mountain Lion prereq checker

modelId=$(system_profiler SPHardwareDataType | grep "Model Identifier" | awk -F': ' '{print $2}')
#modelId=Macmini1,1
modelName=$(echo $modelId | awk -F',' '{print $1}' | tr -d '[[:digit:]]' | tr -d ',')
modelIdMajor=$(echo $modelId | awk -F',' '{print $1}' | tr -cd '[[:digit:]]')
modelIdMinor=$(echo $modelId | awk -F',' '{print $2}')

approvedModelsMajor=( 'iMac7' 'MacBook5' 'MacBookPro3' 'MacBookAir2' 'Macmini3' )

if [ "$modelName" = "iMac" ]; then
if [ "$modelIdMajor" -ge "7" ]; then
echo "------ ML PREREQ: This $modelName can run ML"
exit 0
else
echo "------ ML PREREQ: This $modelName cannot run ML"
exit 1
fi
fi

if [ "$modelName" = "MacBook" ]; then
if [ "$modelIdMajor" -ge "5" ]; then
echo "------ ML PREREQ: This $modelName can run ML"
exit 0
else
echo "------ ML PREREQ: This $modelName cannot run ML"
exit 1
fi
fi

if [ "$modelName" = "MacBookPro" ]; then
if [ "$modelIdMajor" -ge "3" ]; then
echo "------ ML PREREQ: This $modelName can run ML"
exit 0
else
echo "------ ML PREREQ: This $modelName cannot run ML"
exit 1
fi
fi

if [ "$modelName" = "MacBookAir" ]; then
if [ "$modelIdMajor" -ge "2" ]; then
echo "------ ML PREREQ: This $modelName can run ML"
exit 0
else
echo "------ ML PREREQ: This $modelName cannot run ML"
exit 1
fi
fi

if [ "$modelName" = "Macmini" ]; then
if [ "$modelIdMajor" -ge "3" ]; then
echo "------ ML PREREQ: This $modelName can run ML"
exit 0
else
echo "------ ML PREREQ: This $modelName cannot run ML"
exit 1
fi
fi

echo "------ ML PREREQ: Model not found"

exit 1

Thursday, May 31, 2012

Fix for iPhone Yellow Screen of Death (YSoD)

My iPhone 3GS on jailbroken iOS 4.3.5 just "died" and showed a yellow screen when trying to charge it or turn it on. I found some solutions on the web, but none of them worked. Here is what worked for me:

1. Connect the iPhone to your computer
2. Open iTunes
3. Put the iPhone in DFU mode (if you don't how to that, google it)
4. Let it charge for about 15 minutes
5. Go to iTunes and restore the iPhone

Done!

Hope this will help someone...

Friday, February 17, 2012

Temporary fix for SAMBA-printing in Lion

It seems like the "AuthInfoRequired" fix is working. At least were I work... Yesterday, when I went to bed, I came up with something!
What if I create a LaunchDaemon that triggers on changes to /etc/cups/printers.conf and that LaunchDaemon then runs a script that fixes the faulty settings in printers.conf?

Said and done, here are the result (sorry for the formatting, blame blogger):

The LaunchDaemon (located in /Library/LaunchDaemons)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>se.lnu.cupsfix</string>
<key>ProgramArguments</key>
<array>
<string>/Library/Scripts/cupsfix.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>/private/etc/cups/printers.conf</string>
</array>
</dict>
</plist>
The script (/Library/Scripts/cupsfix.sh)
#!/bin/bash
# cupsfix.sh by Marcus Jaensson
# Must be run as root
### VARIABLES
PRINTERLIST=`lpstat -p | awk '{print $2}'`
LOGF="/var/log/lnu_cupsfix.log"

### FUNCTIONS
function log()
{
echo -e "[`date "+%y%m%d %H.%M.%S"`]\t$1"
echo -e "[`date "+%y%m%d %H.%M.%S"`]\t$1" >> $LOGF
}

### SCRIPT
for printer in $PRINTERLIST; do
if [[ -z `lpoptions -p $printer | grep "auth-info-required=username,password"` ]]; then
log "Printer $printer has faulty settings, will now correct this"
lpadmin -p "$printer" -o auth-info-required=username,password
else
log "Printer $printer has the correct settings, have nothing to do"
fi
done
exit 0


Provided "as is"...