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"... 

Monday, February 6, 2012

[Swedish] "Spela in" från SVT Play med rtmpdump

Länge sedan sist, har varit mitt uppe i ett projekt att införa Windows 7...

Så här kommer en liten uppdatering, har inget med deployment att göra, men jag ville ändå tipsa om det!

Om du tex vill se "Hårdrockens historia" eller "Äkta människor" på vägen till jobbet, men har taskig mottagning längs vägen, kan du i förväg "spela in" det du vill se med hjälp av "rtmpdump"!

1. Ladda ner och installera rtmpdump (för OS X 10.7) här: http://trick77.com/2011/07/30/rtmpdump-2-4-binaries-for-os-x-10-7-lion/

2. Gå till det program du vill spela in i tex Chrome.

3. Välj att visa källkoden

4. Sök efter "rtmpe"

5. Du hittar nu fyra URLer som är i princip likadana. Leta upp den bitraten du vill ladda hem. (2400 är 720p). Kopiera URLen, till och med .mp4, alltså inte med ",bitrate:2400".

6. Öppna terminalen och skriv: rtmpdump -r rtmpe://[URL] -o ~/Desktop/[OUTPUT.mp4]

7. Nu börjar den ladda hem!

8. För att kunna se den i QuickTime eller iPhone, konvertera med tex Handbrake (http://handbrake.fr/) I VLC kan du se på filen direkt.