source: hybrid/branches/releng-9.0/nanobsd/cfg/nanobsd.wleiden@ 10650

Last change on this file since 10650 was 10612, checked in by rick, 13 years ago

Make port building whole bunch more stupid:

1) Bundle ports in the tree itself, instead of global shared banch.
2) Copy the local ports just in the /usr/ports tree to allow playing around

with just the ordenary tools.

File size: 13.4 KB
Line 
1## Dit is een NanoBSD configuratie-template voor WirelessLeiden.
2## Instellingen weergegeven binnen dit bestand gelden als
3## standaard binnen de organisatie.
4
5# Little hack to allow proper secify of KERNL/PKG location
6if [ -n "$NANO_CFG_FILE" ]; then
7 NANO_CONF_DIR=$(cd $(dirname $NANO_CFG_FILE); pwd -P)
8else
9 NANO_CONF_DIR=$(cd $(dirname $2); pwd -P)
10fi
11
12# object naam in /usr/obj/nanobsd.{obj}
13NANO_NAME=wleiden-hybrid
14NANO_SRC=/usr/src # nanobsd source tree
15NANO_KERNEL=$NANO_CONF_DIR/kernel.wleiden # naam van het kernel configuratiebestand
16NANO_IMAGES=2 # aantal nanobsd code slices/installs (1/2)
17
18NANO_CONFSIZE=8192 # volume van de config slice, default 2048 (512bs)
19NANO_DATASIZE=0 # volume van de data slice, 0 = not configured
20NANO_CODESIZE=819200
21NANO_RAM_TMPVARSIZE=20480
22
23NANO_DRIVE=ada0
24
25#XXX: Eeks, fixed packages, needs building a hook to allow building the package
26# of the shelfs if needed, copy to right directory, done. With only input needed
27# a list of ports in the format like net/net-snmp
28NANO_PACKAGE_DIR=$NANO_CONF_DIR/../pkg/All
29
30# Wireless Leiden ports from $WL_PORTSDIR are copied OVER $PORTSDIR
31PORTSDIR='/usr/ports'
32WL_PORTSDIR="$NANO_CONF_DIR/../ports/"
33
34# Dirty quirk to allow comments in part below
35PACKAGE_LIST=`cat <<EOF | sed -e 's/#.*$//g' | xargs
36benchmarks/iperf
37devel/py-Jinja2
38devel/py-yaml
39dns/dnsmasq
40editors/vim-lite
41ftp/curl
42lang/python
43net-mgmt/net-snmp
44net/isc-dhcp42-server
45net/pen
46net/sixxs-aiccu
47security/nmap
48security/openvpn
49security/sudo
50shells/bash-static
51sysutils/screen
52sysutils/ucspi-tcp
53www/thttpd
54www/tinyproxy
55
56# Extra WL ports
57net/lvrouted
58`
59# Package target
60# Dirty quirk to allow comments in part below
61PKG_MAKE_ARGS=`cat <<EOF | sed 's/#.*$//g' | xargs
62PACKAGES=$(dirname $NANO_PACKAGE_DIR)
63BATCH=yes PACKAGE_BUILDING=yes
64# www/py-cherrypy
65WITH_APACHE=yes
66# net-mgmt/net-snmp
67WITHOUT_PERL=yes
68# net-mgmt/nagios-plugins
69WITH_FPING=yes
70# threads is broken in the version (atleast up to 9.0 - 20120213)
71# Should be fix in current version in linux, but for some reason
72# Not yet in BSD. We don't need threads
73WITHOUT_THREADS=yes
74# shells/bash-static
75WITH_SYSLOG=yes
76`
77
78##NANO_PACKAGE_LIST=
79
80# Warning: set to 1 to debug make build errors
81# Number of recurrent parrallel make builds
82if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then
83 # Mac OS X Parallels virtual machine
84 NANO_PMAKE="make -B"
85else
86 # Default 2 times number of CPU's inside machine
87 NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2`
88 NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}"
89fi
90
91# Starting from soekris bios version 1.31 upwards boot0sio does not seems work
92# anymore, but boot0 does (weird)
93NANO_BOOTLOADER="boot/boot0"
94
95# Strip down to a more acceptable size
96# hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB)
97NANO_PRUNE="$NANO_PRUNE usr/share/examples"
98NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
99NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
100# NB! usr/share/misc contains termcap, vi(1) etc fails to work without it.
101# NANOBSD_PRUNE += usr/share/misc
102NANO_PRUNE="$NANO_PRUNE usr/share/pcvt"
103NANO_PRUNE="$NANO_PRUNE usr/share/me"
104NANO_PRUNE="$NANO_PRUNE usr/share/doc"
105
106
107
108
109
110# Opties parsed gedurende build & install world
111# Also check man 3 src.conf for details
112# Some flags are misleading, e.g. could only be installworld (e.g.), for details:
113# http://phk.freebsd.dk/misc/build_options/
114# For details on make options also check:
115# /usr/src/share/mk/bsd.own.mk
116CONF_COMMON='
117# Specific enabled options
118#WITHOUT_ACPI=YES # geen advanced configuration power interface
119#WITHOUT_BIND=YES # geen bind tools, dns/named geinstalleerd
120#WITHOUT_CXX=YES # Set to not build g++(1) and related libraries.
121#WITHOUT_GROFF=YES # Set to not build groff(1).
122#WITHOUT_INET6=YES # geen ondersteuning inet versie 6 architectuur
123#WITHOUT_INFO=YES # geen info bestanden, readable online docs
124#WITHOUT_IPFILTER=YES # geen ip filtering geinstalleerd
125#WITHOUT_KLDLOAD=YES # do not allow loading of kernel modules
126#WITHOUT_MAILWRAPPER=YES # geen mailwrapper bij gebruik sendmail
127#WITHOUT_MAN=YES # geen handleidingen gecompileerd
128#WITHOUT_MISC=YES # geen misc sub directory
129#WITHOUT_MODULES=YES # geen ondersteuning toevoegen modules
130#WITHOUT_PAM=YES # geen ondersteuning pa modules
131#WITHOUT_PF=YES # geen packet filtering geinstalleerd
132#WITHOUT_SHARE=YES # geen share sub directory
133#WITHOUT_USB=YES # geen ondersteuning usb modules
134# Specific disabled options
135WITHOUT_ATM=YES # geen ondersteuning Asynchronous Transfer Mode
136WITHOUT_AUDIT=YES # geen event auditing / audit trails
137WITHOUT_AUTHPF=YES # geen authenticating gateway user shell
138WITHOUT_BLUETOOTH=YES # geen ondersteuning Bluetooth modules
139WITHOUT_CALENDAR=YES # geen calendar reminder service gecompileerd
140WITHOUT_CDDL=YES # Set to not build code licensed under Sun CDDL. (also ZFS)
141WITHOUT_CPP=YES # Set to not build cpp(1).
142WITHOUT_CVS=YES # geen cvs tools geinstalleerd
143WITHOUT_DICT=YES # geen dictionary ondersteuning
144WITHOUT_EXAMPLES=YES # geen voorbeeld configuratiebestanden
145WITHOUT_FORTRAN=YES # geen ondersteuning fortran compilers
146WITHOUT_GAMES=YES # geen games gecompileerd
147WITHOUT_GCOV=YES # geen gcov test coverage program
148WITHOUT_GDB=YES # geen gnu debugger gecompileerd
149WITHOUT_GPIB=YES # geen ondersteuning gpib kaarten
150WITHOUT_HTML=YES # geen html help bestanden gecompileerd
151WITHOUT_I4B=YES # geen ondersteuning voor isdn
152WITHOUT_IPX=YES # geen ondersteuning ipx protocols
153WITHOUT_KERBEROS=YES # geen ondersteuning Kerberos authenticatie
154WITHOUT_LOCALES=YES # geen ondersteuning lokalisatie
155WITHOUT_LPR=YES # geen ondersteuning print services
156WITHOUT_NIS=YES # geen ondersteuning network information system
157WITHOUT_PROFILE=YES # Set to avoid compiling profiled libraries.
158WITHOUT_RCMDS=YES # geen ondersteuning rcmds,
159WITHOUT_RESCUE=YES # geen rescue bestanden gecompileerd
160WITHOUT_SENDMAIL=YES # geen sendmail geinstalleerd
161WITHOUT_SHAREDOCS=YES # geen share/docs directories
162WITHOUT_SYSCONS=YES # geen syscon devices gecompileerd
163'
164
165CONF_BUILD="
166${CONF_COMMON}
167"
168
169CONF_INSTALL="
170${CONF_COMMON}
171WITHOUT_TOOLCHAIN=YES # geen freebsd toolchain
172"
173
174
175# Flash disks arrived, sandisk 1g seems to match the geometry of the (blanc) cards
176#FlashDevice sandisk 1g # nanobsd flashdevice entry
177#FlashDevice sandisk 512mb # nanobsd flashdevice entry
178#FlashDevice transcend 2g # nanobsd flashdevice entry
179# Calculated value of PEAK hardware 1GB CF card
180# C/H/S phys 1954/16/63, logical 977/32/63
181# Mediasize is calculated as C*H*S*512
182
183# Using logical values reported by ALIX board
184# values for PCEngines blanc 1 GB cards
185# C/H/S phys 1966/16/63, logical 983/32/63
186NANO_MEDIASIZE=`expr 1008451584 / 512`
187NANO_HEADS=32
188NANO_SECTS=63
189
190
191# Version tagging
192cust_version_tag() (
193 VERSION_FILE="${NANO_WORLDDIR}/tools/wl-release.txt"
194 (
195 echo "Generated by `id -un`@`hostname -f` at `date`"
196 echo ""
197 echo "=== CONFIG specifics ==="
198 svn info ${NANO_CONF_DIR}/../ || exit 0
199 svn diff ${NANO_CONF_DIR}/../ || exit 0
200 echo "=== BEGIN CONFIG specifics ==="
201 ) > $VERSION_FILE
202)
203
204# Takes a very long time (10+) minutes to generate this file on an ALIX board,
205# not practical for quick debugging and configuration.
206cust_openvpn_dhparam() (
207 DHFILE=${NANO_WORLDDIR}/etc/easy-rsa-keys/dh1024.pem
208 mkdir -p `dirname $DHFILE`
209 openssl dhparam -out $DHFILE 1024
210)
211
212
213
214# Assuming we are running a safe envirionment where snooping could occur during or after the build
215cust_set_root_password() (
216 if [ -n "${CFG_ROOT_PASSWORD}" ]; then
217 pprint 2 "Set root password using CFG_ROOT_PASSWORD variable"
218 chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -u root"
219 else
220 pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD"
221 fi
222)
223
224
225
226# EXPERIMENTAL patch like envirionment
227# Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to
228# keep us as close as possible to the base OS
229# Patches are applied to the directory they live in
230cust_apply_nanobsd_patches() (
231 for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do
232 cd `dirname ${PATCHFILE}`
233 patch -t -N -p0 -i `basename ${PATCHFILE}`
234 #XX: What to with installed patch files? Delete them for the time beeing
235 rm -v ${PATCHFILE}
236 done
237
238
239
240)
241
242
243
244# Compile & install lvroute daemon vanuit source in svn
245cust_install_lvrouted() (
246 svn co http://svn.wirelessleiden.nl/svn/node-config/other/lvrouted/trunk/ /tmp/lvrouted
247 cd /tmp/lvrouted && autoconf && autoheader && ./configure && make || true
248 cp src/lvrouted.opt ${NANO_WORLDDIR}/usr/local/sbin
249)
250
251
252
253# Customize ntpd
254cust_ntpd() (
255 chroot ${NANO_WORLDDIR} sh -c "ln -fs /usr/local/etc/ntp.drift /var/db/ntp.drift"
256)
257
258
259# Enable Serial TTYs
260cust_serial_ttys() (
261 chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyv[1-9]/s/on /off/' -e '/ttyu0/s/off/on/' -e '/ttyu0/s/dialup/ansi/' /etc/ttys
262)
263
264
265
266# Install files from specific relative location
267cust_install_files () (
268 cd ${NANO_CONF_DIR}/../files
269 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${NANO_WORLDDIR}
270)
271
272
273# pkgdb should live on persistent storage only
274cust_alternate_pkg_db () (
275 mkdir -p ${NANO_WORLDDIR}/usr/local/var/db/pkg ${NANO_WORLDDIR}/usr/local/tmp
276 touch ${NANO_WORLDDIR}/usr/local/tmp/.hack-to-avoid-pruning-directory
277 # sh profile
278 ( echo 'PKG_DBDIR=/usr/local/var/db/pkg; export PKG_DBDIR'; \
279 echo 'PKG_TMPDIR=/usr/local/tmp; export PKG_TMPDIR' ) >> ${NANO_WORLDDIR}/etc/profile
280 # csh profile
281 ( echo 'setenv PKG_DBDIR /usr/local/var/db/pkg'; \
282 echo 'setenv PKG_TMPDIR /usr/local/tmp' ) >> ${NANO_WORLDDIR}/etc/csh.cshrc
283
284 rmdir ${NANO_WORLDDIR}/var/db/pkg
285 ln -s /usr/local/var/db/pkg ${NANO_WORLDDIR}/var/db/pkg
286)
287
288# Make tools available for root by default
289cust_root_bin_to_tools() {
290 ln -s /tools ${NANO_WORLDDIR}/root/bin
291}
292
293# Directly stolen from /usr/src/tools/tools/nanobsd/nanobsd.sh, and make sure
294# to source /etc/profile in chroot to get PKG_* included, for alternate installs
295cust_pkg () (
296
297 # If the package directory doesn't exist, we're done.
298 if [ ! -d ${NANO_PACKAGE_DIR} ]; then
299 echo "DONE 0 packages"
300 return 0
301 fi
302
303 # Copy packages into chroot
304 mkdir -p ${NANO_WORLDDIR}/Pkg
305 (
306 cd ${NANO_PACKAGE_DIR}
307 find ${NANO_PACKAGE_LIST} -print |
308 cpio -Ldumpv ${NANO_WORLDDIR}/Pkg
309 )
310
311 # Count & report how many we have to install
312 todo=`ls ${NANO_WORLDDIR}/Pkg | wc -l`
313 echo "=== TODO: $todo"
314 ls ${NANO_WORLDDIR}/Pkg
315 echo "==="
316 NANO_PKG_DBDIR=${NANO_WORLDDIR}/`chroot ${NANO_WORLDDIR} sh -c '. /etc/profile; echo ${PKG_DBDIR:-/var/db/pkg}'`
317 while true
318 do
319 # Record how many we have now
320 have=`ls ${NANO_PKG_DBDIR} | wc -l`
321
322 # Attempt to install more packages
323 # ...but no more than 200 at a time due to pkg_add's internal
324 # limitations.
325 chroot ${NANO_WORLDDIR} sh -c \
326 '. /etc/profile; ls Pkg/*tbz | xargs -n 200 pkg_add -F' || true
327
328 # See what that got us
329 now=`ls ${NANO_PKG_DBDIR} | wc -l`
330 echo "=== NOW $now"
331 ls ${NANO_PKG_DBDIR}
332 echo "==="
333
334
335 if [ $now -eq $todo ] ; then
336 echo "DONE $now packages"
337 break
338 elif [ $now -eq $have ] ; then
339 echo "FAILED: Nothing happened on this pass"
340 exit 2
341 fi
342 done
343 rm -rf ${NANO_WORLDDIR}/Pkg
344)
345
346
347# Prune no needed directories of image
348cust_nano_prune () (
349 cd ${NANO_WORLDDIR}
350 for ENTRY in ${NANO_PRUNE}; do
351 rm -vfR ${ENTRY}
352 done
353)
354
355
356# Fill /cfg with custom files, based on 'create_i386_diskimage ( )'
357last_nano_fill_cfg () (
358 # Variables to be used
359 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
360 MNT=${MAKEOBJDIRPREFIX}/_.mnt
361
362 # Mount '/cfg' slize in image
363 MD=`mdconfig -a -t vnode -f ${IMG}`
364 mount /dev/${MD}s3 ${MNT}
365
366 # Location of '/cfg' directory
367 cd ${NANO_CONF_DIR}/../cfg-files
368 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
369
370
371 # Leave in nice end state
372 umount ${MNT}
373 mdconfig -d -u ${MD}
374) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
375
376last_nano_disk_usage () (
377 # Variables to be used
378 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
379 MNT=${MAKEOBJDIRPREFIX}/_.mnt
380
381 # Mount root slize
382 MD=`mdconfig -a -t vnode -f ${IMG}`
383 mount /dev/${MD}s1a ${MNT}
384
385 # Show disk usage (percent free) inc header
386 pprint 2 $(df -h | head -1)
387 pprint 2 "$(df -h | grep /dev/${MD})"
388
389 # Leave in nice end state
390 umount ${MNT}
391 mdconfig -d -u ${MD}
392)
393
394last_orders () (
395 last_nano_fill_cfg
396 last_nano_disk_usage
397)
398
399# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
400# instead of a file
401exec 3>/dev/stdout
402# Progress Print
403# Print $2 at level $1
404pprint() {
405 if [ "$1" -le $PPLEVEL ]; then
406 printf "%.${1}s %s\n" "#####" "$2" 1>&3
407 fi
408}
409
410# Cust macro`s gestart in onderstaande volgorde
411# XXX: Determine size before installing all find of additions to see how much
412# base we are actually using ## du -h -d 0
413customize_cmd cust_alternate_pkg_db
414customize_cmd cust_pkg
415customize_cmd cust_install_files
416customize_cmd cust_ntpd
417customize_cmd cust_serial_ttys
418customize_cmd cust_version_tag
419customize_cmd cust_root_bin_to_tools
420customize_cmd cust_allow_ssh_root
421customize_cmd cust_openvpn_dhparam
422customize_cmd cust_nano_prune
423customize_cmd cust_set_root_password
424customize_cmd cust_apply_nanobsd_patches
425
426# Standard overwrite
427if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then
428 . $NANO_CONF_DIR/nanobsd.local
429fi
430
431# Extra config if existing is not suffient
432if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
433 for FILE in $EXTRA_NANOBSD_CONFIG; do
434 # File relative to config directory
435 if [ "`echo $FILE | cut -c1`" != "/" ]; then
436 FILE=$NANO_CONF_DIR/$FILE
437 fi
438 pprint 1 "Loading $FILE"
439 . $FILE || exit 1
440 done
441fi
Note: See TracBrowser for help on using the repository browser.