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

Last change on this file since 10447 was 10408, checked in by rick, 13 years ago

FAT hybrid helpers needed.

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