Entries from July 2009 ↓

Pre-fetch Apple downloads as dmg files

In my quest to automate the workflow of managing Macs at work, I wanted a way to download disk image files from apple ahead of time – once downloaded the next will be to integrate with my watched install project from the previous post, and then auto lcreate the loadsets. I can then do all my management on the radmind server (picking and choosing loadsets ready to go).

The script monitors http://images.apple.com/downloads/macosx/apple/recent.rss and if it has been updated since last check (stores the last check in a plist file) it will check the feed links for any dmg it can find and download it to /downloaded_dmgs/ (which is easy enough to change in the script source)

The script source is below the fold – or download here

Continue reading →

watchedinstall

[update: project now on bitbucket]

The Problem

There is often the need in a deployment scenario to repackage an installer into some other format. This might be a [radmind][1] transcript, a simple payload only installer package or perhaps just a manifest of what exactly changed on the system.

Apple installer style packages contain simple payloads, but often contain pre or postflight scripts which can make additional and important changes to the filesystem.

There are a couple methods that have been used to try to deduce what exactly was installed:

Continue reading →

calling to the shell in python

This is one of the most frequent utility routines I have in many (most?) of my python scripts. Creating subprocesses in python is very flexble and powerful, but a bit verbose. Sometimes you just want to run a command and set a variable to the output.

from subprocess import Popen, call, STDOUT, PIPE
def sh(cmd):
    return Popen(cmd,shell=True,stdout=PIPE,stderr=PIPE).communicate()[0]

You can then just use this as:

sh('ps -x')