hal-set-property修改lshal信息

对于使用gnome-mount或者hal的朋友来说,当分区被挂载后,会在桌面上显示”多少G的设备“这样的东西,是不是看着眼烦,现在介绍一种比较简单的方法来修改hal的参数
首先,使用hal-device,来查看自动挂载信息,例如hal-device |less 然后查找sda5
代码:
代码

8: udi = '/org/freedesktop/Hal/devices/volume_uuid_EE0454B90454868D'
block.minor = 5 (0x5) (int)
org.freedesktop.Hal.Device.Volume.method_names = { 'Mount', 'Unmount', 'Eject'
} (string list)
volume.ignore = false (bool)
volume.label = 'winE' (string)
info.capabilities = { 'volume', 'block' } (string list)
volume.is_partition = true (bool)
volume.mount_point = '/media/winE' (string)
info.category = 'volume' (string)
info.product = 'Volume (ntfs)' (string)
volume.is_disc = false (bool)
volume.is_mounted = true (bool)
block.is_volume = true (bool)
volume.linux.is_device_mapper = false (bool)
block.storage_device = '/org/freedesktop/Hal/devices/storage_serial_SATA_ST916
0821AS_5MA9TVM1' (string)
info.parent = '/org/freedesktop/Hal/devices/storage_serial_SATA_ST9160821AS_5M
A9TVM1' (string)
volume.block_size = 512 (0x200) (int)
volume.partition.number = 5 (0x5) (int)
volume.num_blocks = 182305557 (0xaddc315) (int)

volume.fsversion = '3.1' (string)
block.device = '/dev/sda5' (string)
volume.uuid = 'EE0454B90454868D' (string)
volume.partition.media_size = 160041885696 (0x25433d6000) (uint64)
volume.fsusage = 'filesystem' (string)
volume.is_mounted_read_only = false (bool)
org.freedesktop.Hal.Device.Volume.method_argnames = { 'mount_point fstype extr
a_options', 'extra_options', 'extra_options' } (string list)
info.interfaces = { 'org.freedesktop.Hal.Device.Volume' } (string list)
storage.model = '' (string)
volume.size = 93340445184 (0x15bb862a00) (uint64)
info.udi = '/org/freedesktop/Hal/devices/volume_uuid_EE0454B90454868D' (strin
g)
volume.mount.valid_options = { 'ro', 'sync', 'dirsync', 'noatime', 'nodiratime
', 'noexec', 'quiet', 'remount', 'exec', 'uid=', 'gid=', 'umask=', 'dmask=', 'fm
ask=', 'locale=', 'utf8' } (string list)
org.freedesktop.Hal.Device.Volume.method_signatures = { 'ssas', 'as', 'as' } (string list)
block.major = 8 (0x8) (int)
volume.fstype = 'ntfs' (string)
org.freedesktop.Hal.Device.Volume.method_execpaths = { 'hal-storage-mount', 'hal-storage-unmount', 'hal-storage-eject' } (string list)
volume.unmount.valid_options = { 'lazy' } (string list)
linux.hotplug_type = 3 (0x3) (int)
volume.partition.start = 62915198976 (0xea609c000) (uint64)
linux.sysfs_path = '/sys/block/sda/sda5' (string)
 

这里的全部都是关于hal自动挂载sda5的信息,上面的信息都是可以改动的。
现在我们要做的就是改动上面的信息,我们使用hal-set-property,来改变他们的值(这个命令需要root用户权限)。
通 常情况下使用这样的命令结构,hal-set-property --udi 设备的udi值(udi,相当于hal挂载设备的id是唯一的) --key 要改的键(如要改标卷volume.label) 然后接要改的值的类型 (--string 表示值为字符串, --int 值为整型,--bool 值为布尔) 后面为具体的值。
例如,我们要修改sda5的自动挂载的挂载点,让他固定而非disk-x,
hal-set-property --udi /org/freedesktop/Hal/devices/volume_uuid_EE0454B90454868D --key volume.mount_point --string /media/winE
hal-set-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.product --string "PowerEdge R610"
hal-set-property --udi /org/freedesktop/Hal/devices/computer --key system.hardware.serial --string "H5C3X3X"
 
 
 
 

你可能感兴趣的:(修改,lshal信息)