[Libguestfs] [PATCH 2/2] sysprep: remove blkid tab in the guest

Richard W.M. Jones rjones at redhat.com
Wed May 9 11:49:23 UTC 2012


On Wed, May 09, 2012 at 06:08:55PM +0800, Wanlong Gao wrote:
> +    let files = g#glob_expand "/etc/blkid/*tab*" in

Good idea in principle, but you have to delete the file in a few more
places:

  /var/run/blkid.tab
  /etc/blkid/blkid.tab
  /etc/blkid.tab       # older debian
  /dev/.blkid.tab      # newer debian

AND! ... you have to check that the file you're going to remove isn't
a symbolic link.  Because at least on some versions of debian,
/etc/blkid.tab is a symlink, and you *don't* want to remove it.

There is a g#is_symlink function for checking if a path is a symlink:

http://libguestfs.org/guestfs.3.html#guestfs_is_symlink

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora




More information about the Libguestfs mailing list