qubes-linux-utils/udev/udev-block-remove

17 lines
532 B
Plaintext
Raw Permalink Normal View History

#!/bin/sh
NAME=${DEVNAME#/dev/}
2013-06-07 03:21:41 +00:00
QDB_KEY="/qubes-block-devices/$NAME"
# Trailing slash is intentional - it will remove the whole directory, instead of
# a single base entry
qubesdb-rm "$QDB_KEY/"
2013-06-07 03:21:41 +00:00
qubesdb-write /qubes-block-devices ''
if [ -r /var/run/qubes/block-slave-cache-$NAME ]; then
# update info about underlying devices of device-mapper (if any);
for dev in $(cat /var/run/qubes/block-slave-cache-$NAME); do
udevadm trigger /sys/class/block/$dev
done
rm -f /var/run/qubes/block-slave-cache-$NAME
fi