This file is indexed.

postinst is in uvtool-libvirt 0~bzr92-0ubuntu1.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
set -e

# libvirtd not running seems to be a common error condition during
# configuration. Check for this and give the user a more helpful message than a
# mysteriously failed uvtool-libvirt.postinst.
configure_diagnostic() {
	if ! socat UNIX-CONNECT:/var/run/libvirt/libvirt-sock - < /dev/null 2>/dev/null; then
		echo "libvirtd does not appear to be listening on \"/var/run/libvirt/libvirt-sock\"." >&2
		echo "On Ubuntu, libvirtd is managed with the \"libvirt-bin\" upstart job." >&2
		echo "Repair libvirtd, then reconfigure uvtool-libvirt with:"
		echo "    sudo apt-get -f install" >&2
	fi
}

define_pool() {
	if ! virsh -q pool-list --all|grep -q '^\s*uvtool\s'; then
		# Idempotently create virsh pool
		tmpfile=`mktemp`
		echo "<pool type='dir'><name>uvtool</name><target><path>/var/lib/uvtool/libvirt/images</path><permissions><mode>0700</mode></permissions></target></pool>" > "$tmpfile"
		if ! virsh -q pool-define "$tmpfile"; then
			rm -f "$tmpfile"
			echo "Failed to define libvirt pool 'uvtool'" >&2
			exit 1
		fi
		rm -f "$tmpfile"
	fi
}

start_pool() {
	# Idempotently start virsh pool
	if ! virsh -q pool-list|grep -q '^\s*uvtool\s'; then
		if ! virsh -q pool-start uvtool; then
			echo "Failed to start libvirt pool 'uvtool'" >&2
			exit 1
		fi
	fi
}

if [ "$1" = configure ]; then
	trap configure_diagnostic EXIT
	mkdir -p /var/lib/uvtool/libvirt/images
	if [ ! -e /var/lib/uvtool/libvirt/metadata ]; then
		mkdir -pm775 /var/lib/uvtool/libvirt/metadata
		chown root.libvirtd /var/lib/uvtool/libvirt/metadata
	fi
	# Make sure that libvirtd is ready. This is a workaround for LP: #1228210.
	socat UNIX-CONNECT:/var/run/libvirt/libvirt-sock,retry=15 - < /dev/null
	define_pool
	virsh -q pool-autostart uvtool # this is idempotent
	start_pool
fi


# Automatically added by dh_python2:
if which pycompile >/dev/null 2>&1; then
	pycompile -p uvtool-libvirt 
fi

# End automatically added section