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

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

Failed due to overclocking, making machine standard again.

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