Version Controlling Systems - SVN and BZR

Thursday, November 1st, 2007

I have been using both “svn” and “bzr” lately. “svn” is a quite popular system, have been there for many years. “bzr” is developed by Ubuntu team to use as their version controlling system. Even though bzr is quite new to the field, it’s pretty much transparent to the user. For example if you type “bzr add” in the root bzr branch directory, then all the newly added to the repository recursively whereas svn doesn’t do that recursively. “bzr” is capable of detecting removed files, but “svn” is not; you’ll have to delete the files manually. That’s really annoying.

So, I wrote a small shell script to handle those.

#!/bin/bash

svn status | while read line; do
	command=`echo $line | awk '{print $1}'`
	file=`echo $line | awk '{print $2}'`
	if [ "$command" = "?" ]; then
		echo “Add $file”
		svn add $file
	fi
	if [ "$command" = "!" ]; then
		echo “Remove $file”
		svn delete $file
	fi
done

Get ntfs-3g working with windows hibernate

Sunday, March 18th, 2007

Several weeks ago, I installed ntfs-3g and it was working fine. However, It doesn’t mount the drive if windows is hibernated. I usually hibernate windows in my laptop, so I wasn’t having ntfs-3g in fstab, I just remount it when I need it. I was sick of this and came up with a very simple script which allows me to mount it in ntfs-3g if possible, and to use ntfs otherwise.

This is how to do it.

  1. Install ntfs-3g
  2. Just type sudo apt-get install ntfs-3g

  3. Edit your fstab
  4. Open /etc/fstab and change the mount type from “ntfs” to “ntfs-3g”

  5. Open /etc/init.d/mount-bak.sh
  6. Here is my script. Change your device and get options from the fstab. The device should be changed on both 2nd and 4th lines.

    #!/bin/bash
    mounted=`mount | grep sda1`;
    if [ "$mounted" = "" ]; then
    mount /dev/sda1 /media/sda1 -o ‘defaults,nls=utf8,umask=007,gid=46′
    fi

    Change the permission of the script by running sudo chmod a+x /etc/init.d/mount-bak.sh

  7. Change the run level
  8. sudo ln -s /etc/init.d/mount-bak.sh /etc/rcS.d/47mount-bak.sh