Re: Where to mount a temporary partition in scripts?
martin f krafft wrote:
> 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 think it's more nice to have the folder ready to be mounted in case
the admin would need to do some maintenance. I don't really like the
Neil Williams wrote:
> The lintian warning exists for several reasons - one is that packages
> don't go clobbering existing user directories. As long as a path is
> documented in the manpage and any online Help, a relatively deep path
> is usually not a significant problem. I'd go with /var/lib/PACKAGE/ -
> at least then you can reasonably expect to have that location to
I think this is what I'm going to do yes. I think it's not convenient,
but if it's the only way...
> How 'temporary' is the mounted partition? Could it actually go in /tmp
> with a temporary directory name (maybe taking the PID of the process?)
It's mounted for the time of the setup of the VM, and that's about it.
But very often, for maintenance reasons, the admin would have to mount
it to access the customer's VPS files. Currently my setup script also
modifies /etc/fstab so it can be directly mounted with the correct
options (and save time in case of a disaster recovery).