source: hybrid/branches/releng-10/nanobsd/cfg/nanobsd.wleiden@ 12897

Last change on this file since 12897 was 12896, checked in by rick, 10 years ago

We want good old dig and nslookup back

File size: 11.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
29NANO_PACKAGE_LIST="*"
30
31
32# Wireless Leiden ports from $WL_PORTSDIR are copied OVER $PORTSDIR
33PORTSDIR='/usr/ports'
34WL_PORTSDIR="$NANO_CONF_DIR/../ports/"
35
36# Dirty quirk to allow comments in part below
37PACKAGE_LIST=`cat <<EOF | sed -e 's/#.*$//g' | xargs
38benchmarks/iperf
39devel/py-Jinja2
40devel/py-yaml
41dns/dnsmasq
42dns/bind-tools
43editors/vim-lite
44ftp/curl
45lang/python2
46lang/python
47net-mgmt/iftop
48net-mgmt/net-snmp
49net-mgmt/nrpe
50net/mtr
51net/isc-dhcp42-server
52net/pen
53net/sixxs-aiccu
54security/nmap
55security/openvpn
56security/sudo
57shells/bash-static
58sysutils/screen
59sysutils/pftop
60sysutils/ucspi-tcp
61www/thttpd
62www/tinyproxy
63
64# Extra WL ports
65net/lvrouted
66`
67# Package target
68PKG_MAKE_ARGS="PACKAGES=$(dirname $NANO_PACKAGE_DIR) BATCH=yes PACKAGE_BUILDING=yes"
69
70PKG_MAKE_CONF="
71# www/py-cherrypy - include apache templating
72# net-mgmt/net-snmp - no perl please (size)
73# net-mgmt/nagios-plugins - no threading (single CPU)
74# shells/bash-static - logging via syslog
75# net/mtr - no X11 (no screen)
76OPTIONS_SET= APACHE FPING SYSLOG
77OPTIONS_UNSET= PERL PERL_EMBEDDED X11
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
232#cust_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# Customize ntpd
247cust_ntpd() (
248 chroot ${NANO_WORLDDIR} sh -c "ln -fs /usr/local/etc/ntp.drift /var/db/ntp.drift"
249)
250
251
252# Enable Serial TTYs
253cust_serial_ttys() (
254 chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyv[0-9]/s/on /off/' -e '/ttyu0/s/off/on/' -e '/ttyu0/s/dialup/ansi/' /etc/ttys
255)
256
257
258
259# Install files from specific relative location
260cust_install_files () (
261 cd ${NANO_CONF_DIR}/../files
262 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${NANO_WORLDDIR}
263)
264
265
266# Make tools available for root by default
267cust_root_bin_to_tools() {
268 ln -s /tools ${NANO_WORLDDIR}/root/bin
269}
270
271
272# Prune no needed directories of image
273cust_nano_prune () (
274 cd ${NANO_WORLDDIR}
275 for ENTRY in ${NANO_PRUNE}; do
276 rm -vfR ${ENTRY}
277 done
278)
279
280# We actually do need an seperate /tmp, so undo the symlinking done in
281# setup_nanobsd()
282late_cust_unset_common_var_and_tmp() (
283 cd ${NANO_WORLDDIR}
284 rm tmp
285 mkdir -m 1777 tmp
286)
287
288
289# Fill /cfg wmth custom files, based on 'create_i386_diskimage ( )'
290last_nano_fill_cfg () (
291 # Variables to be used
292 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
293 MNT=${MAKEOBJDIRPREFIX}/_.mnt
294
295 # Mount '/cfg' slize in image
296 MD=`mdconfig -a -t vnode -f ${IMG}`
297 mount /dev/${MD}s3 ${MNT}
298
299 # Location of '/cfg' directory
300 cd ${NANO_CONF_DIR}/../cfg-files
301 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
302
303
304 # Leave in nice end state
305 umount ${MNT}
306 mdconfig -d -u ${MD}
307) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
308
309last_nano_disk_usage () (
310 # Variables to be used
311 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
312 MNT=${MAKEOBJDIRPREFIX}/_.mnt
313
314 # Mount root slize
315 MD=`mdconfig -a -t vnode -f ${IMG}`
316 mount /dev/${MD}s1a ${MNT}
317
318 # Show disk usage (percent free) inc header
319 pprint 2 $(df -h | head -1)
320 pprint 2 "$(df -h | grep /dev/${MD})"
321
322 # Leave in nice end state
323 umount ${MNT}
324 mdconfig -d -u ${MD}
325)
326
327last_orders () (
328 last_nano_fill_cfg
329 last_nano_disk_usage
330)
331
332# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
333# instead of a file
334exec 3>/dev/stdout
335# Progress Print
336# Print $2 at level $1
337pprint() {
338 if [ "$1" -le $PPLEVEL ]; then
339 printf "%.${1}s %s\n" "#####" "$2" 1>&3
340 fi
341}
342
343# Cust macro`s gestart in onderstaande volgorde
344# XXX: Determine size before installing all find of additions to see how much
345# base we are actually using ## du -h -d 0
346customize_cmd cust_pkgng
347customize_cmd cust_install_files
348customize_cmd cust_ntpd
349customize_cmd cust_serial_ttys
350customize_cmd cust_version_tag
351customize_cmd cust_root_bin_to_tools
352customize_cmd cust_allow_ssh_root
353customize_cmd cust_openvpn_dhparam
354customize_cmd cust_nano_prune
355customize_cmd cust_set_root_password
356#customize_cmd cust_apply_nanobsd_patches
357late_customize_cmd late_cust_unset_common_var_and_tmp
358
359# Standard overwrite
360if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then
361 . $NANO_CONF_DIR/nanobsd.local
362fi
363
364# Extra config if existing is not suffient
365if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
366 for FILE in $EXTRA_NANOBSD_CONFIG; do
367 # File relative to config directory
368 if [ "`echo $FILE | cut -c1`" != "/" ]; then
369 FILE=$NANO_CONF_DIR/$FILE
370 fi
371 pprint 1 "Loading $FILE"
372 . $FILE || exit 1
373 done
374fi
Note: See TracBrowser for help on using the repository browser.