graham gilbert

Mac administration and assorted nerdity

Migrating scriptRunner to Outset

| Comments

A while back, Nate Walck wrote scriptRunner. It’s a tool that can run a script either every time a user logs in or just the one time. It has served the test of time, but last year Joe Chilcote released Outset. It has all of the functionality of scriptRunner, but it can also install packages at the Mac’s first boot, and run scripts as root at either the first boot or every boot. This comes into it’s own when you’re trying to do things like skipping the iCloud screens on 10.10 using Rich Trouton’s script – this script needs to run after every OS update, so it makes sense to run this every time the Mac boots.

If you’ve been using scriptRunner and want to move to Outset, you have two options:

  • Just move your scripts into the appropriate Outset directories and hope your users don’t mind the ‘once’ scripts running a second time.
  • Or, you could pre-populate Outset’s ‘once’ plist so it won’t try to run a script previously run by scriptRunner again.

The first option isn’t acceptable to me, so I wrote a script that will populate Outset’s plist. It’s up on my Github. One caveat is that Outset requires that your scripts end .sh, .rb or .py. scriptRunner didn’t care about this. When you’re moving your scripts into the Outset directory, you will need to ensure your scripts have the correct extension. This script will read the first line and try to work out what kind of script it is if the file doesn’t have the right extension – if it can’t work it out, it will append .sh to the filename.

scriptRunner had a few options you could configure. The first is where your actual scripts live – you will need to edit line 8 of the script to where you put your scriptRunner scripts. Secondly, you might have changed the name of the plist scriptRunner uses – edit line 11 if you did this.

Now all that remains is to put this script into /usr/local/outset/login-once. A Luggage Makefile that will make a package that will do this is included in the repository.

I’ve assumed that you can move your scripts into the new Outset directories using your configuration management tool (Munki, Puppet, Capser, whatever), but if you need a tool that can do this for you (with the previously stated caveat about the file extensions of the scripts), you’ll find a script that can be dropped into Outset’s firstboot directory.

Creating Business Units and Groups in Sal Using a CSV

| Comments

Obviously I’m a little biased, but I love Sal. But, it can be a little tedious to get everything set up the first time if you have hundreds of Business Units and Machine Groups. I’ve quietly ignored the problem for a while, but then I saw this tweet pop up in my feed:

What say I Mr Bruienne? Like the man from Del Monte, I say YES!

The plan

We’re going to use a few of the parts that make Django and Docker awesome. We will:

  • Make a custom management command that will read in a CSV
  • The command will make the Business Units and Groups if they don’t exist
  • We’re than going to run it in a temporary Docker container when we’re ready to do the actual import. This is one of the strengths of Docker – we can spin up a linked container that will operate on the main database, but won’t interfere with your container serving the app.

First-boot-pkg Updated for Yosemite

| Comments

It seems like Yosemite introduced an undocumented change that requires any packages that are added an OS X installer (e.g. Netinstall or createOSXinstallPkg) be distribution style packages, or you get a nasty failure acompanied by one of the most unhelpful error messages ever.

To fix this, first-boot-pkg now builds distribution style packages.

London Apple Admins

| Comments

I’m delighted to say that the first (first meet that isn’t “let’s go to the pub and get drunk”, anyway!) London Apple Admins meetup is happening on the 3rd September at The Red Herring in St Pauls. I’d like to take all of the credit for organising it, but it was down to the hard work of Ben Toms. The theme this time is “this is what I’m working on at the moment”, so I’ll be talking about my new favourite toy, Docker.

If you’ll be in or around London on the 3rd September, please get yourself a ticket (they’re free) and come and have a beer or two whilst listening to some awesome talks by London based Mac Admins.