aboutsummaryrefslogtreecommitdiffstats
path: root/main/aports-build/aports-build.initd
blob: cf7852edb6a77c0a3e296a802e998801e245f94b (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
35
36
37
38
#!/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"

depend() {
	need net
}

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
}