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

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

-u vlaggetje voor pw moet zijn -n

File size: 11.7 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## Tweaked for use with 2Gb SDcard, more VAR and TMP space in Alix.APU1C
5
6# Little hack to allow proper secify of KERNL/PKG location
7if [ -n "$NANO_CFG_FILE" ]; then
8 NANO_CONF_DIR=$(cd $(dirname $NANO_CFG_FILE); pwd -P)
9else
10 NANO_CONF_DIR=$(cd $(dirname $2); pwd -P)
11fi
12
13# object naam in /usr/obj/nanobsd.{obj}
14NANO_NAME=wleiden-hybrid
15NANO_SRC=/usr/src # nanobsd source tree
16NANO_TOOLS=$(pwd)
17NANO_KERNEL=$NANO_CONF_DIR/kernel.wleiden.apu # naam van het kernel configuratiebestand
18NANO_IMAGES=2 # aantal nanobsd code slices/installs (1/2)
19
20NANO_CONFSIZE=8192 # volume van de config slice, default 2048 (512bs)
21NANO_DATASIZE=0 # volume van de data slice, 0 = not configured
22NANO_CODESIZE=889200 # 434Mb voor / (889200*1024*1024/512)
23NANO_RAM_TMPVARSIZE=81920 # 40Mb Voor /Var en /Tmp(40*1024*1024/512)
24
25NANO_DRIVE=da0 # Naam van de SD card
26
27#XXX: Eeks, fixed packages, needs building a hook to allow building the package
28# of the shelfs if needed, copy to right directory, done. With only input needed
29# a list of ports in the format like net/net-snmp
30NANO_PACKAGE_DIR=$NANO_CONF_DIR/../pkg/All
31NANO_PACKAGE_LIST="*"
32
33
34# Wireless Leiden ports from $WL_PORTSDIR are copied OVER $PORTSDIR
35PORTSDIR='/usr/ports'
36WL_PORTSDIR="$NANO_CONF_DIR/../ports/"
37
38# Dirty quirk to allow comments in part below
39PACKAGE_LIST=`cat <<EOF | sed -e 's/#.*$//g' | xargs
40benchmarks/iperf
41devel/py-yaml
42#dns/dnsmasq
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
54security/ca_root_nss
55sysutils/screen
56sysutils/ucspi-tcp
57www/apache24
58www/tinyproxy
59
60# Extra WL ports
61net/lvrouted
62`
63# Package target
64PKG_MAKE_ARGS="PACKAGES=$(dirname $NANO_PACKAGE_DIR) BATCH=yes PACKAGE_BUILDING=yes"
65
66PKG_MAKE_CONF="
67# www/py-cherrypy - include apache templating
68# net-mgmt/net-snmp - no perl please (size)
69# net-mgmt/nagios-plugins - no threading (single CPU)
70# shells/bash-static - logging via syslog
71# net/mtr - no X11 (no screen)
72OPTIONS_SET= APACHE FPING SYSLOG
73OPTIONS_UNSET= PERL PERL_EMBEDDED X11
74"
75
76##NANO_PACKAGE_LIST=
77
78# Warning: set to 1 to debug make build errors
79# Number of recurrent parrallel make builds
80if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then
81 # Mac OS X Parallels virtual machine
82 NANO_PMAKE="make -B"
83else
84 # Default 2 times number of CPU's inside machine
85 NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2`
86 NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}"
87fi
88
89# Starting from soekris bios version 1.31 upwards boot0sio does not seems work
90# anymore, but boot0 does (weird)
91NANO_BOOTLOADER="boot/boot0"
92
93# Strip down to a more acceptable size
94# hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB)
95NANO_PRUNE="$NANO_PRUNE usr/share/examples"
96NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
97NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
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 APU board
182# values for PCEngines blanc 2 GB cards
183# C/H/S phys 945/64/63, logical 983/32/63
184# drive 0x000f2ab0: PCHS=0/0/0 translation=lba LCHS=945/64/63 s=3813376
185NANO_MEDIASIZE=`expr 1952448512 / 512`
186NANO_HEADS=64
187NANO_SECTS=63
188
189
190# Version tagging
191cust_version_tag() (
192 VERSION_FILE="${NANO_WORLDDIR}/tools/wl-release.txt"
193 (
194 echo "Generated by `id -un`@`hostname -f` at `date`"
195 echo ""
196 echo "=== CONFIG specifics ==="
197 svn info ${NANO_CONF_DIR}/../ || exit 0
198 svn diff ${NANO_CONF_DIR}/../ || exit 0
199 echo "=== BEGIN CONFIG specifics ==="
200 ) > $VERSION_FILE
201)
202
203# Takes a very long time (10+) minutes to generate this file on an ALIX board,
204# not practical for quick debugging and configuration.
205cust_openvpn_dhparam() (
206 DHFILE=${NANO_WORLDDIR}/etc/easy-rsa-keys/dh1024.pem
207 mkdir -p `dirname $DHFILE`
208 openssl dhparam -out $DHFILE 1024
209)
210
211
212
213# Assuming we are running a safe envirionment where snooping could occur during or after the build
214cust_set_root_password() (
215 if [ -n "${CFG_ROOT_PASSWORD}" ]; then
216 pprint 2 "Set root password using CFG_ROOT_PASSWORD variable"
217 chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -n root"
218 else
219 pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD"
220 fi
221)
222
223
224
225# EXPERIMENTAL patch like envirionment
226# Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to
227# keep us as close as possible to the base OS
228# Patches are applied to the directory they live in
229#cust_apply_nanobsd_patches() (
230# for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do
231# cd `dirname ${PATCHFILE}`
232# patch -t -N -p0 -i `basename ${PATCHFILE}`
233# #XX: What to with installed patch files? Delete them for the time beeing
234# rm -v ${PATCHFILE}
235#done
236
237
238
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 and boot serial at 115200 baud
250cust_serial_ttys() (
251 chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyv[0-9]/s/on /off/' -e '/ttyu0/s/off/on/' -e '/ttyu0/s/dialup/ansi/' /etc/ttys
252 echo '-h -S115200' > ${NANO_WORLDDIR}/boot.config
253)
254
255
256
257# Install files from specific relative location
258cust_install_files () (
259 cd ${NANO_CONF_DIR}/../files
260 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${NANO_WORLDDIR}
261)
262
263
264# Make tools available for root by default
265cust_root_bin_to_tools() {
266 ln -s /tools ${NANO_WORLDDIR}/root/bin
267}
268
269
270# Prune no needed directories of image
271cust_nano_prune () (
272 cd ${NANO_WORLDDIR}
273 for ENTRY in ${NANO_PRUNE}; do
274 rm -vfR ${ENTRY}
275 done
276)
277
278# We actually do need an seperate /tmp, so undo the symlinking done in
279# setup_nanobsd()
280late_cust_unset_common_var_and_tmp() (
281 cd ${NANO_WORLDDIR}
282 rm tmp
283 mkdir -m 1777 tmp
284)
285
286
287# Fill /cfg wmth custom files, based on 'create_i386_diskimage ( )'
288last_nano_fill_cfg () (
289 # Variables to be used
290 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
291 MNT=${MAKEOBJDIRPREFIX}/_.mnt
292
293 # Mount '/cfg' slize in image
294 MD=`mdconfig -a -t vnode -f ${IMG}`
295 mount /dev/${MD}s3 ${MNT}
296
297 # Location of '/cfg' directory
298 cd ${NANO_CONF_DIR}/../cfg-files
299 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
300
301
302 # Leave in nice end state
303 umount ${MNT}
304 mdconfig -d -u ${MD}
305) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
306
307last_nano_disk_usage () (
308 # Variables to be used
309 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
310 MNT=${MAKEOBJDIRPREFIX}/_.mnt
311
312 # Mount root slize
313 MD=`mdconfig -a -t vnode -f ${IMG}`
314 mount /dev/${MD}s1a ${MNT}
315
316 # Show disk usage (percent free) inc header
317 pprint 2 $(df -h | head -1)
318 pprint 2 "$(df -h | grep /dev/${MD})"
319
320 # Leave in nice end state
321 umount ${MNT}
322 mdconfig -d -u ${MD}
323)
324
325last_orders () (
326 last_nano_fill_cfg
327 last_nano_disk_usage
328)
329
330# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
331# instead of a file
332exec 3>/dev/stdout
333# Progress Print
334# Print $2 at level $1
335pprint() {
336 if [ "$1" -le $PPLEVEL ]; then
337 printf "%.${1}s %s\n" "#####" "$2" 1>&3
338 fi
339}
340
341# Cust macro`s gestart in onderstaande volgorde
342# XXX: Determine size before installing all find of additions to see how much
343# base we are actually using ## du -h -d 0
344customize_cmd cust_pkgng
345customize_cmd cust_install_files
346customize_cmd cust_ntpd
347customize_cmd cust_serial_ttys
348customize_cmd cust_version_tag
349customize_cmd cust_root_bin_to_tools
350customize_cmd cust_allow_ssh_root
351customize_cmd cust_openvpn_dhparam
352customize_cmd cust_nano_prune
353customize_cmd cust_set_root_password
354#customize_cmd cust_apply_nanobsd_patches
355late_customize_cmd late_cust_unset_common_var_and_tmp
356
357# Standard overwrite
358if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then
359 . $NANO_CONF_DIR/nanobsd.local
360fi
361
362# Extra config if existing is not suffient
363if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
364 for FILE in $EXTRA_NANOBSD_CONFIG; do
365 # File relative to config directory
366 if [ "`echo $FILE | cut -c1`" != "/" ]; then
367 FILE=$NANO_CONF_DIR/$FILE
368 fi
369 pprint 1 "Loading $FILE"
370 . $FILE || exit 1
371 done
372fi
Note: See TracBrowser for help on using the repository browser.