aboutsummaryrefslogtreecommitdiffstats
path: root/main/aports-build/aports-build.initd
blob: bb849af54c5061648e844f3a14916f43d489ecc4 (plain)
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
#!/sbin/runscript

: ${mqtt_broker:="msg.alpinelinux.org"}
: ${git_branch:=master}
: ${mqtt_topic:="git/aports/$git_branch"}

command=/usr/bin/mqtt-exec
pidfile=/var/run/aports-build/mqtt-exec.pid
command_args="-h ${mqtt_broker:-msg.alpinelinux.org} -t $mqtt_topic -- /usr/bin/aports-build"
start_stop_daemon_args="--stdout /dev/null --stderr /dev/null --background --make-pid --user buildozer"

start_pre() {
	local h=$(getent passwd  buildozer | cut -d: -f6)
	checkpath --owner buildozer --directory ${pidfile%/*}
	local i
	for i in aports alpine-iso; do
		if ! [ -d "$h"/$i ]; then
			eerror "$h/$i is missing. Please git clone it"
			return 1
		fi
	done
}

stop_post() {
	# remove build status
	if [ -f /etc/aports-build.conf ]; then
		. /etc/aports-build.conf
	fi
	: ${hostname:=$(hostname)}
	: ${mqtthost:="msg.alpinelinux.org"}
	: ${status_clear:="mosquitto_pub -h $mqtthost -t build/$hostname -r -n"}
	$status_clear
	return 0
}