Leopard Migration Assistant Let Me Down

I’ve upgraded 3 Macs in the last few days: a MacBook Pro, a MacBook, and a Dual G4 Power Mac. All were running the latest 10.4. I did backups to external firewire drives, then did a fresh install (formatting my old hard drive and then installing. It worked great for the MacBook Pro, but failed on the other two. Here’s what I did to solve it.

First, I copied my whole backup into a directory on my local box. I used rsync to do that:

rsync -aHSE /Volumes/BackupDisk/ /Users/paco/Desktop/Backup

Then I wrote a shell script to move over any applications from my backup of my Applications directory. This just checks to see if the app already exists. If it does, then it ignores it. If it doesn’t exist, then it moves it over.

cd /Users/paco/Desktop/Backup/Applications
for app in *
  if [ ! -d "/Applications/$app" ]
    mv "$app" /Applications

Making Users

Once I had the applications moved over, then I needed to create users. I found a few decent references online, and ultimately I needed to make my own little shell script. Here’s a script that creates an admin user:

dscl . -create /Users/${NEWUSER}
dscl . -create /Users/${NEWUSER} UserShell /bin/bash
dscl . -create /Users/${NEWUSER} RealName "Doofus Admin"
dscl . -create /Users/${NEWUSER} UniqueID 503
dscl . -create /Users/${NEWUSER} PrimaryGroupID 20
dscl . -create /Users/${NEWUSER} NFSHomeDirectory /Users/${NEWUSER}
dscl . -passwd /Users/${NEWUSER} *for i in staff _lpadmin _appserveradm "com.apple.sharepoint.group.1" _appserverusr admin
  dseditgroup -o edit -a ${NEWUSER} -t user "$i"

I got the list of groups in my script by looking at the list of groups a properly created user (i.e., by the System Preferences) had.

This user has no password (see the last dscl command?). I did sudo passwd ${NEWUSER} to set their password. Since I only had 5 or 6 users, and I knew all their passwords (wife, kids, sister, etc), this worked for me. I can imagine that any real system administrator would have trouble with this step.

Finally, I made the non-admin users. Here’s an example of that:

dscl . -create /Users/${NEWUSER}
dscl . -create /Users/${NEWUSER} UserShell /bin/bash
dscl . -create /Users/${NEWUSER} RealName "Video User"
dscl . -create /Users/${NEWUSER} UniqueID 506
dscl . -create /Users/${NEWUSER} PrimaryGroupID 506
dscl . -create /Users/${NEWUSER} NFSHomeDirectory /Users/${NEWUSER}
dscl . -passwd /Users/${NEWUSER} *
dseditgroup -o create -g 506 "${NEWUSER}"
dseditgroup -o edit -g 506 -a ${NEWUSER} -t user "${NEWUSER}"

Those last two commands are wrong. 🙁 They’re an attempt to get the “video” group to be GID 506, the way it had been in the original system. It doesn’t work. To this day I have GID problems where users aren’t in the right groups for stuff. Generally speaking, though, things work fine.