[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#627332: update mlocate database?



Package: live-build
Version: 3.0~a17-1
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

Our current Ubuntu live filesystem builder updates the mlocate database
in the squashfs.  This is convenient because you get to use locate in
the live session without having to wait for updatedb, and because after
you install the system it doesn't have to do very much work to update
the locate database (particularly true with mlocate versus previous
versions of locate).

The trade-off is that the database takes a bit of space; it's about half
a megabyte compressed here for a 700 megabyte squashfs.  However, this
should scale with the size of the image, so I think it's reasonably
tolerable.

Do you think that it would be OK to do this by default (see attached
patch), or do you want it to be more configurable?  I'd appreciate some
guidance on this, as I haven't quite got a feel yet for what you
consider to be good practice in live-build.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
>From bca7bc8bf750ed00b85edfa228405dde89cbaee8 Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@canonical.com>
Date: Thu, 19 May 2011 14:42:43 +0100
Subject: [PATCH] Update the mlocate database.

---
 scripts/build/lb_chroot_hacks |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/scripts/build/lb_chroot_hacks b/scripts/build/lb_chroot_hacks
index 2a58c0f..194d667 100755
--- a/scripts/build/lb_chroot_hacks
+++ b/scripts/build/lb_chroot_hacks
@@ -189,6 +189,14 @@ Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u"
 # people might do in local hooks, and there might be no initrds at all.
 find chroot/boot -name 'initrd*' -print0 | xargs -r -0 chmod go+r
 
+# Update the mlocate database.  It's convenient for this to be already up to
+# date on the live system, and it means that if the live system is later
+# installed to a hard disk then less work will be required after
+# installation.
+if [ -x chroot/usr/bin/updatedb.mlocate ]; then
+	Chroot chroot updatedb.mlocate
+fi
+
 # Remove build systems clock drift
 echo "0.0 0 0.0" > chroot/etc/adjtime
 
-- 
1.7.4.1


Reply to: