source: hybrid/branches/releng-11/nanobsd/cfg/nanobsd.wleiden@ 14146

Last change on this file since 14146 was 14137, checked in by rick, 7 years ago

Fix curl fails to load due to missing kerberos lib

Shared object "libkrb5.so.11" not found, required by "curl" is caused since
default curl options requires kerberos present in base, which is stripped out
by us.

File size: 14.6 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_TOOLS=$(pwd)
16NANO_KERNEL=$NANO_CONF_DIR/kernel.wleiden # naam van het kernel configuratiebestand
17NANO_IMAGES=2 # aantal nanobsd code slices/installs (1/2)
18
19NANO_CONFSIZE=20480 # Volume van de config slice (10MB) in 512bs
20NANO_DATASIZE=0 # volume van de data slice, 0 = not configured
21NANO_CODESIZE=819200 # Let buildscript the operating system slice as large as posible
22
23# Size of the /etc ramdisk in 512 bytes sectors
24NANO_RAM_ETCSIZE=20480
25
26NANO_RAM_TMPVARSIZE=102400 # Volume of combined var & tmp slice (50MB) in 512bs
27
28NANO_LABEL=WLIMG
29NANO_NEWFS="-b 4096 -f 512 -i 8192" # Overwrite the default stettings to disable Soft-updates
30
31
32# Package building done using pourdriere
33NANO_PACKAGE_REPOS="/usr/local/poudriere/data/packages/wlpkgbuild-default-node/"
34
35
36# Dirty quirk to allow comments in part below
37PACKAGE_LIST=`cat <<EOF | sed -e 's/#.*$//g' | xargs
38benchmarks/iperf
39devel/gdb
40editors/vim-console
41dns/dnsmasq
42dns/nsd
43dns/unbound
44ftp/curl
45net/ladvd
46net-mgmt/iftop
47net-mgmt/net-snmp
48net/mtr
49net/isc-dhcp43-server
50net/pen
51ports-mgmt/pkg
52security/sudo
53security/ca_root_nss
54shells/bash-static
55sysutils/daemontools
56sysutils/monit
57sysutils/screen
58sysutils/ucspi-tcp
59sysutils/wait_on
60www/apache24
61www/tinyproxy
62www/thttpd
63
64# Extra WL ports
65net/lvrouted
66`
67PKG_MAKE_CONF="
68# www/py-cherrypy - include apache templating
69# net-mgmt/net-snmp - no perl please (size)
70# net-mgmt/nagios-plugins - no threading (single CPU)
71# shells/bash-static - logging via syslog
72# net/mtr - no X11 (no screen)
73# lang/ocaml - no TK support (requires X11)
74# devel/ocaml-findlib - no TOOLBOX support (requires ocaml with TK support)
75# ftp/curl - GSSAPI support set to NONE (_BASE requires kerberos)
76OPTIONS_SET= APACHE FPING SYSLOG GSSAPI_NONE
77OPTIONS_UNSET= PERL PERL_EMBEDDED PYTHON X11 TK TOOLBOX GSSAPI_BASE
78"
79
80##NANO_PACKAGE_LIST=
81
82# Warning: set to 1 to debug make build errors
83# Number of recurrent parrallel make builds
84if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then
85 # Mac OS X Parallels virtual machine
86 NANO_PMAKE="make -B"
87else
88 # Default 2 times number of CPU's inside machine
89 NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2`
90 NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}"
91fi
92
93# Starting from soekris bios version 1.31 upwards boot0sio does not seems work
94# anymore, but boot0 does (weird)
95NANO_BOOTLOADER="boot/boot0"
96
97# Strip down to a more acceptable size
98# hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB)
99NANO_PRUNE="$NANO_PRUNE usr/share/examples"
100NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
101NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
102# NB! usr/share/misc contains termcap, vi(1) etc fails to work without it.
103# NANOBSD_PRUNE += usr/share/misc
104NANO_PRUNE="$NANO_PRUNE usr/share/pcvt"
105NANO_PRUNE="$NANO_PRUNE usr/share/me"
106NANO_PRUNE="$NANO_PRUNE usr/share/doc"
107# Debugging removal
108NANO_PRUNE="$NANO_PRUNE usr/lib/debug"
109NANO_PRUNE="$NANO_PRUNE usr/tests"
110# Installed ports strip down
111NANO_PRUNE="$NANO_PRUNE usr/local/share/doc"
112NANO_PRUNE="$NANO_PRUNE usr/local/share/examples"
113# Directories not removable by installer
114NANO_PRUNE="$NANO_PRUNE usr/local/lib/python2.7/test"
115
116
117
118
119
120# Opties parsed gedurende build & install world
121# Also check man 5 src.conf for details
122# Some flags are misleading, e.g. could only be installworld (e.g.), for details:
123# http://phk.freebsd.dk/misc/build_options/
124# For details on make options also check:
125# /usr/src/share/mk/bsd.own.mk
126CONF_COMMON='
127# Specific enabled options
128#WITHOUT_ACPI=YES # geen advanced configuration power interface
129#WITHOUT_BIND=YES # geen bind tools, dns/named geinstalleerd
130#WITHOUT_CXX=YES # Set to not build g++(1) and related libraries.
131#WITHOUT_GROFF=YES # Set to not build groff(1).
132#WITHOUT_INET6=YES # geen ondersteuning inet versie 6 architectuur
133#WITHOUT_INFO=YES # geen info bestanden, readable online docs
134#WITHOUT_IPFILTER=YES # geen ip filtering geinstalleerd
135#WITHOUT_KLDLOAD=YES # do not allow loading of kernel modules
136#WITHOUT_MAILWRAPPER=YES # geen mailwrapper bij gebruik sendmail
137#WITHOUT_MAN=YES # geen handleidingen gecompileerd
138#WITHOUT_MISC=YES # geen misc sub directory
139#WITHOUT_MODULES=YES # geen ondersteuning toevoegen modules
140#WITHOUT_PAM=YES # geen ondersteuning pa modules
141#WITHOUT_PF=YES # geen packet filtering geinstalleerd
142#WITHOUT_SHARE=YES # geen share sub directory
143#WITHOUT_USB=YES # geen ondersteuning usb modules
144# Specific disabled options
145WITHOUT_ATM=YES # geen ondersteuning Asynchronous Transfer Mode
146WITHOUT_AUDIT=YES # geen event auditing / audit trails
147WITHOUT_AUTHPF=YES # geen authenticating gateway user shell
148WITHOUT_BLUETOOTH=YES # geen ondersteuning Bluetooth modules
149WITHOUT_CALENDAR=YES # geen calendar reminder service gecompileerd
150WITHOUT_CDDL=YES # Set to not build code licensed under Sun CDDL. (also ZFS)
151WITHOUT_CPP=YES # Set to not build cpp(1).
152WITHOUT_CXX=YES # Set to not build c++(1) and related libraries.
153WITHOUT_CLANG=YES # Set to not build the Clang C/C++ compiler.
154WITHOUT_CVS=YES # geen cvs tools geinstalleerd
155WITHOUT_DICT=YES # geen dictionary ondersteuning
156WITHOUT_EXAMPLES=YES # geen voorbeeld configuratiebestanden
157WITHOUT_FORTRAN=YES # geen ondersteuning fortran compilers
158WITHOUT_GAMES=YES # geen games gecompileerd
159WITHOUT_GCOV=YES # geen gcov test coverage program
160WITHOUT_GPIB=YES # geen ondersteuning gpib kaarten
161WITHOUT_HTML=YES # geen html help bestanden gecompileerd
162WITHOUT_I4B=YES # geen ondersteuning voor isdn
163WITHOUT_IPX=YES # geen ondersteuning ipx protocols
164WITHOUT_KERBEROS=YES # geen ondersteuning Kerberos authenticatie
165WITHOUT_LOCALES=YES # geen ondersteuning lokalisatie
166WITHOUT_LPR=YES # geen ondersteuning print services
167WITHOUT_NIS=YES # geen ondersteuning network information system
168WITHOUT_PROFILE=YES # Set to avoid compiling profiled libraries.
169WITHOUT_RCMDS=YES # geen ondersteuning rcmds,
170WITHOUT_RESCUE=YES # geen rescue bestanden gecompileerd
171WITHOUT_SENDMAIL=YES # geen sendmail geinstalleerd
172WITHOUT_SHAREDOCS=YES # geen share/docs directories
173WITHOUT_SSP=YES # Set to not build world with propolice stack smashing protection.
174WITHOUT_SYSCONS=YES # geen syscon devices gecompileerd
175WITHOUT_UNBOUND=YES # Port version will be used if any is used
176WITHOUT_LOCALES=YES # No localization support
177'
178
179CONF_BUILD="
180${CONF_COMMON}
181"
182
183CONF_INSTALL="
184${CONF_COMMON}
185WITHOUT_TOOLCHAIN=YES # geen freebsd toolchain
186"
187
188
189# Flash disks arrived, sandisk 1g seems to match the geometry of the (blanc) cards
190#FlashDevice sandisk 1g # nanobsd flashdevice entry
191#FlashDevice sandisk 512mb # nanobsd flashdevice entry
192#FlashDevice transcend 2g # nanobsd flashdevice entry
193# Calculated value of PEAK hardware 1GB CF card
194# C/H/S phys 1954/16/63, logical 977/32/63
195# Mediasize is calculated as C*H*S*512
196
197# Using logical values reported by ALIX board
198# values for PCEngines blanc 1 GB cards
199# C/H/S phys 1966/16/63, logical 983/32/63
200NANO_MEDIASIZE=`expr 1008451584 / 512`
201NANO_HEADS=32
202NANO_SECTS=63
203
204
205# Version tagging
206cust_version_tag() (
207 VERSION_FILE="${NANO_WORLDDIR}/tools/wl-release.txt"
208 (
209 echo "Generated by `id -un`@`hostname -f` at `date`"
210 echo ""
211 echo "=== CONFIG specifics ==="
212 svn info ${NANO_CONF_DIR}/../ || exit 0
213 svn diff ${NANO_CONF_DIR}/../ || exit 0
214 echo "=== BEGIN CONFIG specifics ==="
215 ) > $VERSION_FILE
216)
217
218# Takes a very long time (10+) minutes to generate this file on an ALIX board,
219# not practical for quick debugging and configuration.
220cust_openvpn_dhparam() (
221 if [ -r ${NANO_CONF_DIR}/usr/local/bin/openvpn ]; then
222 DHFILE=${NANO_WORLDDIR}/etc/easy-rsa-keys/dh1024.pem
223 mkdir -p `dirname $DHFILE`
224 openssl dhparam -out $DHFILE 1024
225 fi
226)
227
228# Unbound is running in alternative chroot location (port default) how-ever
229# this directory needs to be writeable by unbound for key generation etc.
230cust_unbound_rights() (
231 if [ -r ${NANO_WORLDDIR}/usr/local/etc/unbound ]; then
232 chroot ${NANO_WORLDDIR} sh -c "chown unbound:unbound /usr/local/etc/unbound"
233 fi
234)
235
236
237# Assuming we are running a safe envirionment where snooping could occur during or after the build
238cust_set_root_password() (
239 if [ -n "${CFG_ROOT_PASSWORD}" ]; then
240 pprint 2 "Set root password using CFG_ROOT_PASSWORD variable"
241 chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -n root"
242 else
243 pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD"
244 fi
245)
246
247
248
249# EXPERIMENTAL patch like envirionment
250# Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to
251# keep us as close as possible to the base OS
252# Patches are applied to the directory they live in
253#cust_apply_nanobsd_patches() (
254# for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do
255# cd `dirname ${PATCHFILE}`
256# patch -t -N -p0 -i `basename ${PATCHFILE}`
257# #XX: What to with installed patch files? Delete them for the time beeing
258# rm -v ${PATCHFILE}
259#done
260
261
262
263#)
264
265
266
267# Customize ntpd
268cust_ntpd() (
269 chroot ${NANO_WORLDDIR} sh -c "ln -fs /usr/local/etc/ntp.drift /var/db/ntp.drift"
270)
271
272
273# Enable Serial TTYs
274cust_serial_ttys() (
275 chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyv[0-9]/s/on /off/' -e '/ttyu0/s/off/on/' -e '/ttyu0/s/dialup/ansi/' /etc/ttys
276
277 # Serial login is consided to be phycically secured, so no credentials are required
278 chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyu0/s/std.9600/al.9600/' /etc/ttys
279)
280
281# Customize sudoers files
282cust_sudo_rules() {
283 chroot ${NANO_WORLDDIR} find /usr/local/etc/sudoers.d/ -type f -exec chmod 0640 {} \+
284}
285
286
287# Update databases of tooling like locate and apropos
288cust_update_databases() {
289 chroot ${NANO_WORLDDIR} sh -c '/usr/libexec/makewhatis.local `/usr/bin/manpath -q`'
290 chroot ${NANO_WORLDDIR} "/usr/libexec/locate.updatedb"
291}
292
293# Install files from specific relative location
294cust_install_files () (
295 cd ${NANO_CONF_DIR}/../files
296 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${NANO_WORLDDIR}
297)
298
299
300# Make tools available for root by default
301cust_root_bin_to_tools() {
302 ln -s /tools ${NANO_WORLDDIR}/root/bin
303}
304
305
306# Prune no needed directories of image
307cust_nano_prune () (
308 cd ${NANO_WORLDDIR}
309 for ENTRY in ${NANO_PRUNE}; do
310 rm -vfR ${ENTRY}
311 done
312)
313
314# We actually do need an seperate /tmp, so undo the symlinking done in
315# setup_nanobsd()
316late_cust_unset_common_var_and_tmp() (
317 cd ${NANO_WORLDDIR}
318 rm tmp
319 mkdir -m 1777 tmp
320)
321
322
323# Fill /cfg wmth custom files, based on 'create_i386_diskimage ( )'
324last_nano_fill_cfg () (
325 # Variables to be used
326 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
327 MNT=${MAKEOBJDIRPREFIX}/_.mnt
328
329 # Mount '/cfg' slize in image
330 MD=`mdconfig -a -t vnode -f ${IMG}`
331 mount /dev/${MD}s3 ${MNT}
332
333 # Location of '/cfg' directory
334 cd ${NANO_CONF_DIR}/../cfg-files
335 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
336
337
338 # Leave in nice end state
339 umount ${MNT}
340 mdconfig -d -u ${MD}
341) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
342
343last_nano_disk_usage () (
344 # Variables to be used
345 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
346 MNT=${MAKEOBJDIRPREFIX}/_.mnt
347
348 # Mount root slize
349 MD=`mdconfig -a -t vnode -f ${IMG}`
350 mount /dev/${MD}s1a ${MNT}
351
352 # Show disk usage (percent free) inc header
353 pprint 2 $(df -h | head -1)
354 pprint 2 "$(df -h | grep /dev/${MD})"
355
356 # Leave in nice end state
357 umount ${MNT}
358 mdconfig -d -u ${MD}
359)
360
361
362cust_pkgng () (
363
364 # If the package directory doesn't exist, we're done.
365 if [ ! -d ${NANO_PACKAGE_REPOS} ]; then
366 echo "DONE 0 packages"
367 return 0
368 fi
369
370 # Find a pkg-* package
371 if [ -z "${NANO_PACKAGE_REPOS}/Latest/pkg.txz" ]; then
372 echo "FAILED: need a pkg/ package for bootstrapping"
373 exit 2
374 fi
375
376 # Replicate the packages into the NanoBSD world (as hard links) so we can
377 # access them from the chroot in which pkg is being run.
378 cp -lpR ${NANO_PACKAGE_REPOS} ${NANO_WORLDDIR}/Repos
379
380 #Bootstrap pkg
381 CR env ASSUME_ALWAYS_YES=YES SIGNATURE_TYPE=none /usr/sbin/pkg add /Repos/Latest/pkg.txz
382 CR pkg -N >/dev/null 2>&1
383 if [ "$?" -ne "0" ]; then
384 echo "FAILED: pkg bootstrapping faied"
385 exit 2
386 fi
387
388 mkdir -p ${NANO_WORLDDIR}/usr/local/etc/pkg/repos
389 echo "FreeBSD: { enabled: no }" > ${NANO_WORLDDIR}/usr/local/etc/pkg/repos/FreeBSD.conf
390
391 # Generate a reference to our local repository
392 cat > ${NANO_WORLDDIR}/usr/local/etc/pkg/repos/LOCAL.conf <<-EOF
393 LOCAL: {
394 url : file:///Repos
395 enabled : yes
396 mirror_type : none
397 signature_type : none
398 }
399 EOF
400
401
402 # Count & report how many we have to install
403 todo=`echo ${PACKAGE_LIST} | /usr/bin/wc -l`
404 todo=$(expr $todo + 1) # add one for pkg since it is installed already
405 echo "=== TODO: $todo"
406 echo "${PACKAGE_LIST}"
407 echo "==="
408 for PKG in ${PACKAGE_LIST}
409 do
410 CR env ASSUME_ALWAYS_YES=YES /usr/sbin/pkg install $PKG
411 done
412 rm -rf ${NANO_WORLDDIR}/Repos
413)
414
415last_orders () (
416 last_nano_fill_cfg
417 last_nano_disk_usage
418)
419
420# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
421# instead of a file
422exec 3>/dev/stdout
423# Progress Print
424# Print $2 at level $1
425pprint() {
426 if [ "$1" -le $PPLEVEL ]; then
427 printf "%.${1}s %s\n" "#####" "$2" 1>&3
428 fi
429}
430
431# Cust macro`s gestart in onderstaande volgorde
432# XXX: Determine size before installing all find of additions to see how much
433# base we are actually using ## du -h -d 0
434customize_cmd cust_pkgng
435customize_cmd cust_install_files
436customize_cmd cust_ntpd
437customize_cmd cust_serial_ttys
438customize_cmd cust_version_tag
439customize_cmd cust_root_bin_to_tools
440customize_cmd cust_allow_ssh_root
441customize_cmd cust_openvpn_dhparam
442customize_cmd cust_nano_prune
443customize_cmd cust_set_root_password
444customize_cmd cust_sudo_rules
445customize_cmd cust_unbound_rights
446customize_cmd cust_update_databases
447#customize_cmd cust_apply_nanobsd_patches
448late_customize_cmd late_cust_unset_common_var_and_tmp
449
450# Standard overwrite
451if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then
452 . $NANO_CONF_DIR/nanobsd.local
453fi
454
455# Extra config if existing is not suffient
456if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then
457 for FILE in $EXTRA_NANOBSD_CONFIG; do
458 # File relative to config directory
459 if [ "`echo $FILE | cut -c1`" != "/" ]; then
460 FILE=$NANO_CONF_DIR/$FILE
461 fi
462 pprint 1 "Loading $FILE"
463 . $FILE || exit 1
464 done
465fi
Note: See TracBrowser for help on using the repository browser.