aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: c27a59050ca56f1f303ae5b50c4876cffc4cae7c (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
V=1.8
P=alpine-conf
PV=$(P)-$(V)
APKF=$(PV).apk
TARGZ=$(PV).tar.gz
PREFIX=/usr/local
TMP=$(PV)

LIB_FILES=libalpine.sh
SBIN_FILES=albootstrap\
	lbu\
	setup-ads\
	setup-alpine\
	setup-alpine-web\
	setup-cryptswap\
	setup-dns\
	setup-hostname\
	setup-interfaces\
	setup-keymap\
	setup-mta\
	setup-sendbug\
	setup-webconf\
	update-conf

ETC_LBU_FILES=lbu.conf
EXTRA_DIST=Makefile README

DIST_FILES=$(LIB_FILES) $(SBIN_FILES) $(ETC_LBU_FILES) $(EXTRA_DIST)

DESC="Alpine configuration scripts"
WWW="http://alpinelinux.org/alpine-conf"


TAR=tar
DB=$(TMP)/var/db/apk/$(PV)

.PHONY:	all apk clean dist install uninstall
all:	
	sed -i 's|^PREFIX=.*|PREFIX=$(PREFIX)|' $(SBIN_FILES)

apk:	$(APKF)

dist:	$(TARGZ)

$(APKF): $(SBIN_FILES)
	rm -rf $(TMP)
	make all PREFIX=
	make install DESTDIR=$(TMP) PREFIX=
	mkdir -p $(DB)
	echo $(DESC) > $(DB)/DESC
	cd $(TMP) && $(TAR) -czf ../$@ .
	rm -rf $(TMP)

$(TARGZ): $(DIST_FILES)
	rm -rf $(TMP)
	mkdir -p $(TMP)
	cp $(DIST_FILES) $(TMP)
	$(TAR) -czf $@ $(TMP)
	rm -rf $(TMP)
	
install:
	install -m 755 -d $(DESTDIR)/$(PREFIX)/sbin
	install -m 755 $(SBIN_FILES) $(DESTDIR)/$(PREFIX)/sbin
	install -m 755 -d $(DESTDIR)/$(PREFIX)/lib
	install -m 755 $(LIB_FILES) $(DESTDIR)/$(PREFIX)/lib
	install -m 755 -d $(DESTDIR)/etc/lbu
	install -m 755 $(ETC_LBU_FILES) $(DESTDIR)/etc/lbu

uninstall:
	for i in $(SBIN_FILES); do \
		rm -f "$(DESTDIR)/$(PREFIX)/sbin/$$i";\
	done
	for i in $(LIB_FILES); do \
		rm -f "$(DESTDIR)/$(PREFIX)/lib/$$i";\
	done
	
clean:
	rm -rf $(APKF) $(TMP) $(TARGZ)