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

Last change on this file since 12898 was 12898, checked in by huub, 10 years ago

vim-lite uit packagelist

File size: 11.3 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-test
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-yaml
40dns/dnsmasq
41dns/unbound
42dns/bind-tools
43ftp/curl
44lang/python2
45lang/python
46net/ladvd
47net-mgmt/iftop
48net-mgmt/net-snmp
49net/mtr
50net/isc-dhcp42-server
51net/pen
52ports-mgmt/pkg
53security/sudo
54sysutils/screen
55sysutils/ucspi-tcp
56www/thttpd
57www/tinyproxy
58
59# Extra WL ports
60net/lvrouted
61`
62# Package target
63PKG_MAKE_ARGS="PACKAGES=$(dirname $NANO_PACKAGE_DIR) BATCH=yes PACKAGE_BUILDING=yes"
64
65PKG_MAKE_CONF="
66# www/py-cherrypy - include apache templating
67# net-mgmt/net-snmp - no perl please (size)
68# net-mgmt/nagios-plugins - no threading (single CPU)
69# shells/bash-static - logging via syslog
70# net/mtr - no X11 (no screen)
71OPTIONS_SET= APACHE FPING SYSLOG
72OPTIONS_UNSET= PERL PERL_EMBEDDED X11
73"
74
75##NANO_PACKAGE_LIST=
76
77# Warning: set to 1 to debug make build errors
78# Number of recurrent parrallel make builds
79if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then
80 # Mac OS X Parallels virtual machine
81 NANO_PMAKE="make -B"
82else
83 # Default 2 times number of CPU's inside machine
84 NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2`
85 NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}"
86fi
87
88# Starting from soekris bios version 1.31 upwards boot0sio does not seems work
89# anymore, but boot0 does (weird)
90NANO_BOOTLOADER="boot/boot0"
91
92# Strip down to a more acceptable size
93# hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB)
94NANO_PRUNE="$NANO_PRUNE usr/share/examples"
95NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
96NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
97# NB! usr/share/misc contains termcap, vi(1) etc fails to work without it.
98# NANOBSD_PRUNE += usr/share/misc
99NANO_PRUNE="$NANO_PRUNE usr/share/pcvt"
100NANO_PRUNE="$NANO_PRUNE usr/share/me"
101NANO_PRUNE="$NANO_PRUNE usr/share/doc"
102
103
104
105
106
107# Opties parsed gedurende build & install world
108# Also check man 3 src.conf for details
109# Some flags are misleading, e.g. could only be installworld (e.g.), for details:
110# http://phk.freebsd.dk/misc/build_options/
111# For details on make options also check:
112# /usr/src/share/mk/bsd.own.mk
113CONF_COMMON='
114# Specific enabled options
115#WITHOUT_ACPI=YES # geen advanced configuration power interface
116#WITHOUT_BIND=YES # geen bind tools, dns/named geinstalleerd
117#WITHOUT_CXX=YES # Set to not build g++(1) and related libraries.
118#WITHOUT_GROFF=YES # Set to not build groff(1).
119#WITHOUT_INET6=YES # geen ondersteuning inet versie 6 architectuur
120#WITHOUT_INFO=YES # geen info bestanden, readable online docs
121#WITHOUT_IPFILTER=YES # geen ip filtering geinstalleerd
122#WITHOUT_KLDLOAD=YES # do not allow loading of kernel modules
123#WITHOUT_MAILWRAPPER=YES # geen mailwrapper bij gebruik sendmail
124#WITHOUT_MAN=YES # geen handleidingen gecompileerd
125#WITHOUT_MISC=YES # geen misc sub directory
126#WITHOUT_MODULES=YES # geen ondersteuning toevoegen modules
127#WITHOUT_PAM=YES # geen ondersteuning pa modules
128#WITHOUT_PF=YES # geen packet filtering geinstalleerd
129#WITHOUT_SHARE=YES # geen share sub directory
130#WITHOUT_USB=YES # geen ondersteuning usb modules
131# Specific disabled options
132WITHOUT_ATM=YES # geen ondersteuning Asynchronous Transfer Mode
133WITHOUT_AUDIT=YES # geen event auditing / audit trails
134WITHOUT_AUTHPF=YES # geen authenticating gateway user shell
135WITHOUT_BLUETOOTH=YES # geen ondersteuning Bluetooth modules
136WITHOUT_CALENDAR=YES # geen calendar reminder service gecompileerd
137WITHOUT_CDDL=YES # Set to not build code licensed under Sun CDDL. (also ZFS)
138WITHOUT_CPP=YES # Set to not build cpp(1).
139WITHOUT_CVS=YES # geen cvs tools geinstalleerd
140WITHOUT_DICT=YES # geen dictionary ondersteuning
141WITHOUT_EXAMPLES=YES # geen voorbeeld configuratiebestanden
142WITHOUT_FORTRAN=YES # geen ondersteuning fortran compilers
143WITHOUT_GAMES=YES # geen games gecompileerd
144WITHOUT_GCOV=YES # geen gcov test coverage program
145WITHOUT_GDB=YES # geen gnu debugger gecompileerd
146WITHOUT_GPIB=YES # geen ondersteuning gpib kaarten
147WITHOUT_HTML=YES # geen html help bestanden gecompileerd
148WITHOUT_I4B=YES # geen ondersteuning voor isdn
149WITHOUT_IPX=YES # geen ondersteuning ipx protocols
150WITHOUT_KERBEROS=YES # geen ondersteuning Kerberos authenticatie
151WITHOUT_LOCALES=YES # geen ondersteuning lokalisatie
152WITHOUT_LPR=YES # geen ondersteuning print services
153WITHOUT_NIS=YES # geen ondersteuning network information system
154WITHOUT_PROFILE=YES # Set to avoid compiling profiled libraries.
155WITHOUT_RCMDS=YES # geen ondersteuning rcmds,
156WITHOUT_RESCUE=YES # geen rescue bestanden gecompileerd
157WITHOUT_SENDMAIL=YES # geen sendmail geinstalleerd
158WITHOUT_SHAREDOCS=YES # geen share/docs directories
159WITHOUT_SYSCONS=YES # geen syscon devices gecompileerd
160'
161
162CONF_BUILD="
163${CONF_COMMON}
164"
165
166CONF_INSTALL="
167${CONF_COMMON}
168WITHOUT_TOOLCHAIN=YES # geen freebsd toolchain
169"
170
171
172# Flash disks arrived, sandisk 1g seems to match the geometry of the (blanc) cards
173#FlashDevice sandisk 1g # nanobsd flashdevice entry
174#FlashDevice sandisk 512mb # nanobsd flashdevice entry
175#FlashDevice transcend 2g # nanobsd flashdevice entry
176# Calculated value of PEAK hardware 1GB CF card
177# C/H/S phys 1954/16/63, logical 977/32/63
178# Mediasize is calculated as C*H*S*512
179
180# Using logical values reported by ALIX board
181# values for PCEngines blanc 1 GB cards
182# C/H/S phys 1966/16/63, logical 983/32/63
183NANO_MEDIASIZE=`expr 1008451584 / 512`
184NANO_HEADS=32
185NANO_SECTS=63
186
187
188# Version tagging
189cust_version_tag() (
190 VERSION_FILE="${NANO_WORLDDIR}/tools/wl-release.txt"
191 (
192 echo "Generated by `id -un`@`hostname -f` at `date`"
193 echo ""
194 echo "=== CONFIG specifics ==="
195 svn info ${NANO_CONF_DIR}/../ || exit 0
196 svn diff ${NANO_CONF_DIR}/../ || exit 0
197 echo "=== BEGIN CONFIG specifics ==="
198 ) > $VERSION_FILE
199)
200
201# Takes a very long time (10+) minutes to generate this file on an ALIX board,
202# not practical for quick debugging and configuration.
203cust_openvpn_dhparam() (
204 DHFILE=${NANO_WORLDDIR}/etc/easy-rsa-keys/dh1024.pem
205 mkdir -p `dirname $DHFILE`
206 openssl dhparam -out $DHFILE 1024
207)
208
209
210
211# Assuming we are running a safe envirionment where snooping could occur during or after the build
212cust_set_root_password() (
213 if [ -n "${CFG_ROOT_PASSWORD}" ]; then
214 pprint 2 "Set root password using CFG_ROOT_PASSWORD variable"
215 chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -u root"
216 else
217 pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD"
218 fi
219)
220
221
222
223# EXPERIMENTAL patch like envirionment
224# Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to
225# keep us as close as possible to the base OS
226# Patches are applied to the directory they live in
227#cust_apply_nanobsd_patches() (
228# for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do
229# cd `dirname ${PATCHFILE}`
230# patch -t -N -p0 -i `basename ${PATCHFILE}`
231# #XX: What to with installed patch files? Delete them for the time beeing
232# rm -v ${PATCHFILE}
233#done
234
235
236
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[0-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# Make tools available for root by default
262cust_root_bin_to_tools() {
263 ln -s /tools ${NANO_WORLDDIR}/root/bin
264}
265
266
267# Prune no needed directories of image
268cust_nano_prune () (
269 cd ${NANO_WORLDDIR}
270 for ENTRY in ${NANO_PRUNE}; do
271 rm -vfR ${ENTRY}
272 done
273)
274
275# We actually do need an seperate /tmp, so undo the symlinking done in
276# setup_nanobsd()
277late_cust_unset_common_var_and_tmp() (
278 cd ${NANO_WORLDDIR}
279 rm tmp
280 mkdir -m 1777 tmp
281)
282
283
284# Fill /cfg wmth custom files, based on 'create_i386_diskimage ( )'
285last_nano_fill_cfg () (
286 # Variables to be used
287 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
288 MNT=${MAKEOBJDIRPREFIX}/_.mnt
289
290 # Mount '/cfg' slize in image
291 MD=`mdconfig -a -t vnode -f ${IMG}`
292 mount /dev/${MD}s3 ${MNT}
293
294 # Location of '/cfg' directory
295 cd ${NANO_CONF_DIR}/../cfg-files
296 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
297
298
299 # Leave in nice end state
300 umount ${MNT}
301 mdconfig -d -u ${MD}
302) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
303
304last_nano_disk_usage () (
305 # Variables to be used
306 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
307 MNT=${MAKEOBJDIRPREFIX}/_.mnt
308
309 # Mount root slize
310 MD=`mdconfig -a -t vnode -f ${IMG}`
311 mount /dev/${MD}s1a ${MNT}
312
313 # Show disk usage (percent free) inc header
314 pprint 2 $(df -h | head -1)
315 pprint 2 "$(df -h | grep /dev/${MD})"
316
317 # Leave in nice end state
318 umount ${MNT}
319 mdconfig -d -u ${MD}
320)
321
322last_orders () (
323 last_nano_fill_cfg
324 last_nano_disk_usage
325)
326
327# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
328# instead of a file
329exec 3>/dev/stdout
330# Progress Print
331# Print $2 at level $1
332pprint() {
333 if [ "$1" -le $PPLEVEL ]; then
334 printf "%.${1}s %s\n" "#####" "$2" 1>&3
335 fi
336}
337
338# Cust macro`s gestart in onderstaande volgorde
339# XXX: Determine size before installing all find of additions to see how much
340# base we are actually using ## du -h -d 0
341customize_cmd cust_pkgng
342customize_cmd cust_install_files
343customize_cmd cust_ntpd
344customize_cmd cust_serial_ttys
345customize_cmd cust_version_tag
346customize_cmd cust_root_bin_to_tools
347customize_cmd cust_allow_ssh_root
348customize_cmd cust_openvpn_dhparam
349customize_cmd cust_nano_prune
350customize_cmd cust_set_root_password
351#customize_cmd cust_apply_nanobsd_patches
352late_customize_cmd late_cust_unset_common_var_and_tmp
353
354# Standard overwrite
355if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then
356 . $NANO_CONF_DIR/nanobsd.local
357fi
358
359# Extra config if existing is not suffient
360if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
361 for FILE in $EXTRA_NANOBSD_CONFIG; do
362 # File relative to config directory
363 if [ "`echo $FILE | cut -c1`" != "/" ]; then
364 FILE=$NANO_CONF_DIR/$FILE
365 fi
366 pprint 1 "Loading $FILE"
367 . $FILE || exit 1
368 done
369fi
Note: See TracBrowser for help on using the repository browser.