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

Re: Where to mount a temporary partition in scripts?



also sprach Thomas Goirand <thomas@goirand.fr> [2007.03.24.1333 +0100]:
> My package dtc-xen, needs to mount partitions of the Xen VMs for which
> it's doing the setup. Previously, it was creating a /xen folder, but an
> up-to-date lintian produces an error about /xen in debian/dirs.
> 
> Where do you think it's the most appropriate place to do that?

Make a temporary directory with tempfile:

  TMPDIR="$(tempfile -d -p dtcxen -s mnt)"
  trap "umount -l $TMPDIR; rmdir $TMPDIR" 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15
  mount ... $TMPDIR
  [...]
  umount $TMPDIR
  rmdir $TMPDIR
  trap - 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15

> I could use /var/lib/dtc-xen/vps_partitions/xenXX but I really think
> it's too deep in the tree and not easy to use.

So? You're writing a script.

> Maybe I should use /mnt/xen/XX ???

No. /mnt is off limits.

Have a look at Steve Kemp's xen-utils, they have to mount images as
well. He uses temporary directories.

-- 
Please do not send copies of list mail to me; I read the list!
 
 .''`.   martin f. krafft <madduck@debian.org>
: :'  :  proud Debian developer, author, administrator, and user
`. `'`   http://people.debian.org/~madduck - http://debiansystem.info
  `-  Debian - when you have better things to do than fixing systems
 
it is better to remain silent and be thought a fool
than to open one's mouth and remove all doubt.

Attachment: signature.asc
Description: Digital signature (GPG/PGP)


Reply to: