Hi,

I post a solution we found (partially with the help of the
SuSE support) for other people here that may have similar
problems, and to be found via archives/Google :-)

Our goals are:
--------------
1) automounter for users without KDE and Gnome
2) fixed mount-points for CDs/DVDs because we don't want to check
   /media/ for the mountpoint, but always find our DVDs at /media/dvd
   or /media/cdrecorder.
3) files on mounted DVDs should belong to the user
4) burn DVDs with growisofs as user.
5) Additionally, have an instance of ivman running for root.

Not as simple as it seems ;-)


Our solution:
-------------
To use fixed mount points, we define /etc/ivman/IvmConfigActions.xml
(all following examples only for the DVD-RW to keep it shorter):

<?xml version="1.0" encoding="UTF-8"?>
<ivm:ActionsConfig version="0.2" xmlns:ivm="http://www.eikke.com/ivm";>

    <!-- perform these rules on devices already attached when Ivman starts -->
    <ivm:Option name="checkOnInit" value="true" />

    <!-- try to mount any mountable volume at all -->
    <ivm:Match name="ivm.mountable" value="true">
        <ivm:Option name="mount" value="true" />
    </ivm:Match>

    <ivm:Match name="hal.block.device" value="/dev/sr1">
    <ivm:Option name="exec" value="halmount $hal.block.device$ cdrecorder" />
    </ivm:Match>

</ivm:ActionsConfig>

A user should start ivman with "ivman -c /etc/ivman" because there
are version of ivman (e.g. in 10.1) that do not copy the global
config files correctly to the users homedir.

With this config, ivman will call "halmount /dev/sr1 cdrecorder",
thus the files on the DVD mounted will belong to the user.

Note that when having a fstab-entry with "users" and calling "mount"
here (that was the first solution...) the files on the mounted DVD
will be owned by root. Thus, "600" files are not readable for the user
who mounted the DVD :-( That's why we need halmount.

Note that with this config alone, we would have two mounts for
every DVD, /media/cdrecorder *and* /media/<label of the dvd>,
because ivman calls it's normal mount procedure, too. Defining
    <ivm:Option name="mount" value="false" />
which can be found in some proposals, is not a good idea if
you want a second ivman instance for root, see below. But
we don't need it anyway as we see in a moment.


Now, when we call growisofs with the DVD-RW mounted because
it already contained a FS, growisofs will complain it cannot unmount
the DVD and exit.

We could do it ourself with "halmount -u /dev/sr1", but that's
not nice... So we add a line in fstab:

/dev/sr1    /media/cdrecorder     auto     noauto,users,user

We use noauto to avoid mounting accidentally by "mount -a".
growisofs can unmount /dev/sr1 now because of the "users" entry.

However, when halmount finds an fstab entry for a device it
tries to mount, it mounts only if it finds the "user" option,
so we need "users" and "user" here.

Additionally, halmount refuses to mount the device anywhere else
but on the mountpoint defined in /etc/fstab. Thus, calling
"halmount /dev/sr1 blabla" will fail!
This makes the second mount go away: ivman first tries to call
"halmount /dev/sr1" which would end up in /media/<label of dvd>,
but in the debug mode we can see

manager.c:786 (ivm_run_command) Running: halmount '/dev/sr1'
/dev/sr1: /etc/fstab configuration does not allow this mountpoint

so we finally have only one mount at /media/cdrecorder.
For most people we are finished here, but we still have goal 5).
I sometimes use PCs where no one is logged in for burning DVDs
if we have a lot to burn and let ivman start automatically
when I log in as root, because I often burn root-only-readable
files. Such an root-ivman instance could still be running when 
a user logs in.

Now when a user-ivman and a root-ivman are running in parallel,
the root-ivman could win on mounting DVDs, making files on it
be owned by root and unreadable by users. To avoid this, ivman
has a sleep option that makes ivman instances started by root or
with -s sleep for 5 seconds. Due to this delay, a user-ivman will 
win. But, when setting the "mount" option to "false" as found
in some proposals for fixed mount-points, this sleep is deactivated, too,
and a left-over ivman instance by root could disturb the user instance.
However, as seen above, we don't need to set "mount" to false to
avoid double mounts, so with the configs above we can just have
user- and root-instances of ivman running in parallel.

Maybe this helps some people with similar needs :-)

cu,
Frank

-- 
Dipl.-Inform. Frank Steiner   Web:  http://www.bio.ifi.lmu.de/~steiner/
Lehrstuhl f. Bioinformatik    Mail: http://www.bio.ifi.lmu.de/~steiner/m/
LMU, Amalienstr. 17           Phone: +49 89 2180-4049
80333 Muenchen, Germany       Fax:   +49 89 2180-99-4049
* Rekursion kann man erst verstehen, wenn man Rekursion verstanden hat. *
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to