nrelease - MFC try to workaround a problem with ./bootstrap
[dragonfly.git] / nrelease / Makefile
CommitLineData
9b29c40a
MD
1#########################################################################
2# ENHANCEMENTS #
3#########################################################################
4
f4ec1279 5# New method e.g. 'make gui release'. A series of enhancement
9b29c40a
MD
6# targes may be specified which set make variables which enhance
7# the build in various ways.
8#
b9c3e754 9gui installer img:
9b29c40a 10
9b29c40a
MD
11#########################################################################
12# SETUP #
13#########################################################################
14
3fff415b
SW
15ISODIR?= /usr/release
16ISOROOT?= ${ISODIR}/root
17OBJSYS= ${.OBJDIR}/../sys
18
5cb6cda9 19MAKE_JOBS?= $$(sysctl -n hw.ncpu)
bfe20b28 20
b2b3ffcd
SS
21# temporary until everybody has converted to x86_64
22.if ${MACHINE_ARCH} == "amd64"
23MACHINE_ARCH= x86_64
24.makeenv MACHINE_ARCH
25.endif
26
bfe20b28
SW
27.if make(gui)
28KERNCONF ?= DFLYLIVE VKERNEL DFLYLIVE-SMP DFLYLIVE-SMP-NOAPIC
29.else
702a95cc
SS
30# XXX makeshift fix to build the right kernel for the (target) architecture
31# We should configure this in the platform files somehow
32.if ${MACHINE_ARCH} == "i386"
1d3eb8c5 33KERNCONF ?= GENERIC VKERNEL
702a95cc 34.else
b6a66df5 35KERNCONF ?= X86_64_GENERIC VKERNEL64
702a95cc 36.endif
bfe20b28 37.endif
6ca9a59c 38
cc224c64 39PKGSRC_PREFIX?= /usr/pkg
bce110a5 40PKGBIN_PKG_ADD?= ${PKGSRC_PREFIX}/sbin/pkg_add
95b64753 41PKGBIN_PKG_DELETE?= ${PKGSRC_PREFIX}/sbin/pkg_delete
c791834f 42PKGBIN_PKG_ADMIN?= ${PKGSRC_PREFIX}/sbin/pkg_admin
bce110a5
MD
43PKGBIN_MKISOFS?= ${PKGSRC_PREFIX}/bin/mkisofs
44PKGSRC_PKG_PATH?= ${ISODIR}/packages
bce110a5 45
cc55a235
SS
46# We use env -i in the chroot, so that environment variables won't
47# disturb any (pkgsrc) build. This has happened for TARGET_ARCH,
48# which is used by gmake in completely different context.
e2dbfa0b 49#
cc55a235
SS
50CHROOT_CMD?= env -i CCVER=${CCVER:Q} /usr/sbin/chroot ${ISOROOT} sh -c
51
8abe78a1 52# User may specify extra packages in addition to the defaults
95b64753 53#
8abe78a1
MD
54PKGSRC_EXTRA_PACKAGES?=
55
56# Pkgsrc packages to be built and installed on the release ISO
57#
58PKGSRC_PACKAGES?= pkgtools/pkg_leaves \
59 pkgtools/pkg_tarup \
b2c6ab6c 60 pkgtools/pkgin \
8abe78a1 61 devel/scmgit \
fbc26094
SW
62 net/isc-dhcp4 \
63 net/isc-dhcpd4 \
8abe78a1 64 sysutils/cdrtools \
796fd273 65 net/csup \
8abe78a1 66 ${PKGSRC_EXTRA_PACKAGES}
fbc26094
SW
67
68# pkgsrc options to use when building packages
69#
3fff415b
SW
70PKGSRC_OPTIONS+= MAKE_JOBS=${MAKE_JOBS}
71PKGSRC_OPTIONS+= WRKOBJDIR=/usr/pkgobj
9ecb41e5 72PKGSRC_OPTIONS+= PKG_DEFAULT_OPTIONS='dri inet6'
fbc26094 73.if !make(gui)
9ecb41e5 74PKGSRC_OPTIONS+= PKG_OPTIONS.scmgit=-scmgit-gui
fbc26094 75.endif
8188de86 76
95b64753
MD
77# Even though buildiso wipes the packages, our check target has to run
78# first and old packages (listed as they appear in pkg_info) must be
79# cleaned out in order for the pkg_add -n test we use in the check target
80# to operate properly.
81#
fbc26094
SW
82OLD_PKGSRC_PACKAGES?= cdrtools-2.01.01.27nb1 \
83 cdrecord-2.00.3nb2 \
84 bootstrap-kit-20070205 \
85 dfuibe_installer-1.1.6 \
86 gettext-lib-0.14.5 \
87 dfuibe_installer-1.1.7nb1 \
88 dfuife_curses-1.5 \
89 gettext-lib-0.14.6 \
90 gettext-tools-0.14.6nb1 \
91 libaura-3.1 \
92 libdfui-4.2 \
93 libinstaller-5.1 \
94 bootstrap-kit-20080211 \
95 cdrtools-ossdvd-2.01.1.36nb2 \
96 isc-dhcp-base-4.0.0 \
97 isc-dhcp-server-4.0.0
95b64753 98
8188de86 99# Specify which root skeletons are required, and let the user include
e2dbfa0b 100# their own. They are copied into ISODIR during the `customizeiso'
8188de86
MD
101# target; each overwrites the last.
102#
8f51ac0b 103REQ_ROOTSKELS= ${.CURDIR}/root
cc224c64
JS
104ROOTSKELS?= ${REQ_ROOTSKELS}
105
fbc26094 106.if make(gui)
3f279b9e 107ISOFILE?= ${ISODIR}/dfly-gui.iso
b9c3e754 108IMGFILE?= ${ISODIR}/dfly-gui.img
0936984e
MD
109PKGSRC_PACKAGES+= meta-pkgs/modular-xorg-apps \
110 meta-pkgs/modular-xorg-drivers \
111 meta-pkgs/modular-xorg-fonts \
112 meta-pkgs/modular-xorg-libs \
fbc26094 113 wm/fluxbox \
0936984e 114 wm/fvwm \
30e27f66 115 www/firefox \
fbc26094
SW
116 print/xpdf \
117 shells/zsh \
118 editors/emacs \
119 editors/vim \
120 chat/pidgin \
121 chat/irssi \
122 chat/xchat \
0936984e 123 x11/modular-xorg-server \
fbc26094
SW
124 x11/rxvt-unicode \
125 x11/eterm \
126 lang/perl5 \
127 editors/nano \
128 shells/bash \
129 devel/exctags \
130 archivers/zip \
131 security/sudo \
132 www/links-gui \
133 net/nmap \
134 net/wget \
135 fonts/terminus-font \
136 net/rsync \
137 sysutils/idesk \
0936984e 138 time/asclock \
fbc26094 139 misc/screen
3f279b9e
SW
140ROOTSKELS+= ${.CURDIR}/gui
141.endif
142
3f279b9e 143ISOFILE ?= ${ISODIR}/dfly.iso
b9c3e754
MN
144IMGFILE ?= ${ISODIR}/dfly.img
145
60b68cbb 146IMGMNT ?= ${ISODIR}/mnt
a2f841ed
MD
147
148# USB umass now probes starting at da8, so the usb stick is
149# probably sitting on da8.
150#
9a122c9a 151IMGUSBDEV ?= da8
3f279b9e 152
5b22b655
MD
153# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
154# the additional '/nrelease' manually, as a safety measure.
155#
156NRLOBJDIR?= /usr/obj
157
8188de86
MD
158#########################################################################
159# BASE ISO TARGETS #
160#########################################################################
161
7ebbae99 162release: check clean buildworld1 buildkernel1 \
03e2a3c5 163 buildiso srcs customizeiso mklocatedb \
0936984e 164 mkiso mkimg
8188de86 165
7ebbae99 166quickrel: check clean buildworld2 buildkernel2 \
03e2a3c5 167 buildiso srcs customizeiso mklocatedb \
0936984e 168 mkiso mkimg
2e3f8f38 169
03e2a3c5
SW
170realquickrel: check clean \
171 buildiso srcs customizeiso mklocatedb \
0936984e 172 mkiso mkimg
6ca9a59c 173
03e2a3c5 174restartpkgs: check customizeiso mklocatedb mkiso mkimg
5af45f85 175
9b29c40a
MD
176quick: quickrel
177
178realquick: realquickrel
179
5af45f85 180
9b29c40a
MD
181#########################################################################
182# CORE SUPPORT TARGETS #
183#########################################################################
184
d2582113 185check:
0936984e
MD
186.if !exists(${PKGBIN_PKG_ADMIN})
187 @echo "You never bootstrapped pkgsrc on your machine. You can install it with:"
188 @echo " make pkgsrc_bootstrap"
189.endif
0936984e
MD
190.if !exists (${PKGBIN_MKISOFS})
191 @echo
192 @echo "Your machine does not have cdrtools installed. You can install it with:"
193 @echo " make pkgsrc_cdrecord"
0a1628e7 194.endif
fbc26094
SW
195.if !defined(PKGSRC_PATH)
196 @echo "Please set PKGSRC_PATH to the pkgsrc tree that shall be used for"
5af45f85
MD
197 @echo "package building. For example /usr/pkgsrc. See the Makefile"
198 @echo "in /usr if you are unfamiliar with pkgsrc."
0936984e 199.endif
0936984e
MD
200.if !exists (${PKGBIN_MKISOFS})
201 @exit 1
202.endif
203.if !defined(PKGSRC_PATH)
fbc26094
SW
204 @exit 1
205.endif
2e3f8f38 206
588a679c 207buildworld1 buildworld2:
3fff415b
SW
208 cd ${.CURDIR}/..; \
209 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
210 make -j ${MAKE_JOBS} -DWANT_INSTALLER ${.TARGET:C/build(.*)2/quick\1/:C/1//}
6ca9a59c 211
588a679c 212buildkernel1 buildkernel2:
bfe20b28
SW
213.if make(gui)
214 cd ${.CURDIR}/..; \
215 for kernconf in ${KERNCONF}; do \
448b21e7 216 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
3fff415b 217 make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
bfe20b28
SW
218 KERNCONF=$${kernconf} KERNCONFDIR=${.CURDIR}/gui/root; \
219 done
220.else
588a679c
SS
221 cd ${.CURDIR}/..; \
222 first=; \
223 for kernconf in ${KERNCONF}; do \
448b21e7 224 ${WORLD_CCVER:C/^..*$/WORLD_CCVER=/}${WORLD_CCVER} \
3fff415b 225 make -j ${MAKE_JOBS} ${.TARGET:C/build(.*)2/quick\1/:C/1//} \
588a679c
SS
226 KERNCONF=$${kernconf} \
227 $${first:+-DNO_MODULES}; \
228 first=done; \
229 done
bfe20b28 230.endif
6ca9a59c 231
5b22b655
MD
232# note that we do not want to mess with any /usr/obj directories not related
233# to buildworld, buildkernel, or nrelease, so we must supply the proper
234# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
235# buildkernel mechanism.
236#
92b0ebb9
MD
237# Unconditionally clean out /usr/release/root so a previous img build
238# does not blow up a future quick iso build
239#
6ca9a59c 240buildiso:
92b0ebb9
MD
241 -rm -rf ${ISOROOT}
242 -chflags -R noschg ${ISOROOT}
243 rm -rf ${ISOROOT}
244 mkdir -p ${ISOROOT}
5b22b655 245 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
f4ec1279 246 ( cd ${.CURDIR}/..; make -DWANT_INSTALLER DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
247 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
248 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
21aa02d0 249 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
bfe20b28 250.if make(gui)
fbc26094 251 if [ ! -d ${ISOROOT}/kernel.smp/boot ]; then mkdir -p ${ISOROOT}/kernel.smp/boot; fi
bfe20b28
SW
252 cd ${.CURDIR}/..; \
253 make installkernel DESTDIR=${ISOROOT} \
254 KERNCONF=DFLYLIVE DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
255 cd ${.CURDIR}/..; \
256 make installkernel DESTDIR=${ISOROOT} \
257 KERNCONF=VKERNEL DESTKERNNAME=kernel.VKERNEL -DNO_MODULES KERNCONFDIR=${.CURDIR}/gui/root; \
258 cd ${.CURDIR}/..; \
259 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
260 KERNCONF=DFLYLIVE-SMP DESTKERNNAME=kernel KERNCONFDIR=${.CURDIR}/gui/root; \
261 cd ${.CURDIR}/..; \
262 make installkernel DESTDIR=${ISOROOT}/kernel.smp \
263 KERNCONF=DFLYLIVE-SMP-NOAPIC DESTKERNNAME=kernel.noapic \
264 KERNCONFDIR=${.CURDIR}/gui/root -DNO_MODULES;
265.else
588a679c
SS
266 cd ${.CURDIR}/..; \
267 first=; \
268 for kernconf in ${KERNCONF}; do \
269 make DESTDIR=${ISOROOT} \
270 installkernel KERNCONF=$${kernconf} \
271 $${first:+DESTKERNNAME=kernel.$${kernconf}} \
272 $${first:+-DNO_MODULES}; \
273 first=done; \
274 done
bfe20b28 275.endif
3f6dbfa9 276 ln -s kernel ${ISOROOT}/boot/kernel.BOOTP
b063fc66 277 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
6ca9a59c
MD
278 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
279 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86 280
e2dbfa0b
TN
281# Release CD: Kernel sources (~16M) and the full pkgsrc tree (~27M)
282# Release DVD: Full sources (~90M) and the full pkgsrc tree (~27M)
19d86faa 283#
e2dbfa0b
TN
284srcs:
285.if !defined(WITHOUT_SRCS)
1eeae16f
MD
286 rm -f ${ISOROOT}/usr/pkgsrc-git.tgz
287 rm -f ${ISOROOT}/usr/pkgsrc
288 mkdir -p ${ISOROOT}/usr/pkgsrc
289 cd ${ISOROOT}/usr/pkgsrc && git init
290 cd ${ISOROOT}/usr/pkgsrc && \
291 git remote add origin git://git.dragonflybsd.org/pkgsrc.git
292 cd ${ISOROOT}/usr/pkgsrc && git fetch origin
293 cd ${ISOROOT}/usr/pkgsrc && git branch vendor origin/vendor
294 cd ${ISOROOT}/usr/pkgsrc && git gc
c19c746b 295.if make(gui)
1eeae16f
MD
296 rm -f ${ISOROOT}/usr/src-git.tgz
297 rm -rf ${ISOROOT}/usr/src
298 mkdir -p ${ISOROOT}/usr/src
299 cd ${ISOROOT}/usr/src && git init
300 cd ${ISOROOT}/usr/src && \
301 git remote add origin git://git.dragonflybsd.org/dragonfly.git
302 cd ${ISOROOT}/usr/src && git fetch origin
303 cd ${ISOROOT}/usr/src && git branch master origin/master
304 cd ${ISOROOT}/usr/src && git gc
c19c746b 305.else
e2dbfa0b 306 rm -f ${ISOROOT}/usr/src-sys.tgz
3617b2c9
SW
307 cd ${.CURDIR}/.. && tar --exclude .git --exclude CVS -s '/^\./src/' \
308 -czf ${ISOROOT}/usr/src-sys.tgz ./Makefile ./Makefile.inc1 ./sys
c19c746b 309.endif
66b79064 310.endif
19d86faa 311
5af45f85
MD
312# Customize the ISO by copying rootskels in reverse priority order,
313# building packages, and doing other post-install tasks.
314#
8188de86 315customizeiso:
5af45f85
MD
316 # Copy the rootskels. Allow sources to be owned by someone other
317 # then root (as is common when checked out via git).
318 #
8188de86
MD
319.for ROOTSKEL in ${ROOTSKELS}
320 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
5af45f85
MD
321 @test -O ${.CURDIR} || echo "chowning copied files to root:wheel"
322 @test -O ${.CURDIR} || ((cd ${ROOTSKEL} && find .) | fgrep -v cpignore | (cd ${ISOROOT} && xargs chown root:wheel))
8188de86 323.endfor
7249926b 324 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
4fba3387
CP
325.for UPGRADE_ITEM in Makefile \
326 etc.${MACHINE_ARCH} \
327 isdn/Makefile \
328 rc.d/Makefile \
329 periodic/Makefile \
330 periodic/daily/Makefile \
331 periodic/security/Makefile \
332 periodic/weekly/Makefile \
333 periodic/monthly/Makefile
334 cp -R ${.CURDIR}/../etc/${UPGRADE_ITEM} ${ISOROOT}/etc/${UPGRADE_ITEM}
335.endfor
8abe78a1
MD
336 #
337 # Setup some things & mount pkgsrc tree. Use defensive umounts and
338 # rm -rf's to allow restarts. Allow /usr/pkgsrc to be read-only.
339 #
340 # If we did not get past the bootstrap we clean out the entire
341 # /usr/pkg infrastructure. Otherwise we attempt to pick up where
342 # we left off.
343 #
fbc26094 344 cp -p /etc/resolv.conf ${ISOROOT}/etc
cc55a235 345 ${CHROOT_CMD} "ldconfig -elf /usr/lib /usr/lib/gcc* /usr/lib/compat"
8abe78a1
MD
346 -@umount ${ISOROOT}/usr/pkgsrc/distfiles
347 -@umount ${ISOROOT}/usr/pkgsrc
45e80934 348 -@umount ${ISOROOT}/dev
8abe78a1
MD
349 mkdir -p ${ISODIR}/distfiles
350 rm -rf ${ISOROOT}/usr/pkgobj
8abe78a1 351 #
1eeae16f
MD
352 # Mount /usr/pkgsrc, make sure /usr/pkgsrc/distfiles is writable.
353 # Make /usr/pkgsrc read-only for safety, else a failed umount and
354 # our rm -rf will do bad things.
8abe78a1
MD
355 #
356 mkdir -p ${ISOROOT}/usr/pkgobj
3aa2328e 357 mkdir -p ${ISOROOT}/usr/pkgobj/bootstrap
8abe78a1 358 mkdir -p ${ISOROOT}/usr/pkgsrc
1eeae16f 359 mount_null -o ro ${PKGSRC_PATH} ${ISOROOT}/usr/pkgsrc
0c5de895 360 mount_null /dev ${ISOROOT}/dev
5af45f85
MD
361 cp /etc/shells ${ISOROOT}/usr/pkgsrc/distfiles/.test > /dev/null 2>&1 \
362 || mount_null ${ISODIR}/distfiles ${ISOROOT}/usr/pkgsrc/distfiles
8abe78a1 363 #
5af45f85 364 # Bootstrap, if not already installed, and add licenses needed
ee3561ee 365 # for the gui release
8abe78a1 366 #
c19c746b
MD
367 test -e ${ISODIR}/.didbootstrap || \
368 rm -rf ${ISOROOT}/usr/pkg ${ISOROOT}/var/db/pkg \
369 ${ISOROOT}/var/db/pkg.refcount
370 test -e ${ISODIR}/.didbootstrap || \
371 ${CHROOT_CMD} "cd /usr/pkgsrc/bootstrap; \
cc628e36 372 export share_dir=/usr/pkgobj/bootstrap/work/share; \
8abe78a1 373 ./bootstrap --workdir /usr/pkgobj/bootstrap/work"
3fff415b 374.if make(gui)
c19c746b
MD
375 test -e ${ISODIR}/.didbootstrap || \
376 echo ".ifdef BSD_PKG_MK # added by nrelease" \
ee3561ee 377 >> ${ISOROOT}/usr/pkg/etc/mk.conf
c19c746b
MD
378 test -e ${ISODIR}/.didbootstrap || \
379 echo "ACCEPTABLE_LICENSES+=openmotif-license" \
ee3561ee 380 >> ${ISOROOT}/usr/pkg/etc/mk.conf
c19c746b
MD
381 test -e ${ISODIR}/.didbootstrap || \
382 echo "ACCEPTABLE_LICENSES+=vim-license" \
ee3561ee 383 >> ${ISOROOT}/usr/pkg/etc/mk.conf
c19c746b
MD
384 test -e ${ISODIR}/.didbootstrap || \
385 echo ".endif # added by nrelease" \
ee3561ee 386 >> ${ISOROOT}/usr/pkg/etc/mk.conf
3fff415b 387.endif
c19c746b
MD
388 test -e ${ISODIR}/.didbootstrap || sync
389 test -e ${ISODIR}/.didbootstrap || touch ${ISODIR}/.didbootstrap
8abe78a1
MD
390 #
391 # Build and install packages, skip packages already installed
392 #
bce110a5 393.for PKG in ${PKGSRC_PACKAGES}
8abe78a1 394 ${CHROOT_CMD} "cd /usr/pkgsrc/${PKG} && \
3fff415b
SW
395 (bmake check > /dev/null 2>&1 || \
396 bmake ${PKGSRC_OPTIONS} clean build install)"
8188de86 397.endfor
8abe78a1
MD
398 #
399 # Remove packages which nothing depends on and clean up
400 #
cc55a235 401 ${CHROOT_CMD} "pkg_leaves | xargs pkg_delete -R"
8abe78a1 402 -umount ${ISOROOT}/usr/pkgsrc/distfiles
45e80934 403 umount ${ISOROOT}/dev
fbc26094 404 umount ${ISOROOT}/usr/pkgsrc
589a5738 405 rm -rf ${ISOROOT}/usr/pkgobj
fbc26094 406 rm -f ${ISOROOT}/etc/resolv.conf
3652f053 407 makewhatis ${ISOROOT}/usr/pkg/man
6ca9a59c 408
0936984e
MD
409# So locate works
410#
8398ca17
SW
411mklocatedb:
412 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
413 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
414 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
415 /usr/libexec/locate.mklocatedb \
416 -presort >${ISOROOT}/var/db/locate.database )
417
6ca9a59c 418mkiso:
bce110a5 419 ( cd ${ISOROOT}; ${PKGBIN_MKISOFS} -b boot/cdboot -no-emul-boot \
74ec6a9d 420 -R -J -o ${ISOFILE} \
64bba8c7 421 -V "DragonFly `${.CURDIR}/../tools/gitrev.sh | cut -c -22`" . )
6ca9a59c 422
b9c3e754
MN
423
424mkimg:
fbc26094 425.if make(img)
60b68cbb 426 if [ ! -d ${IMGMNT} ]; then mkdir -p ${IMGMNT}; fi
9a122c9a
MD
427 -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \
428 vnconfig -u `cat ${ISODIR}/vn.which`; fi
429 @echo "STEP: determine required image size"
60b68cbb 430 sz=`du -ck ${ISOROOT} | tail -n 1 | cut -f 1`; \
9a122c9a
MD
431 sz=`bc -e "(($${sz}) / 1024) * 1.15" -equit | cut -f1 -d.`; \
432 dd if=/dev/zero of=${IMGFILE} bs=1m count=$${sz};
433 fdisk -IB -p ${IMGFILE}
434 @echo "STEP: determine free vn device"
435 vnconfig -l | grep "not in use" | head -n 1 | \
436 cut -f 1 -d: > ${ISODIR}/vn.which
437 vnconfig -e -s labels `cat ${ISODIR}/vn.which` ${IMGFILE}
438 @echo "STEP: write standard disklabel"
439 disklabel -w -r `cat ${ISODIR}/vn.which`s1 auto
440 @echo "STEP: read disklabel back"
441 disklabel -r `cat ${ISODIR}/vn.which`s1 > ${IMGFILE}.label
442 @echo "STEP: determine number of sectors of whole disk"
60b68cbb 443 secs=`tail -n 1 ${IMGFILE}.label | cut -f 3 -w`; \
9a122c9a
MD
444 echo " a: $${secs} 0 4.2BSD" >> ${IMGFILE}.label;
445 @echo "STEP: write modified disklabel back"
446 disklabel -R -r `cat ${ISODIR}/vn.which`s1 ${IMGFILE}.label
447 rm ${IMGFILE}.label
448 @echo "STEP: write bootsector"
449 disklabel -B `cat ${ISODIR}/vn.which`s1
450 boot0cfg -B -o noupdate `cat ${ISODIR}/vn.which`
451 newfs /dev/`cat ${ISODIR}/vn.which`s1a
452 mount /dev/`cat ${ISODIR}/vn.which`s1a ${IMGMNT}
453 cpdup ${ISOROOT} ${IMGMNT}
454 @echo "STEP: fixup ${IMGMNT}/etc/fstab"
e36bedaf 455 echo "/dev/${IMGUSBDEV}s1a / ufs rw,noatime 0 1" > ${IMGMNT}/etc/fstab
9a122c9a
MD
456 echo "proc /proc procfs rw 0 0" >> ${IMGMNT}/etc/fstab
457 @echo "STEP: fixup ${IMGMNT}/boot/loader.conf"
458 -fgrep -v kernel_options ${IMGMNT}/boot/loader.conf > ${IMGMNT}/boot/loader.conf.new
459 echo 'vfs.root.mountfrom="ufs:${IMGUSBDEV}s1a"' >> ${IMGMNT}/boot/loader.conf.new
460 mv ${IMGMNT}/boot/loader.conf.new ${IMGMNT}/boot/loader.conf
461 @echo "STEP: cleanup"
462 df ${IMGMNT}
463 umount ${IMGMNT}
464 vnconfig -u `cat ${ISODIR}/vn.which`
465 rm -f ${ISODIR}/vn.which
60b68cbb 466 rmdir ${IMGMNT}
9a122c9a 467 @echo "STEP: done"
b9c3e754
MN
468.endif
469
6ca9a59c 470clean:
c19c746b
MD
471 -umount ${ISOROOT}/usr/pkgsrc/distfiles > /dev/null 2>&1
472 -umount ${ISOROOT}/usr/pkgsrc > /dev/null 2>&1
9a122c9a
MD
473 -umount ${ISOROOT}/dev > /dev/null 2>&1
474 -if [ -f ${ISODIR}/vn.which ]; then umount ${IMGMNT}; \
475 vnconfig -u `cat ${ISODIR}/vn.which`; fi
6ca9a59c 476 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
c19c746b
MD
477 rm -rf ${ISOROOT}
478 rm -rf ${NRLOBJDIR}/nrelease
9a122c9a 479 rm -f ${ISODIR}/.didbootstrap ${ISODIR}/vn.which
6ca9a59c
MD
480
481realclean: clean
3ebedc5e 482 rm -rf ${OBJSYS}/${KERNCONF}
8abe78a1 483 #
bce110a5
MD
484 # do not use PKGSRC_PKG_PATH here, we do not want to destroy an
485 # override location.
8abe78a1 486 #
c19c746b
MD
487 rm -rf ${ISODIR}/packages
488 rm -rf ${ISODIR}/distfiles
6ca9a59c 489
bce110a5 490pkgsrc_bootstrap:
0936984e 491 mkdir -p /usr/release/bootstrap
cc628e36
MD
492 (cd ${PKGSRC_PATH}/bootstrap; \
493 export share_dir=/usr/release/bootstrap/share; \
494 ./bootstrap --workdir /usr/release/bootstrap)
bce110a5 495
bce110a5
MD
496pkgsrc_cdrecord:
497.if !exists (${PKGBIN_MKISOFS})
0936984e 498 (cd ${PKGSRC_PATH}/sysutils/cdrtools; bmake clean build install)
bce110a5 499.endif
cc224c64 500
e2dbfa0b 501help all:
5af45f85
MD
502 @echo "make [gui] release - complete build from scratch"
503 @echo "make [gui] quick - attempt to do an incremental rebuild"
504 @echo "make [gui] realquick - attempt to restart after world & kernel"
505 @echo "make [gui] restartpkgs - attempt to restart at the pkg building stage"
8abe78a1
MD
506 @echo ""
507 @echo "Extra packages may be specified with PKGSRC_EXTRA_PACKAGES"
588a679c 508
e2dbfa0b
TN
509.PHONY: release quickrel realquickrel
510.PHONY: installer
9b29c40a 511.PHONY: quick realquick
e2dbfa0b 512.PHONY: check buildworld1 buildworld2
b9c3e754 513.PHONY: buildkernel1 buildkernel2 buildiso customizeiso mklocatedb mkiso mkimg
796fd273 514.PHONY: clean realclean help all srcs
cc224c64 515
6ca9a59c 516.include <bsd.prog.mk>