[HAL, udev] fixed mount point?

Francisco Borges f.borges at rug.nl
Sun Apr 23 22:01:01 UTC 2006


Hello!

I have an iPod, I'm trying to get it to always mount to /media/ipod
instead of, say, /dev/sdb2.

I figured the right way to do this would *not* be using udev & fstab
combos but talking to HAL directly. Since AFAIK this would solve the
problem once and for all and set me free from messing with fstab and
avoid creating a directory at /media (since currently the /media/sdb2 is
created on the fly). Comments?

[...]

My problem is, HAL does set the right value to "desired_mount_point",
but it is not enforcing it. Using lshal, I can tell I've got the policy
right:

volume.policy.desired_mount_point = 'iPod'  (string)
volume.mount_point = '/media/sdb2'  (string)

Any comments? Hints?

BTW, my policy file is /usr/share/hal/fdi/policy/20thirdparty/ipod-policy.fdi

<?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
<deviceinfo version="0.2">
  <device>
    <match key="storage.vendor" string="Apple">
      <match key="storage.model" string="iPod">
        <merge key="storage.requires_eject" type="bool">true</merge>
        <merge key="storage.removable" type="bool">false</merge>
        <merge key="storage.media_check_enabled"
        type="bool">false</merge>
      </match>
    </match>
    <match key="@block.storage_device:storage.vendor" string="Apple">
      <match key="@block.storage_device:storage.model" string="iPod">
        <match key="block.is_volume" bool="true">
          <match key="volume.fsusage" string="filesystem">
            <match key="volume.partition.number" int="1">
              <merge key="volume.policy.should_mount"
              type="bool">false</merge>
            </match>
            <match key="volume.partition.number" int="2">
              <merge key="volume.policy.desired_mount_point"
              type="string">iPod</merge>
              <merge key="volume.policy.mount_option.sync"
              type="bool">true</merge>
            </match>
          </match>
        </match>
      </match>
    </match>
  </device>
</deviceinfo>

Cheers!
-- 
Francisco





More information about the ubuntu-users mailing list