summaryrefslogtreecommitdiffstats
path: root/core/modules/dnbd3/module.build
blob: 1c877c8f899ed9a586567635b1253debd1a432c7 (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
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
fetch_source() {
	autoclone
}

build() {
	local build_dir="${MODULE_WORK_DIR}/src/dnbd3/build"
	mkdir -p "$build_dir" || perror "Could not create '$build_dir'."
	cd "$build_dir" || perror "Could not cd to '$build_dir'."
	# let's be explicit on what we want even though some defaults currently match
	cmake \
		-DCMAKE_BUILD_TYPE=Release \
		-DDNBD3_CLIENT_FUSE=ON \
		-DDNBD3_SERVER=ON \
		-DDNBD3_SERVER_FUSE=ON \
		-DDNBD3_KERNEL_MODULE=OFF \
		.. || perror "Could not cmake"

	make dnbd3-fuse || perror "Could not make dnbd3-fuse"
	make dnbd3-server || perror "Could not make dnbd3-server"

	cd src || perror "Could not src to '${PWD}/src'."
	chown root:root "fuse/dnbd3-fuse" "server/dnbd3-server" \
		|| perror "Could not chown dnbd3 components."
	chmod +x "fuse/dnbd3-fuse" "server/dnbd3-server" \
		|| perror "Could not set executable bit of components."

	local install_dir="${MODULE_BUILD_DIR}/opt/openslx/bin"
	mkdir -p "$install_dir" \
		|| perror "Could not create installation directory."
	cp -f "fuse/dnbd3-fuse" "server/dnbd3-server" "$install_dir" \
		|| perror "Could not copy components to installation directory."

	COPYLIST="list_dpkg_output"
	[ -e "$COPYLIST" ] && rm "$COPYLIST"
	list_packet_files >> "$COPYLIST"
	tarcopy "$(cat "$COPYLIST" | sort -u)" "${MODULE_BUILD_DIR}"
}

post_copy() {
	add_system_group "fuse"
}