summaryrefslogtreecommitdiffstats
path: root/core/modules/qemu/module.build
blob: 2a7952e8f905b3a45ffb03443c81bdb62c55731b (plain) (blame)
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
#!/bin/bash

fetch_source() {
	# copy qemu runvirt plugin source to working directory
	local src_dir="${MODULE_DIR}/runvirt-plugin-qemu"
	local dst_dir="${MODULE_WORK_DIR}/src"
	mkdir -p "${dst_dir}" || perror "Could not create source folder for qemu runvirt plugin!"
	cp -r "${src_dir}" "${dst_dir}" || perror "Could not copy source files for qemu runvirt plugin!"
}

build() {
	# build qemu runvirt plugin
	local build_dir="${MODULE_WORK_DIR}/src/runvirt-plugin-qemu"
	mvn -f "${build_dir}" clean package || perror "Could not build runvirt-plugin-qemu with Maven!"

	# install qemu runvirt plugin
	local build_artifact_filename="runvirt-plugin-qemu-1.0-SNAPSHOT-jar-with-dependencies.jar"
	local install_dir="${MODULE_BUILD_DIR}/opt/openslx/vmchooser/plugins/qemu"
	local install_filename="runvirt-plugin-qemu.jar"
	mkdir -p "${install_dir}"
	cp "${build_dir}/target/${build_artifact_filename}" "${install_dir}/${install_filename}" || perror "Could not install runvirt-plugin-qemu!"
}

post_copy() {
	# change access rights of the qemu bridge helper config
	chown root:kvm /etc/qemu/bridge.conf
	chmod 0664 /etc/qemu/bridge.conf

	# set UID to avoid operation not permitted errors
	chmod u+s /usr/lib/qemu/qemu-bridge-helper
}