Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Wednesday, 13 June 2007

Backing up your home to DVD with debian

I've finally got a DVD writer (external - it's a laptop) and it works quite amazingly well: no setup issues at all!

Now, the whole point of the exercise was that my Dell is getting a little dodgy (you have to press down hard around the power button to flex the PCB below in order to get it to boot!) and I wanted to back up my documents, sourcecode, emails etc. in case the worst should befall my poor old laptop. But I had a German exam the next day, and while I was burning the DVD I should also be revising!

In general, burning a data DVD on linux is easy. You get a copy of mkisofs and growisofs (on debian, this is easy: apt-get install dvd+rw-tools mkisofs). Then you call mkisofs on a directory tree to create an iso image (put it in /tmp!) and growisofs to write the lot to your DVD (I got the instructions here

Ahah, but not so fast! I wanted to do my home directory whilst xfce, claws-mail, firefox and probably a whole load of other processes were writing tiddly little bits to all my hidden dot-files and dot-directories in ~/ (you know, the ones like ~/.gnome and ~/.mozilla etc.). In fact, I didn't twig the first time and mkisofs threw a wobbly! Moreover, I didn't want to make another copy of everything because there's quite a lot of stuff and I didn't really have space for that on the harddisk partition.

So here's the solution:

First I made a folder called backmeup in my home directory:
mkdir backmeup
Then I moved all of the "normal" i.e. non-hidden files in my home directory into backmeup:
mv * backmeup
This will actually complain because at some point you've asked it to move backmeup into backmeup, but ignore the complaint - it did what we wanted! Now for the dot-files. We don't want to move them into backmeup, because some of the running programs would throw a wobbly, so we will actually need to copy this lot. Now, don't run cp -Rp .* backmeup/ because it'll go horribly wrong and try to make two copies of backmeup via the .. directory I think (disclaimer: Yes, this did go horribly wrong. And it took me 5 minutes to notice!)

Instead, call the following command:
cp -Rp `find -maxdepth 1 -name '.*' | sed '/^\.$/d'` backmeup
which is what we really wanted.

Now we're almost done! Just make the iso from the backmeup tree (no-one's going to be writing automatically to something called that!):
nice -n 19 mkisofs -r -o /tmp/rupert.iso /home/rupert/backmeup
The nice command is just to stop the job hogging the whole system.

... And write the iso to the disk:
growisofs -Z /dev/scd0=/tmp/rupert.iso

(clearly the device to which you write will need to depend on what the kernel calls it - I'm trying to do something clever with udev, but haven't quite got there yet!)

Sunday, 8 April 2007

Leptonica 1.43 in debian

What a load of effort! I've been developing a program using leptonica recently, using the debian package without thinking. Irritatingly, however, debian is at version 1.37 and upstream is at 1.43.

The good news is that the debian diff still works - to get a quick and dirty install (which is all I'm interested in!) do the following:


  1. Download the debian diff from this page.
  2. Patch a copy of the current source (from here) using the command:

    patch <../leptonlib_1.37-1.diff -p1


    from within the directory into which you extracted leptonica.
  3. Make the "debian/rules" file executable:

    chmod 0755 debian/rules

  4. Edit the "debian/docs" file and remove the line with library-notes.txt (it no longer exists in the package)
  5. cd into the debian directory and run the command

    dch -v 1.44-1

    (The dch program is part of the devscripts package)
  6. Finally, make sure a copy of the original 1.43 tar.gz is in the parent directory with the name
    leptonlib_1.43.orig.tar.gz
    and call
    debuild
    from the main source directory. Hopefully, it should compile and you'll have the relevant debfiles in the parent directory from which to install leptonica 1.43!