Converting NetInfo accounts to dslocal

If you are doing an in-place upgrade from Tiger to Leopard without using the Apple Leopard Install DVD, you may need a way to convert existing local or mobile accounts from NetInfo to the dslocal store.

Here’s a script that converts local accounts; it requires the nicl binary, which you can copy from any Tiger installation.

For local accounts, it uses nicl to read the account info, and dscl to create a new corresponding account. For mobile accounts, it uses createmobileaccount to recreate the mobile account.

Enjoy.

Converting NetInfo accounts to dslocal

4 thoughts on “Converting NetInfo accounts to dslocal

  1. Greg, the NetInfo to dslocal account conversion can also be done by using the OSUpgrade.pkg package located on Leopard retail discs (and somewhat curiously on bundled install discs) in the hidden System/Installation directory. I built my in-place Tiger->Leopard upgrade with Leopard’s SIU and dumped this package into the workflow. Works like a charm!

  2. Good find!

    For those playing along at home, the package pmbuko is referring to can be found on the Leopard install disk at System/Installation/Packages/OSUpgrade.pkg.

    It’s a new-style flat package, but we can poke around in the contents by expanding it:

    pkutil –expand /path/to/OSUpgrade.pkg /Users/Shared/OSUpgrade.pkg

    Now open the /Users/Shared directory and you’ll see a traditional folder-based package. Show contents and dig down, and you’ll see that it’s a payload-free package – that is – one that installs no files, but exists purely to run scripts. The script that does the NetInfo to DS upgrade is OSUpgrade.pkg/Scripts/postinstall_actions/migrateNetInfo and it looks like this:

    #!/bin/sh

    ROOT_DIR=”$3″

    ./Tools/netInfoToDS “$ROOT_DIR”

    So it’s calling OSUpgrade.pkg/Tools/netInfoToDS with the path to the Volume Leopard is being installed on.

    In theory, you could copy this tool and run it yourself; in my quick testing it fails if run on the currently booted volume:

    ./netInfoToDS /

    complains about an invalid datastore during an openDatabaseForWriting call. So it won’t work as a replacement for my script, which runs on the currently booted volume. Still, if we can get it to work, it’s probably a better technique than mine – hopefully Apple has handled the edge cases better than me, and converts additional items beyond local users.

Comments are closed.