summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 560f765967da3fc36fcc9fc6e56330df1ab3d2ed (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
VERSION=1.13.1

PV 		=alpine-baselayout-$(VERSION)
TARBALL 	=$(PV).tar.gz
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\
		ifenslave
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 > $@

#		":" $$pw ":"'"$$lastchange"'":0:::::"
install:
	install -m 0755 -d $(addprefix $(DESTDIR)/, etc sbin) \
		$(DESTDIR)/etc/conf.d \
		$(DESTDIR)/etc/crontabs \
		$(DESTDIR)/lib/rcscripts/sh \
		$(DESTDIR)/usr/share/udhcpc \
		$(DESTDIR)/etc/sendbug \
		$(DESTDIR)/usr/bin \
		$(DESTDIR)/lib/mdev \
		$(DESTDIR)/etc/modprobe.d \
		$(DESTDIR)/var/spool/cron \
		$(DESTDIR)/etc/periodic/15min \
		$(DESTDIR)/etc/periodic/hourly \
		$(DESTDIR)/etc/periodic/daily \
		$(DESTDIR)/etc/periodic/weekly \
		$(DESTDIR)/etc/periodic/monthly 
	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

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

dist:	$(TARBALL)


.PHONY:	install clean all