summaryrefslogtreecommitdiff
path: root/mkalpine
blob: f56b8b90435fa1ed06124c9fd8e635f4695bfd5e (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/sh

# check if what we need is here
needed="cramfs syslinux cdrkit"
for i in $needed; do
	if ! apk info -e $i; then
		missing="$missing $i"
	fi
done

# try install the missing parts
if [ -n "$missing" ]; then
	if ! sudo apk add $missing; then
		echo "Need $missing to build alpine" >&2
		exit 1
	fi
fi

# first look for alpine.mk in current dir. Fallback to /usr/share/abuild
mk=./alpine.mk
if ! [ -f $mk ]; then
	mk=/usr/share/abuild/alpine.mk
fi

make -f "$mk" APK_BIN= $@
rc=$?

# uninstall the stuff we installed
[ -n "$missing" ] && sudo apk del $missing

exit $?