summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/50-install_dnbd3-server.inc
blob: 25d5ba641d289e9178419491d0b5ccca7ea6db9a (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
install_dnbd3-server_service() {
	echo "# copying dnbd3-server service file..."
	cp -p "$BASEDIR/static_files/dnbd3/dnbd3-server.service" /etc/systemd/system/dnbd3-server.service || perror "failed."
	echo "# Linking dnbd3-server service file into (/etc/systemd/system/)multi-user.target.wants..."
	ln -s /etc/systemd/system/dnbd3-server.service /etc/systemd/system/multi-user.target.wants/dnbd3-server.service \
		|| perror "Could not link dnbd3-server service file into multiuser target!"
	# For accessing stage4 on master server via SSL tunnel
	echo "# copying dnbd3-master-proxy service file..."
	cp -p "$BASEDIR/static_files/dnbd3/dnbd3-master-proxy.service" /etc/systemd/system/dnbd3-master-proxy.service || perror "failed."
	echo "# Linking dnbd3-master-proxy service file into (/etc/systemd/system/)multi-user.target.wants..."
	ln -s /etc/systemd/system/dnbd3-master-proxy.service /etc/systemd/system/multi-user.target.wants/dnbd3-master-proxy.service \
		|| perror "Could not link dnbd3-master-proxy service file into multiuser target!"
}

install_dnbd3-server() {
	# $1: directory to install dnbd3-server to
	echo "# Installing dnbd3 server... "
	mkdir -p "$1" || perror "mkdir '$1' failed"
	# TODO XXX
	# We need to switch to compiling dnbd3-server here
	# instead of downloading the binary.
	# (Will require libjansson-dev)
	perror "Not implemented!"

	# Copy config files
	mkdir -p /etc/dnbd3-server || perror "mkdir /etc/dnbd3-server failed"
	for i in rpc.acl server.conf alt-servers; do
		cp -p "$BASEDIR/static_files/dnbd3/$i" "/etc/dnbd3-server/$i" \
			|| perror "Could not copy $i to /etc/dnbd3-server"
		chmod 644 "/etc/dnbd3-server/$i"
	done
	chown -R root:root "$1"

	install_dnbd3-server_service "/etc/systemd/system/"
	echo "# dnbd3-server ok."
}