Migrating Sahana from cvs to git

Here is how I migrated the Sahana CVS repository to git, as part of the work that the Sahana New Zealand Cluster is gearing up to do.

It was actually a lot simpler than I expected!

Simple import

In a newly created directory:

  1. Do the initial setup:
    cvs -d:pserver:anonymous@sahana.cvs.sourceforge.net:/cvsroot/sahana login
  2. Run the migration:
    git cvsimport -k -m -v -d:pserver:anonymous@sahana.cvs.sourceforge.net:/cvsroot/sahana sahana-phase2
  3. Wait several hours for it to finish!

Fixing the author names

The only thing I didn't like from the above import was that all of the commit authors were missing full names and email addresses.

So I grabbed the list of Sahana project members from Sourceforge and created a mappping like this in a text file:

ajuonline=Ajay Kumar <ajuonline@users.sourceforge.net>  
akshits88=Akshit Sharma <akshits88@users.sourceforge.net>  
bhyde=Ben Hyde <bhyde@users.sourceforge.net>

Then I ran the import with the -A parameter:

git cvsimport -A username_map.txt -k -m -v -d:pserver:anonymous@sahana.cvs.sourceforge.net:/cvsroot/sahana sahana-phase2

Syncing new commits

To keep the git repository in sync with CVS and collect any new commits, simply run the same git cvsimport command again.

My next steps will be to setup an automated sync script to keep this repository up to date with the Sourceforge one.

grub on a bootable USB rescue stick

If you've got a cheap USB key lying around which is too small to be useful, follow these instructions to create a rescue "stick" in case your boot loader stops working.

(This is based on these instructions but simplified and updated for grub 2.)

Before you start, make sure you've got both the parted and the grub-pc packages installed.

Make the USB stick bootable

Plug in your USB stick and replace the device name and capacity with the appropriate values. (You can find the total capacity of the stick by typing print inside parted.)

$ sudo parted /dev/sda
(parted) rm 1
(parted) mkpart primary 1MB 4009MB
(parted) mkfs 1 fat32
(parted) toggle 1 boot
(parted) quit

Install grub

Again, substitute sda with the correct device name.

mount /dev/sda /mnt

mkdir -p /mnt/boot/grub
cp /usr/lib/grub/i386-pc/* /mnt/boot/grub/
echo '(hd0) /dev/sda' > /mnt/boot/grub/device.map
sudo grub-install --root-directory=/mnt /dev/sda

umount /mnt

That's it, now all you have to do is reboot with the stick plugged in and test booting your box manually with it.