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

Last change on this file since 10384 was 10384, checked in by rick, 13 years ago
  • Add screen and sudo as usefull utilities.
  • Make the pkg db install only on persistant space.
  • Merge image-build.sh from proxy.
File size: 11.2 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"
79elif [ "`sysctl -n hw.model`" = "AMD Sempron(tm) Processor 3000+" ]; then
80 # Parralel builds on this friend fails somehow
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"
97NANO_PRUNE="$NANO_PRUNE usr/share/mk"
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
264# Prune no needed directories of image
265cust_nano_prune () (
266 cd ${NANO_WORLDDIR}
267 for ENTRY in ${NANO_PRUNE}; do
268 rm -vfR ${ENTRY}
269 done
270)
271
272
273# Fill /cfg with custom files, based on 'create_i386_diskimage ( )'
274last_nano_fill_cfg () (
275 # Variables to be used
276 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
277 MNT=${MAKEOBJDIRPREFIX}/_.mnt
278
279 # Mount '/cfg' slize in image
280 MD=`mdconfig -a -t vnode -f ${IMG}`
281 mount /dev/${MD}s3 ${MNT}
282
283 # Location of '/cfg' directory
284 cd ${NANO_CONF_DIR}/../cfg-files
285 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
286
287
288 # Leave in nice end state
289 umount ${MNT}
290 mdconfig -d -u ${MD}
291) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
292
293last_nano_disk_usage () (
294 # Variables to be used
295 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
296 MNT=${MAKEOBJDIRPREFIX}/_.mnt
297
298 # Mount root slize
299 MD=`mdconfig -a -t vnode -f ${IMG}`
300 mount /dev/${MD}s1a ${MNT}
301
302 # Show disk usage (percent free) inc header
303 pprint 2 $(df -h | head -1)
304 pprint 2 "$(df -h | grep /dev/${MD})"
305
306 # Leave in nice end state
307 umount ${MNT}
308 mdconfig -d -u ${MD}
309)
310
311last_orders () (
312 last_nano_fill_cfg
313 last_nano_disk_usage
314)
315
316# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
317# instead of a file
318exec 3>/dev/stdout
319# Progress Print
320# Print $2 at level $1
321pprint() {
322 if [ "$1" -le $PPLEVEL ]; then
323 printf "%.${1}s %s\n" "#####" "$2" 1>&3
324 fi
325}
326
327# Cust macro`s gestart in onderstaande volgorde
328# XXX: Determine size before installing all find of additions to see how much
329# base we are actually using ## du -h -d 0
330customize_cmd cust_pkg
331customize_cmd cust_install_files
332customize_cmd cust_ntpd
333customize_cmd cust_serial_ttys
334customize_cmd cust_version_tag
335customize_cmd cust_allow_ssh_root
336customize_cmd cust_nano_prune
337customize_cmd cust_set_root_password
338customize_cmd cust_apply_nanobsd_patches
339
340# Standard overwrite
341if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then
342 . $NANO_CONF_DIR/nanobsd.local
343fi
344
345# Extra config if existing is not suffient
346if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
347 for FILE in $EXTRA_NANOBSD_CONFIG; do
348 # File relative to config directory
349 if [ "`echo $FILE | cut -c1`" != "/" ]; then
350 FILE=$NANO_CONF_DIR/$FILE
351 fi
352 pprint 1 "Loading $FILE"
353 . $FILE || exit 1
354 done
355fi
Note: See TracBrowser for help on using the repository browser.