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

Last change on this file since 10799 was 10764, checked in by rick, 13 years ago

Properly do not need /dev/ttyv0 as well.

login: May 10 00:06:49 HybridRick2 getty[2031]: open /dev/ttyv0: No such file or directory

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