5
if ! virsh -q pool-list --all|grep -q '^uvtool\s'; then
6
# Idempotently create virsh pool
8
echo "<pool type='dir'><name>uvtool</name><target><path>/var/lib/uvtool/libvirt/images</path><permissions><mode>0700</mode></permissions></target></pool>" > "$tmpfile"
9
if ! virsh -q pool-define "$tmpfile"; then
11
echo "Failed to define libvirt pool 'uvtool'" >&2
19
# Idempotently start virsh pool
20
if ! virsh -q pool-list|grep -q '^uvtool\s'; then
21
if ! virsh -q pool-start uvtool; then
22
echo "Failed to start libvirt pool 'uvtool'" >&2
28
if [ "$1" = configure ]; then
29
mkdir -p /var/lib/uvtool/libvirt/images
30
if [ ! -e /var/lib/uvtool/libvirt/metadata ]; then
31
mkdir -pm775 /var/lib/uvtool/libvirt/metadata
32
chown root.libvirtd /var/lib/uvtool/libvirt/metadata
35
virsh -q pool-autostart uvtool # this is idempotent