summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 87392f4b80e561d3518423ef1bf87ad48bb98027 (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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
PACKAGE=alpine-baselayout
VERSION=2.0_alpha3

PV 		=$(PACKAGE)-$(VERSION)
TARBALL 	=$(PV).tar.bz2
SUBDIRS 	=src init.d

GENERATED_FILES =TZ hosts profile
ETC_FILES 	=$(GENERATED_FILES) group fstab inittab nsswitch.conf \
		passwd protocols services shadow shells issue mdev.conf \
		crontab sysctl.conf 
CONFD_FILES = $(addprefix conf.d/, cron hwclock localinit rdate syslog tuntap vlan watchdog)
SBIN_FILES	=runscript-alpine.sh functions.sh rc_add rc_delete rc_status
RC_SH_FILES 	=rc-services.sh
UDHCPC_FILES 	=default.script 
LIB_MDEV_FILES 	=ide_links sd_links subdir_dev usbdev dvbdev
MODPROBED_FILES	=aliases blacklist i386
SENDBUG_FILES	=sendbug.conf
CRONTABS 	=crontab
DISTFILES 	=$(ETC_FILES) $(SBIN_FILES) $(UDHCPC_FILES) $(RC_SH_FILES)\
		$(LIB_MDEV_FILES) $(SENDBUG_FILES) $(MODPROBED_FILES) Makefile

all:	$(GENERATED_FILES)
	for i in $(SUBDIRS) ; do \
		cd $$i && make && cd ..  ; \
	done

clean:
	for i in $(SUBDIRS) ; do \
		cd $$i && make clean && cd .. ; \
	done
	rm -f $(TARBALL) $(GENERATED_FILES) *~

TZ:
	echo "UTC" > TZ

hostname:
	echo localhost > hostname

hosts:
	echo "127.0.0.1	localhost" > hosts

profile:
	echo "export PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin" > $@
	echo "export PAGER=less" >> $@
	echo "export PS1='\\h:\\w\\$$ '" >>$@
	echo "umask 022" >> $@

shadow:	passwd
	@lastchange=$$(( `date +%s` / ( 24 * 3600 ) ));\
	awk -F: ' { \
		pw = ":!:";\
		if ($$1 == "root") { pw = "::" };\
		print $$1 pw "'"$$lastchange"':0:::::"  \
	}' passwd > $@

install:
	install -m 0755 -d $(addprefix $(DESTDIR)/, \
		dev \
		dev/pts \
		dev/shm \
		etc \
		etc/apk \
		etc/conf.d \
		etc/crontabs \
		etc/modprobe.d \
		etc/network/if-down.d \
		etc/network/if-post-down.d \
		etc/network/if-pre-up.d \
		etc/network/if-up.d \
		etc/periodic/15min \
		etc/periodic/daily \
		etc/periodic/hourly \
		etc/periodic/monthly \
		etc/periodic/weekly \
		etc/rcK.d \
		etc/rcL.d \
		etc/sendbug \
		home \
		lib/firmware \
		lib/mdev \
		lib/rcscripts/sh \
		media/cdrom \
		media/floppy \
		media/usb \
		mnt \
		proc \
		sbin \
		sys \
		usr/bin \
		usr/sbin \
		usr/local/bin \
		usr/local/lib \
		usr/local/share \
		usr/share/udhcpc \
		var/lib/misc \
		var/lock/subsys \
		var/log \
		var/run \
		var/spool/cron \
		)
	install -d -m 0770 $(DESTDIR)/root
	install -d -m 1777 $(DESTDIR)/tmp $(DESTDIR)/var/tmp
	for i in $(SUBDIRS) ; do \
		cd $$i && make install && cd .. ;\
	done
	install -m 0644 $(ETC_FILES) $(DESTDIR)/etc
	install -m 0644 $(SENDBUG_FILES) $(DESTDIR)/etc/sendbug
	chmod 600 $(DESTDIR)/etc/shadow
	install -m 0644 $(CONFD_FILES) $(DESTDIR)/etc/conf.d
	install -m 0755 $(SBIN_FILES) $(DESTDIR)/sbin
	install -m 0755 $(UDHCPC_FILES) $(DESTDIR)/usr/share/udhcpc
	install -m 0755 $(RC_SH_FILES) $(DESTDIR)/lib/rcscripts/sh
	install -m 0755 $(LIB_MDEV_FILES) $(DESTDIR)/lib/mdev
	install -m 0755 $(MODPROBED_FILES) $(DESTDIR)/etc/modprobe.d
	mv $(DESTDIR)/etc/crontab $(DESTDIR)/etc/crontabs/root
	ln -s /etc/crontabs $(DESTDIR)/var/spool/cron/crontabs
	echo "af_packet" >$(DESTDIR)/etc/modules



$(TARBALL): $(DISTFILES) $(SUBDIRS)
	rm -rf $(PACKAGE)
	mkdir $(PACKAGE)
	for i in $(SUBDIRS) ; do \
		cd $$i && make clean && cd .. ; \
	done
	cp $(DISTFILES) $(PACKAGE)
	mkdir $(PACKAGE)/conf.d
	cp $(CONFD_FILES) $(PACKAGE)/conf.d/
	rsync -Cr $(SUBDIRS) $(PACKAGE)
	tar -cjf $@ $(PACKAGE)
	rm -r $(PACKAGE)

dist:	$(TARBALL)


.PHONY:	install clean all