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

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

Merge package building into the central config file, to make custom
configurations more easy to maintain also done at iris and proxy.

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/dns/dnsmasq
35$PORTSDIR/www/thttpd
36$PORTSDIR/editors/vim-lite
37$PORTSDIR/lang/python
38$PORTSDIR/net-mgmt/net-snmp
39$PORTSDIR/benchmarks/iperf
40$PORTSDIR/net/pen
41$PORTSDIR/devel/py-yaml
42$PORTSDIR/sysutils/ucspi-tcp
43$PORTSDIR/www/tinyproxy
44$PORTSDIR/editors/vim-lite
45$PORTSDIR/security/nmap
46$PORTSDIR/ftp/curl
47$PORTSDIR/security/openvpn
48$PORTSDIR/net/sixxs-aiccu
49
50
51# Wireless Leiden ports at $WL_PORTSDIR
52$WL_PORTSDIR/net/lvrouted
53`
54# Package target
55# Dirty quirk to allow comments in part below
56PKG_MAKE_ARGS=`cat <<EOF | sed 's/#.*$//g'
57PACKAGES=$(dirname $NANO_PACKAGE_DIR)
58BATCH=yes PACKAGE_BUILDING=yes
59# www/py-cherrypy
60WITH_APACHE=yes
61# net-mgmt/net-snmp
62WITHOUT_PERL=yes
63# net-mgmt/nagios-plugins
64WITH_FPING=yes
65# threads is broken in the version (atleast up to 9.0 - 20120213)
66# Should be fix in current version in linux, but for some reason
67# Not yet in BSD. We don't need threads
68WITHOUT_THREADS=yes
69`
70
71##NANO_PACKAGE_LIST=
72
73# Warning: set to 1 to debug make build errors
74# Number of recurrent parrallel make builds
75if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then
76 # Mac OS X Parallels virtual machine
77 NANO_PMAKE="make -B"
78elif [ "`sysctl -n hw.model`" = "AMD Sempron(tm) Processor 3000+" ]; then
79 # Parralel builds on this friend fails somehow
80 NANO_PMAKE="make -B"
81else
82 # Default 2 times number of CPU's inside machine
83 NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2`
84 NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}"
85fi
86
87# Starting from soekris bios version 1.31 upwards boot0sio does not seems work
88# anymore, but boot0 does (weird)
89NANO_BOOTLOADER="boot/boot0"
90
91# Strip down to a more acceptable size
92# hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB)
93NANO_PRUNE="$NANO_PRUNE usr/share/examples"
94NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
95NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
96NANO_PRUNE="$NANO_PRUNE usr/share/mk"
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
202
203# Assuming we are running a safe envirionment where snooping could occur during or after the build
204cust_set_root_password() (
205 if [ -n "${CFG_ROOT_PASSWORD}" ]; then
206 pprint 2 "Set root password using CFG_ROOT_PASSWORD variable"
207 chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -u root"
208 else
209 pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD"
210 fi
211)
212
213
214
215# EXPERIMENTAL patch like envirionment
216# Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to
217# keep us as close as possible to the base OS
218# Patches are applied to the directory they live in
219cust_apply_nanobsd_patches() (
220 for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do
221 cd `dirname ${PATCHFILE}`
222 patch -t -N -p0 -i `basename ${PATCHFILE}`
223 #XX: What to with installed patch files? Delete them for the time beeing
224 rm -v ${PATCHFILE}
225 done
226
227
228
229)
230
231
232
233# Compile & install lvroute daemon vanuit source in svn
234cust_install_lvrouted() (
235 svn co http://svn.wirelessleiden.nl/svn/node-config/other/lvrouted/trunk/ /tmp/lvrouted
236 cd /tmp/lvrouted && autoconf && autoheader && ./configure && make || true
237 cp src/lvrouted.opt ${NANO_WORLDDIR}/usr/local/sbin
238)
239
240
241
242# Customize ntpd
243cust_ntpd() (
244 chroot ${NANO_WORLDDIR} sh -c "ln -fs /usr/local/etc/ntp.drift /var/db/ntp.drift"
245)
246
247
248# Enable Serial TTYs
249cust_serial_ttys() (
250 chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyv[1-9]/s/on /off/' -e '/ttyu0/s/off/on/' -e '/ttyu0/s/dialup/ansi/' /etc/ttys
251)
252
253
254
255# Install files from specific relative location
256cust_install_files () (
257 cd ${NANO_CONF_DIR}/../files
258 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${NANO_WORLDDIR}
259)
260
261
262
263# Prune no needed directories of image
264cust_nano_prune () (
265 cd ${NANO_WORLDDIR}
266 for ENTRY in ${NANO_PRUNE}; do
267 rm -vfR ${ENTRY}
268 done
269)
270
271
272# Fill /cfg with custom files, based on 'create_i386_diskimage ( )'
273last_nano_fill_cfg () (
274 # Variables to be used
275 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
276 MNT=${MAKEOBJDIRPREFIX}/_.mnt
277
278 # Mount '/cfg' slize in image
279 MD=`mdconfig -a -t vnode -f ${IMG}`
280 mount /dev/${MD}s3 ${MNT}
281
282 # Location of '/cfg' directory
283 cd ${NANO_CONF_DIR}/../cfg-files
284 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
285
286
287 # Leave in nice end state
288 umount ${MNT}
289 mdconfig -d -u ${MD}
290) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
291
292last_nano_disk_usage () (
293 # Variables to be used
294 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
295 MNT=${MAKEOBJDIRPREFIX}/_.mnt
296
297 # Mount root slize
298 MD=`mdconfig -a -t vnode -f ${IMG}`
299 mount /dev/${MD}s1a ${MNT}
300
301 # Show disk usage (percent free) inc header
302 pprint 2 $(df -h | head -1)
303 pprint 2 "$(df -h | grep /dev/${MD})"
304
305 # Leave in nice end state
306 umount ${MNT}
307 mdconfig -d -u ${MD}
308)
309
310last_orders () (
311 last_nano_fill_cfg
312 last_nano_disk_usage
313)
314
315# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
316# instead of a file
317exec 3>/dev/stdout
318# Progress Print
319# Print $2 at level $1
320pprint() {
321 if [ "$1" -le $PPLEVEL ]; then
322 printf "%.${1}s %s\n" "#####" "$2" 1>&3
323 fi
324}
325
326# Cust macro`s gestart in onderstaande volgorde
327# XXX: Determine size before installing all find of additions to see how much
328# base we are actually using ## du -h -d 0
329customize_cmd cust_pkg
330customize_cmd cust_install_files
331customize_cmd cust_ntpd
332customize_cmd cust_serial_ttys
333customize_cmd cust_version_tag
334customize_cmd cust_allow_ssh_root
335customize_cmd cust_nano_prune
336customize_cmd cust_set_root_password
337customize_cmd cust_apply_nanobsd_patches
338
339
340# Extra config if existing is not suffient
341if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
342 for FILE in $EXTRA_NANOBSD_CONFIG; do
343 # File relative to config directory
344 if [ "`echo $FILE | cut -c1`" != "/" ]; then
345 FILE=$NANO_CONF_DIR/$FILE
346 fi
347 pprint 1 "Loading $FILE"
348 . $FILE || exit 1
349 done
350fi
Note: See TracBrowser for help on using the repository browser.