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

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

Use the shell/bash-static else package building does not generate the proper
symlink to include package on system.

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