pkgsrc-nrelease.diff

joerg, 12/09/2005 04:09 PM

Download (10.7 KB)

View differences:

Makefile 8 Dec 2005 14:27:12 -0000
1
# $DragonFly: src/nrelease/Makefile,v 1.44 2005/12/04 21:24:13 dillon Exp $
1
# $DragonFly$
2 2
#
3 3

  
4
all: release
5

  
6
# compat target
7
installer_release: release
8
installer_quickrel: 
9
installer_realquickrel: realquickrel
10

  
11
.if make(installer_release) || make(installer_quickrel) || make(installer_realquickrel)
12
WITH_INSTALLER=
13
.endif
14

  
4 15
ISODIR ?= /usr/release
5 16
ISOFILE ?= ${ISODIR}/dfly.iso
6 17
ISOROOT = ${ISODIR}/root
7 18
OBJSYS= ${.OBJDIR}/../sys
8 19
KERNCONF ?= GENERIC
9
PKG_PATH= /usr/freebsd_pkg/sbin
10 20

  
11
# Specify which packages are required on the ISO, and let the user
12
# specify additional packages to include.  During the `pkgaddiso'
13
# target, the packages are obtained from PACKAGES_LOC.
14
#
15
REQ_PACKAGES= cdrtools-2.01 cvsup-without-gui-16.1h
16
REL_PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES}
17
.if defined(PACKAGES)
18
PACKAGES_LOC?= ${PACKAGES}/All
19
.else
20
PACKAGES_LOC?= /usr/ports/packages/All
21
.endif
22
PACKAGE_SITES?=http://www.bsdinstaller.org/packages/ \
23
	       http://cvs.bsdinstaller.org/packages/
21
PKGSRC_PKG_ADD?=	/usr/pkg/sbin/pkg_add
22
PKGSRC_PKG_PATH?=	${.CURDIR}
23
PKGSRC_BOOTSTRAP_FILE?=	${PKGSRC_PKG_PATH}/bootstrap-20051127.tar.gz
24
PKGSRC_DB?=		/var/db/pkg
25
PKGSRC_PREFIX?=		/usr/pkg
26
PKGSRC_RSYNC_SRC?=	rsync://packages.stura.uni-rostock.de/dfly14-nrelease
27

  
28
ENV?=	env
29
TAR?=	tar
30
RSYNC_CMD?=	rsync -avz
31

  
32
PKGSRC_PACKAGES?=	cdrecord
24 33

  
25 34
# Specify which root skeletons are required, and let the user include
26 35
# their own.  They are copied into ISODIR during the `pkgcustomizeiso'
27 36
# target; each overwrites the last.
28 37
#
29 38
REQ_ROOTSKELS= ${.CURDIR}/root
30
ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS}
39
ROOTSKELS?=	${REQ_ROOTSKELS}
40

  
41
.if defined(WITH_INSTALLER)
42
PKGSRC_PACKAGES+=	dfuibe_installer dfuife_curses
43
ROOTSKELS+=		installer
44
.endif
31 45

  
32 46
# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
33 47
# the additional '/nrelease' manually, as a safety measure.
......
42 56
#########################################################################
43 57

  
44 58
release:	check clean buildworld1 buildkernel1 \
45
		buildiso customizeiso pkgaddiso mklocatedb mkiso
59
		buildiso customizeiso mklocatedb mkiso
46 60

  
47 61
quickrel:	check clean buildworld2 buildkernel2 \
48
		buildiso customizeiso pkgaddiso mklocatedb mkiso
49

  
50
realquickrel:	check clean \
51
		buildiso customizeiso pkgaddiso mklocatedb mkiso
52

  
53
#########################################################################
54
#			ISO TARGETS WITH INSTALLER			#
55
#########################################################################
56

  
57
INSTALLER_PKGS= libaura-3.1 libdfui-4.1 libinstaller-5.1 \
58
		dfuibe_installer-1.1.6 dfuife_curses-1.5 \
59
		thttpd-notimeout-2.24 dfuife_cgi-1.4
60
INSTALLER_SKELS= installer
61

  
62
INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS} ${EXTRA_PACKAGES}" \
63
		EXTRA_ROOTSKELS="${INSTALLER_SKELS} ${EXTRA_ROOTSKELS}"
62
		buildiso customizeiso mklocatedb mkiso
64 63

  
65
installer_check:
66
		@${INSTALLER_ENV} ${MAKE} check
67

  
68
installer_fetchpkgs:
69
		@${INSTALLER_ENV} ${MAKE} fetchpkgs
70

  
71
installer_release:
72
		${INSTALLER_ENV} ${MAKE} release
73

  
74
installer_quickrel:
75
		${INSTALLER_ENV} ${MAKE} quickrel
76

  
77
installer_realquickrel:
78
		${INSTALLER_ENV} ${MAKE} realquickrel
79

  
80
#########################################################################
81
#				HELPER TARGETS				#
82
#########################################################################
64
realquickrel:	check clean buildiso customizeiso mklocatedb mkiso
83 65

  
84 66
check:
85
	@if [ ! -f /usr/local/bin/mkisofs ]; then \
86
		echo "You need to install the sysutils/cdrtools port for"; \
87
		echo "this target"; \
88
		exit 1; \
89
	fi
90
.for PKG in ${REL_PACKAGES}
91
	@if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
92
		echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz."; \
93
		echo "(Perhaps you need to download or build it first?)"; \
94
		echo ""; \
95
		echo "If you are trying to build the installer, the"; \
96
		echo "required packages can be obtained from:"; \
97
		echo ""; \
98
		echo "    http://www.bsdinstaller.org/packages/"; \
99
		echo ""; \
100
		echo "They can be automatically downloaded by issuing:"; \
101
		echo "    make installer_fetchpkgs"; \
102
		echo ""; \
103
		exit 1; \
104
	fi
105
.endfor
106
	@if [ ! -f /usr/pkg/sbin/pkg_add ]; then \
107
		echo "NetBSD pkgsrc has not been bootstrapped.  You can"; \
108
		echo "automatically download the pkgsrc and install the"; \
109
		echo "the bootstrap with:"; \
110
		echo "    make pkgsrc_fetch"; \
111
		echo "    make pkgsrc_bootstrap"; \
112
		exit 1; \
113
	fi
114
	@if [ ! -f /etc/mk.conf ]; then \
115
		echo "NetBSD pkgsrc: /etc/mk.conf must exist.  You can"; \
116
		echo "automatically create this file with:"; \
117
		echo "    make pkgsrc_conf"; \
118
		exit 1; \
119
	fi
120
	@echo "check: all preqs found"
121

  
122
pkgsrc_fetch:
123
	cd /usr
124
	cvs -d anoncvs@anoncvs.us.netbsd.org:/cvsroot checkout pkgsrc
125

  
126
pkgsrc_bootstrap:
127
	rm -rf /tmp/bootstrap-workdir
128
	cd /usr/pkgsrc/bootstrap && ./bootstrap --workdir=/tmp/bootstrap-workdir
129
	rm -rf /tmp/bootstrap-workdir
130
	fgrep -q LOCALBASE /etc/mk.conf || (echo "you may also have to run make pkgsrc_conf to initialize /etc/mk.conf")
131

  
132
pkgsrc_conf:
133
.if !exists(/etc/mk.conf) 
134
	cp ${.CURDIR}/mk.conf.pkgsrc /etc/mk.conf
135
.else
136
	fgrep -q BSD_PKG_MK /etc/mk.conf || cat ${.CURDIR}/mk.conf.pkgsrc >> /etc/mk.conf
137
.endif
138

  
139
fetchpkgs:
140
.for PKG in ${REL_PACKAGES}
141
	@if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
142
		cd ${PACKAGES_LOC} && \
143
		echo "fetching ${PKG}..." && \
144
		for SITE in ${PACKAGE_SITES}; do \
145
			if [ ! -f ${PKG}.tgz ]; then \
146
				fetch $${SITE}${PKG}.tgz || \
147
				    echo "Not available from $${SITE}"; \
148
			fi; \
149
		done; \
150
		if [ ! -f ${PKG}.tgz ]; then \
151
			echo "Couldn't retrieve ${PKG}.tgz!"; \
152
			exit 1; \
153
		fi; \
154
	fi
155
.endfor
67
	@${ECHO} Testing mkisofs...
68
	@mkisofs --version > /dev/null
69
	@${ECHO} Testing pkg_add and list of packages...
70
	@${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGSRC_PKG_ADD} -n ${PKGSRC_PACKAGES} > /dev/null 2>&1
71
	@${ECHO} Testing for existence of bootstrap kit...
72
	@[ -r ${PKGSRC_BOOTSTRAP_FILE} ]
156 73

  
157 74
buildworld1:
158 75
	( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
......
186 103
	dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
187 104

  
188 105
customizeiso:
189
	cd /usr/pkgsrc/bootstrap && ./bootstrap --workdir=${NRLOBJDIR}/nrelease/bootstrap-workdir --prefix=${ISOROOT}/usr/pkg
190
	cp ${.CURDIR}/mk.conf.pkgsrc ${ISOROOT}/etc/mk.conf
191 106
.for ROOTSKEL in ${ROOTSKELS}
192 107
	cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
193 108
.endfor
......
205 120
		     periodic/monthly/Makefile
206 121
	cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
207 122
.endfor
208

  
209
pkgcleaniso:
210
	rm -f ${ISOROOT}/tmp/chrootscript
211
	echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
212
.for PKG in ${REL_PACKAGES}
213
	echo "${PKG_PATH}/pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
214
.endfor
215
	chmod a+x ${ISOROOT}/tmp/chrootscript
216
	chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
217
	rm ${ISOROOT}/tmp/chrootscript
218

  
219
pkgaddiso:
220
	rm -f ${ISOROOT}/tmp/chrootscript
221
	echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
222
.for PKG in ${REL_PACKAGES}
223
	if [ ! -d ${ISOROOT}/var/db/pkg/${PKG} ]; then \
224
		cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz; \
225
		echo "echo 'Installing package ${PKG}...' && \\" >> \
226
		    ${ISOROOT}/tmp/chrootscript; \
227
		echo "${PKG_PATH}/pkg_add /tmp/${PKG}.tgz && \\" >> \
228
		    ${ISOROOT}/tmp/chrootscript; \
229
	fi
230
.endfor
231
	echo "echo 'All packages added successfully!'" >> \
232
	    ${ISOROOT}/tmp/chrootscript
233
	chmod a+x ${ISOROOT}/tmp/chrootscript
234
	chroot ${ISOROOT}/ /tmp/chrootscript
235
	rm ${ISOROOT}/tmp/chrootscript
236
.for PKG in ${REL_PACKAGES}
237
	rm -f ${ISOROOT}/tmp/${PKG}.tgz
123
	cd ${ISOROOT} && ${TAR} xzf ${PKGSRC_BOOTSTRAP_FILE}
124
.for pkg in ${PKGSRC_PACKAGES}
125
	${ENV} PKG_PATH=${PKGSRC_PKG_PATH} ${PKGSRC_PKG_ADD} -I -K ${ISOROOT}${PKGSRC_DB} -p ${ISOROOT}${PKGSRC_PREFIX} ${pkg}
238 126
.endfor
239 127

  
240 128
mklocatedb:
......
249 137
		-R -J -V DragonFly -o ${ISOFILE} . )
250 138

  
251 139
clean:
252
	rm -rf /tmp/bootstrap-workdir
253 140
	if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
254 141
	if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
255 142
	if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
......
257 144
realclean:	clean
258 145
	rm -rf ${OBJSYS}/${KERNCONF}
259 146

  
147
fetch:
148
	mkdir -p ${PKGSRC_PKG_PATH}
149
	${RSYNC_CMD} ${PKGSRC_RSYNC_SRC} ${PKGSRC_PKG_PATH}
150

  
151
.PHONY: all release installer_release quickrel installer_quickrel realquickrel
152
.PHONY: installer_realquickrel check buildworld1 buildworld2
153
.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso
154
.PHONE: clean realclean fetch
155

  
260 156
.include <bsd.prog.mk>
installer/etc/defaults/pfi.conf 8 Dec 2005 14:27:12 -0000
18 18
pfi_frontend="curses"
19 19

  
20 20
# Determines which installer backend to use.  Typically this is
21
# "/usr/local/sbin/dfuibe_installer", the traditional C backend,
21
# "/usr/pkg/sbin/dfuibe_installer", the traditional C backend,
22 22
# but can be changed to start an alternate backend.
23 23

  
24
pfi_backend="/usr/local/sbin/dfuibe_installer"
24
pfi_backend="/usr/pkg/sbin/dfuibe_installer"
25 25

  
26 26
# When using the curses frontend:
27 27
# Set the amount of time, in milliseconds, which must pass after
......
106 106
# EXAMPLE 3:
107 107
# Use a custom backend.
108 108
#
109
# pfi_backend="/usr/local/sbin/my_custom_backend"
109
# pfi_backend="/usr/pkg/sbin/my_custom_backend"
installer/usr/local/bin/installer 8 Dec 2005 14:27:12 -0000
72 72
		background_backend $RENDEZVOUS $pfi_dfui_transport &
73 73
		sleep 1
74 74
		ESCDELAY=$pfi_curses_escdelay \
75
		    /usr/local/sbin/dfuife_curses \
75
		    /usr/pkg/sbin/dfuife_curses \
76 76
			-r $RENDEZVOUS \
77 77
			-t $pfi_dfui_transport \
78
			-b /usr/local/share/dfuife_curses/fred.txt \
78
			-b /usr/pkg/share/dfuife_curses/fred.txt \
79 79
		    2>/dev/null
80 80
		pfi_frontend=none
81 81
	fi
......
95 95
			# Frontend is already running.
96 96
		else
97 97
			ESCDELAY=$pfi_curses_escdelay \
98
			    /usr/local/sbin/dfuife_curses \
98
			    /usr/pkg/sbin/dfuife_curses \
99 99
				-r $RENDEZVOUS \
100 100
				-t $pfi_dfui_transport \
101
				-b /usr/local/share/dfuife_curses/fred.txt \
101
				-b /usr/pkg/share/dfuife_curses/fred.txt \
102 102
			    2>/dev/ttyv0 </dev/ttyv1 >/dev/ttyv1 &
103 103
		fi
104 104
		rm -f /tmp/ps.txt