PAM is dead, long live PAM!
[dragonfly.git] / nrelease / Makefile
CommitLineData
ab64cf06 1# $DragonFly: src/nrelease/Makefile,v 1.37 2005/07/13 15:25:32 corecode Exp $
6ca9a59c 2#
5b22b655 3
6ca9a59c
MD
4ISODIR ?= /usr/release
5ISOFILE ?= ${ISODIR}/dfly.iso
6ISOROOT = ${ISODIR}/root
7OBJSYS= ${.OBJDIR}/../sys
8KERNCONF ?= GENERIC
9
8188de86
MD
10# Specify which packages are required on the ISO, and let the user
11# specify additional packages to include. During the `pkgaddiso'
12# target, the packages are obtained from PACKAGES_LOC.
13#
3b4d7f2d 14REQ_PACKAGES= cdrtools-2.01 cvsup-without-gui-16.1h
bf9b513b
JS
15REL_PACKAGES?= ${REQ_PACKAGES} ${EXTRA_PACKAGES}
16.if defined(PACKAGES)
17PACKAGES_LOC?= ${PACKAGES}/All
18.else
8188de86 19PACKAGES_LOC?= /usr/ports/packages/All
bf9b513b 20.endif
8188de86
MD
21
22# Specify which root skeletons are required, and let the user include
23# their own. They are copied into ISODIR during the `pkgcustomizeiso'
24# target; each overwrites the last.
25#
26REQ_ROOTSKELS= ${.CURDIR}/root
27ROOTSKELS?= ${REQ_ROOTSKELS} ${EXTRA_ROOTSKELS}
28
5b22b655
MD
29# note: we use the '${NRLOBJDIR}/nrelease' construct, that is we add
30# the additional '/nrelease' manually, as a safety measure.
31#
32NRLOBJDIR?= /usr/obj
33
acc392b5
JS
34WORLD_CCVER ?= ${CCVER}
35KERNEL_CCVER ?= ${CCVER}
36
8188de86
MD
37#########################################################################
38# BASE ISO TARGETS #
39#########################################################################
40
41release: check clean buildworld1 buildkernel1 \
8398ca17 42 buildiso customizeiso pkgaddiso mklocatedb mkiso
8188de86
MD
43
44quickrel: check clean buildworld2 buildkernel2 \
8398ca17 45 buildiso customizeiso pkgaddiso mklocatedb mkiso
8188de86
MD
46
47realquickrel: check clean \
8398ca17 48 buildiso customizeiso pkgaddiso mklocatedb mkiso
6ca9a59c 49
8188de86
MD
50#########################################################################
51# ISO TARGETS WITH INSTALLER #
52#########################################################################
6ca9a59c 53
e94931c5
MD
54INSTALLER_PKGS= libaura-3.1 libdfui-4.1 libinstaller-5.1 \
55 dfuibe_installer-1.1.6 dfuife_curses-1.5 \
56 thttpd-notimeout-2.24 dfuife_cgi-1.4
8188de86
MD
57INSTALLER_SKELS= installer
58
10dd2a9b
CP
59INSTALLER_ENV= EXTRA_PACKAGES="${INSTALLER_PKGS} ${EXTRA_PACKAGES}" \
60 EXTRA_ROOTSKELS="${INSTALLER_SKELS} ${EXTRA_ROOTSKELS}"
8188de86
MD
61
62installer_check:
63 @${INSTALLER_ENV} ${MAKE} check
64
2e3f8f38
MD
65installer_fetchpkgs:
66 @${INSTALLER_ENV} ${MAKE} fetchpkgs
67
8188de86
MD
68installer_release:
69 ${INSTALLER_ENV} ${MAKE} release
70
71installer_quickrel:
72 ${INSTALLER_ENV} ${MAKE} quickrel
73
74installer_realquickrel:
75 ${INSTALLER_ENV} ${MAKE} realquickrel
76
77#########################################################################
78# HELPER TARGETS #
79#########################################################################
6ca9a59c 80
d2582113 81check:
8188de86 82 @if [ ! -f /usr/local/bin/mkisofs ]; then \
755f2cbd
MD
83 echo "You need to install the sysutils/cdrtools port for"; \
84 echo "this target"; \
8188de86
MD
85 exit 1; \
86 fi
bf9b513b 87.for PKG in ${REL_PACKAGES}
8188de86 88 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
16d62894
CP
89 echo "Unable to find ${PACKAGES_LOC}/${PKG}.tgz."; \
90 echo "(Perhaps you need to download or build it first?)"; \
8188de86
MD
91 echo ""; \
92 echo "If you are trying to build the installer, the"; \
93 echo "required packages can be obtained from:"; \
16d62894
CP
94 echo ""; \
95 echo " http://www.bsdinstaller.org/packages/"; \
96 echo ""; \
97 echo "They can be automatically downloaded by issuing"; \
98 echo "'make installer_fetchpkgs' from this directory."; \
99 echo ""; \
8188de86
MD
100 exit 1; \
101 fi
102.endfor
103 @echo "check: all preqs found"
6ca9a59c 104
2e3f8f38 105fetchpkgs:
bf9b513b 106.for PKG in ${REL_PACKAGES}
2e3f8f38
MD
107 @if [ ! -f ${PACKAGES_LOC}/${PKG}.tgz ]; then \
108 cd ${PACKAGES_LOC} && \
109 echo "fetching ${PKG}..." && \
110 fetch http://www.bsdinstaller.org/packages/${PKG}.tgz; \
111 fi
112.endfor
113
6ca9a59c 114buildworld1:
c3f3fe6d 115 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make buildworld )
6ca9a59c
MD
116
117buildworld2:
82a1be39 118 ( cd ${.CURDIR}/..; CCVER=${WORLD_CCVER} make quickworld )
6ca9a59c
MD
119
120buildkernel1:
c3f3fe6d 121 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make buildkernel KERNCONF=${KERNCONF} )
6ca9a59c
MD
122
123buildkernel2:
82a1be39 124 ( cd ${.CURDIR}/..; CCVER=${KERNEL_CCVER} make quickkernel KERNCONF=${KERNCONF} )
6ca9a59c 125
5b22b655
MD
126# note that we do not want to mess with any /usr/obj directories not related
127# to buildworld, buildkernel, or nrelease, so we must supply the proper
128# MAKEOBJDIRPREFIX for targets that are not run through the buildworld and
129# buildkernel mechanism.
130#
6ca9a59c
MD
131buildiso:
132 if [ ! -d ${ISOROOT} ]; then mkdir -p ${ISOROOT}; fi
5b22b655 133 if [ ! -d ${NRLOBJDIR}/nrelease ]; then mkdir -p ${NRLOBJDIR}/nrelease; fi
6ca9a59c 134 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} installworld )
ab64cf06
SS
135 ( cd ${.CURDIR}/../etc; MAKEOBJDIRPREFIX=${NRLOBJDIR}/nrelease \
136 make -m ${.CURDIR}/../share/mk DESTDIR=${ISOROOT} distribution )
21aa02d0 137 cpdup ${ISOROOT}/etc ${ISOROOT}/etc.hdd
6ca9a59c
MD
138 ( cd ${.CURDIR}/..; make DESTDIR=${ISOROOT} \
139 installkernel KERNCONF=${KERNCONF} )
062db326 140 ${LN} -s kernel ${ISOROOT}/kernel.BOOTP
6ca9a59c
MD
141 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.local.dist -p ${ISOROOT}/usr/local/
142 mtree -deU -f ${.CURDIR}/../etc/mtree/BSD.var.dist -p ${ISOROOT}/var
143 dev_mkdb -f ${ISOROOT}/var/run/dev.db ${ISOROOT}/dev
8188de86
MD
144
145customizeiso:
146.for ROOTSKEL in ${ROOTSKELS}
147 cpdup -X cpignore -o ${ROOTSKEL} ${ISOROOT}
148.endfor
149 rm -rf `find ${ISOROOT} -type d -name CVS -print`
21aa02d0 150 rm -rf ${ISOROOT}/usr/local/share/pristine
7249926b 151 pwd_mkdb -p -d ${ISOROOT}/etc ${ISOROOT}/etc/master.passwd
8188de86
MD
152
153pkgcleaniso:
154 rm -f ${ISOROOT}/tmp/chrootscript
155 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 156.for PKG in ${REL_PACKAGES}
8188de86
MD
157 echo "pkg_delete -f ${PKG}" >> ${ISOROOT}/tmp/chrootscript
158.endfor
159 chmod a+x ${ISOROOT}/tmp/chrootscript
160 chroot ${ISOROOT}/ /tmp/chrootscript || exit 0
161 rm ${ISOROOT}/tmp/chrootscript
162
163pkgaddiso:
164 rm -f ${ISOROOT}/tmp/chrootscript
165 echo "#!/bin/sh" > ${ISOROOT}/tmp/chrootscript
bf9b513b 166.for PKG in ${REL_PACKAGES}
0272b808
CP
167 if [ ! -d ${ISOROOT}/var/db/pkg/${PKG} ]; then \
168 cp ${PACKAGES_LOC}/${PKG}.tgz ${ISOROOT}/tmp/${PKG}.tgz; \
169 echo "echo 'Installing package ${PKG}...' && \\" >> \
170 ${ISOROOT}/tmp/chrootscript; \
171 echo "pkg_add /tmp/${PKG}.tgz && \\" >> \
172 ${ISOROOT}/tmp/chrootscript; \
173 fi
8188de86 174.endfor
0272b808
CP
175 echo "echo 'All packages added successfully!'" >> \
176 ${ISOROOT}/tmp/chrootscript
8188de86
MD
177 chmod a+x ${ISOROOT}/tmp/chrootscript
178 chroot ${ISOROOT}/ /tmp/chrootscript
179 rm ${ISOROOT}/tmp/chrootscript
bf9b513b 180.for PKG in ${REL_PACKAGES}
8188de86
MD
181 rm -f ${ISOROOT}/tmp/${PKG}.tgz
182.endfor
6ca9a59c 183
8398ca17
SW
184mklocatedb:
185 ( find -s ${ISOROOT} -path ${ISOROOT}/tmp -or \
186 -path ${ISOROOT}/usr/tmp -or -path ${ISOROOT}/var/tmp \
187 -prune -o -print | sed -e 's#^${ISOROOT}##g' | \
188 /usr/libexec/locate.mklocatedb \
189 -presort >${ISOROOT}/var/db/locate.database )
190
6ca9a59c
MD
191mkiso:
192 ( cd ${ISOROOT}; mkisofs -b boot/cdboot -no-emul-boot \
382f1ee3 193 -R -J -V DragonFly -o ${ISOFILE} . )
6ca9a59c
MD
194
195clean:
196 if [ -d ${ISOROOT} ]; then chflags -R noschg ${ISOROOT}; fi
8188de86 197 if [ -d ${ISOROOT} ]; then rm -rf ${ISOROOT}/*; fi
5b22b655 198 if [ -d ${NRLOBJDIR}/nrelease ]; then rm -rf ${NRLOBJDIR}/nrelease; fi
6ca9a59c
MD
199
200realclean: clean
3ebedc5e 201 rm -rf ${OBJSYS}/${KERNCONF}
6ca9a59c
MD
202
203.include <bsd.prog.mk>