summaryrefslogtreecommitdiffstats
path: root/build
blob: 97296cdc205b4e2ba0d725c243aa07a1d0b1a51f (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
#!/usr/bin/make -f

include ../macros.$(OPK_HOST_ARCH_KERNEL).mk

# Derivatives should probably append their version to the ProteanOS version,
# e.g. "1.0.0~2.0.0" (for a version 2.0 distribution based on ProteanOS 1.0).
version = $$(printf '%s\n' '$(OPK_SOURCE_VERSION)' | \
	sed 's|\(^[0-9][0-9]*\.[0-9][0-9]*\).*$$|\1|')

dist_id = $$(printf '%s\n' "$${dist_name}" | tr '[A-Z]' '[a-z]' | \
	sed 's|[!a-z0-9_]|_|g')

# Set the distribution name in dist-vars.sh, not here.
script = \
	s|@DISTRIBUTION@|$${dist_name}|; \
	s|@OS@|$(os)|; \
	s|@VERSION@|$(version)|; \
	s|@DISTRIBUTION_ID@|$(dist_id)|; \
	s|@DISTRIBUTION_ANSI_COLOR@|$(dist_ansi_color)|; \
	s|@DISTRIBUTION_HOME_URL@|$(dist_home_url)|; \
	s|@DISTRIBUTION_BUG_URL@|$(dist_bug_url)|;

build:

install: build
	# Make file system hierarchy.
	set -e; \
	while read -r mode dir; do \
		install -d -m "$${mode}" "base-files.data/$${dir}"; \
	done <'../dirs'; \
	while read -r mode dir; do \
		install -d -m "$${mode}" "base-files.data/$${dir}"; \
	done <'../dirs.$(OPK_HOST_ARCH_KERNEL)'
	ln -s share/man base-files.data/usr/local/man
	ln -s /run      base-files.data/var/run
	ln -s /run/lock base-files.data/var/lock
	# Install base files.
	set -e; \
	. ../dist-vars.sh; \
	printf "%s$${dist_motd_banner:+\n}\n" \
		"$$(printf '%s' "$${dist_motd_banner}")" \
		>base-files.data/etc/motd; \
	sed ':l; N; $$!bl; s/\([^\n]\)\n\([^\n]\)/\1 \2/g' src/etc/motd | \
		sed "$(script)" | fold -s -w 73 | sed 's/[ \t]*$$//' \
		>>base-files.data/etc/motd; \
	for file in /etc/issue /etc/os-release; do \
		sed "$(script)" "src/$${file}" >"base-files.data/$${file}"; \
	done
	printf '%s\n' '$(OPK_HOST_ARCH)' >'base-files.data/etc/proteanos_arch'
	printf '%s\n' '$(OPK_HOST_PLAT)' >'base-files.data/etc/proteanos_plat'
	# Install common licenses.
	install -p -m 644 src/usr/share/common-licenses/* \
		base-files.data/usr/share/common-licenses