source: hybrid/branches/breakout-hub/nanobsd/cfg/nanobsd.wleiden@ 10119

Last change on this file since 10119 was 10119, checked in by richardvm, 13 years ago

vpn, node, proxy and future other stuff

File size: 10.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
6NANO_CONF_DIR=$(cd $(dirname $2); pwd -P)
7
8NANO_NAME=wleiden # object naam in /usr/obj/nanobsd.{obj}
9NANO_SRC=/usr/src # nanobsd source tree
10NANO_KERNEL=$NANO_CONF_DIR/kernel.wleiden # naam van het kernel configuratiebestand
11NANO_IMAGES=2 # aantal nanobsd code slices/installs (1/2)
12#NANO_DRIVE=ad1 # NanoBSD disk id, default is ad0
13
14NANO_CONFSIZE=8192 # volume van de config slice, default 2048 (512bs)
15NANO_DATASIZE=0 # volume van de data slice, 0 = not configured
16# 200MB should is suffient of every image we might as well use all available
17# space, but that increases update times
18#NANO_CODESIZE=409600 # volume van de code slice, default = max beschikbaar
19NANO_CODESIZE=819200
20#NANO_RAM_ETCSIZE= # volume van de /etc ramdisk, default 10240 (512bs)
21#NANO_RAM_TMPVARSIZE= # volume van de /var ramdisk, default 10240 (512bs)
22NANO_RAM_TMPVARSIZE=20480
23
24#XXX: Eeks, fixed packages, needs building a hook to allow building the package
25# of the shelfs if needed, copy to right directory, done. With only input needed
26# a list of ports in the format like net/net-snmp
27NANO_PACKAGE_DIR=$NANO_CONF_DIR/../pkg/All
28
29# XXX: Create function which populate the right packages and fixes the
30# dependencies. Package build script could benefit from this list, as it
31# could build this list beforehand
32## pkg_info -qr pkg/All/*
33##NANO_PACKAGE_LIST=
34
35# Warning: set to 1 to debug make build errors
36# Number of recurrent parrallel make builds
37if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then
38 # Mac OS X Parallels virtual machine
39 NANO_PMAKE="make -B"
40elif [ "`sysctl hw.model`" = "AMD Sempron(tm) Processor 3000+" ]; then
41 # Parralel builds on this friend fails somehow
42 NANO_PMAKE="make -B"
43else
44 # Default 2 times number of CPU's inside machine
45 NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2`
46 NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}"
47fi
48
49# LET OP, optie nodig bij het gebruik van Alix bordjes ivm tinybios & LBA
50# ondersteuning. Specifieke flash-geometrie instellingen vereist.
51#NANO_BOOT0CFG="-o nopacket -s 1 -m 3"
52
53#
54# Starting from soekris bios version 1.31 upwards boot0sio does not seems work
55# anymore, but boot0 does (weird)
56NANO_BOOTLOADER="boot/boot0"
57
58# Strip down to a more acceptable size
59# hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB)
60# 46MB
61# NB! usr/share/misc contains termcap, vi(1) etc fails to work without it.
62# NANOBSD_PRUNE += usr/share/misc
63NANO_PRUNE="$NANO_PRUNE usr/share/examples"
64NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
65NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
66NANO_PRUNE="$NANO_PRUNE usr/share/mk"
67NANO_PRUNE="$NANO_PRUNE usr/share/pcvt"
68NANO_PRUNE="$NANO_PRUNE usr/share/me"
69NANO_PRUNE="$NANO_PRUNE usr/share/doc"
70
71
72
73
74
75# Opties parsed gedurende build & install world
76# Also check man 3 src.conf for details
77# Some flags are misleading, e.g. could only be installworld (e.g.), for details:
78# http://phk.freebsd.dk/misc/build_options/
79# For details on make options also check:
80# /usr/src/share/mk/bsd.own.mk
81CONF_COMMON='
82# Specific enabled options
83#WITHOUT_ACPI=YES # geen advanced configuration power interface
84#WITHOUT_BIND=YES # geen bind tools, dns/named geinstalleerd
85#WITHOUT_CXX=YES # Set to not build g++(1) and related libraries.
86#WITHOUT_GROFF=YES # Set to not build groff(1).
87#WITHOUT_INET6=YES # geen ondersteuning inet versie 6 architectuur
88#WITHOUT_INFO=YES # geen info bestanden, readable online docs
89#WITHOUT_IPFILTER=YES # geen ip filtering geinstalleerd
90#WITHOUT_KLDLOAD=YES # do not allow loading of kernel modules
91#WITHOUT_MAILWRAPPER=YES # geen mailwrapper bij gebruik sendmail
92#WITHOUT_MAN=YES # geen handleidingen gecompileerd
93#WITHOUT_MISC=YES # geen misc sub directory
94#WITHOUT_MODULES=YES # geen ondersteuning toevoegen modules
95#WITHOUT_PAM=YES # geen ondersteuning pa modules
96#WITHOUT_PF=YES # geen packet filtering geinstalleerd
97#WITHOUT_SHARE=YES # geen share sub directory
98#WITHOUT_USB=YES # geen ondersteuning usb modules
99# Specific disabled options
100WITHOUT_ATM=YES # geen ondersteuning Asynchronous Transfer Mode
101WITHOUT_AUDIT=YES # geen event auditing / audit trails
102WITHOUT_AUTHPF=YES # geen authenticating gateway user shell
103WITHOUT_BLUETOOTH=YES # geen ondersteuning Bluetooth modules
104WITHOUT_CALENDAR=YES # geen calendar reminder service gecompileerd
105WITHOUT_CDDL=YES # Set to not build code licensed under Sun CDDL. (also ZFS)
106WITHOUT_CPP=YES # Set to not build cpp(1).
107WITHOUT_CVS=YES # geen cvs tools geinstalleerd
108WITHOUT_DICT=YES # geen dictionary ondersteuning
109WITHOUT_EXAMPLES=YES # geen voorbeeld configuratiebestanden
110WITHOUT_FORTRAN=YES # geen ondersteuning fortran compilers
111WITHOUT_GAMES=YES # geen games gecompileerd
112WITHOUT_GCOV=YES # geen gcov test coverage program
113WITHOUT_GDB=YES # geen gnu debugger gecompileerd
114WITHOUT_GPIB=YES # geen ondersteuning gpib kaarten
115WITHOUT_HTML=YES # geen html help bestanden gecompileerd
116WITHOUT_I4B=YES # geen ondersteuning voor isdn
117WITHOUT_IPX=YES # geen ondersteuning ipx protocols
118WITHOUT_KERBEROS=YES # geen ondersteuning Kerberos authenticatie
119WITHOUT_LOCALES=YES # geen ondersteuning lokalisatie
120WITHOUT_LPR=YES # geen ondersteuning print services
121WITHOUT_NIS=YES # geen ondersteuning network information system
122WITHOUT_PROFILE=YES # Set to avoid compiling profiled libraries.
123WITHOUT_RCMDS=YES # geen ondersteuning rcmds,
124WITHOUT_RESCUE=YES # geen rescue bestanden gecompileerd
125WITHOUT_SENDMAIL=YES # geen sendmail geinstalleerd
126WITHOUT_SHAREDOCS=YES # geen share/docs directories
127WITHOUT_SYSCONS=YES # geen syscon devices gecompileerd
128'
129
130CONF_BUILD="
131${CONF_COMMON}
132"
133
134CONF_INSTALL="
135${CONF_COMMON}
136WITHOUT_TOOLCHAIN=YES # geen freebsd toolchain
137"
138
139
140# Flash disks arrived, sandisk 1g seems to match the geometry of the (blanc) cards
141#FlashDevice sandisk 1g # nanobsd flashdevice entry
142#FlashDevice sandisk 512mb # nanobsd flashdevice entry
143#FlashDevice transcend 2g # nanobsd flashdevice entry
144# Calculated value of PEAK hardware 1GB CF card
145# C/H/S phys 1954/16/63, logical 977/32/63
146# Mediasize is calculated as C*H*S*512
147
148NANO_MEDIASIZE=`expr 1008451584 / 512`
149
150#using logical values reported by Alix board
151
152NANO_HEADS=32
153NANO_SECTS=63
154
155#values for PCEngines blanc 1 GB cards
156#NANO_MEDIASIZE='expr 1014644736 / 512'
157#C/H/S phys 1966/16/63, logical 983/32/63
158
159# Version tagging
160cust_version_tag() (
161 VERSION_FILE="${NANO_WORLDDIR}/tools/wl-release.txt"
162 (
163 echo "Generated by `id -un`@`hostname -f` at `date`"
164 echo ""
165 echo "=== CONFIG specifics ==="
166 svn info ${NANO_CONF_DIR}/../ || exit 0
167 svn diff ${NANO_CONF_DIR}/../ || exit 0
168 echo "=== BEGIN CONFIG specifics ==="
169 ) > $VERSION_FILE
170)
171
172
173
174# Assuming we are running a safe envirionment where snooping could occur during or after the build
175cust_set_root_password() (
176 if [ -n "${CFG_ROOT_PASSWORD}" ]; then
177 pprint 2 "Set root password using CFG_ROOT_PASSWORD variable"
178 chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -u root"
179 else
180 pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD"
181 fi
182)
183
184
185
186# EXPERIMENTAL patch like envirionment
187# Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to
188# keep us as close as possible to the base OS
189# Patches are applied to the directory they live in
190cust_apply_nanobsd_patches() (
191 for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do
192 cd `dirname ${PATCHFILE}`
193 patch -t -N -p0 -i `basename ${PATCHFILE}`
194 #XX: What to with installed patch files? Delete them for the time beeing
195 rm -v ${PATCHFILE}
196 done
197
198
199
200)
201
202
203
204# Compile & install lvroute daemon vanuit source in svn
205cust_install_lvrouted() (
206 svn co http://svn.wirelessleiden.nl/svn/node-config/other/lvrouted/trunk/ /tmp/lvrouted
207 cd /tmp/lvrouted && autoconf && autoheader && ./configure && make || true
208 cp src/lvrouted.opt ${NANO_WORLDDIR}/usr/local/sbin
209)
210
211
212
213# Customize ntpd
214cust_ntpd() (
215 chroot ${NANO_WORLDDIR} sh -c "ln -fs /usr/local/etc/ntp.drift /var/db/ntp.drift"
216)
217
218
219
220# Install files from specific relative location
221cust_install_files () (
222 cd ${NANO_CONF_DIR}/../files
223 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${NANO_WORLDDIR}
224)
225
226
227
228# Prune no needed directories of image
229cust_nano_prune () (
230 cd ${NANO_WORLDDIR}
231 for ENTRY in ${NANO_PRUNE}; do
232 rm -vfR ${ENTRY}
233 done
234)
235
236
237# Fill /cfg with custom files, based on 'create_i386_diskimage ( )'
238last_nano_fill_cfg () (
239 # Variables to be used
240 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
241 MNT=${MAKEOBJDIRPREFIX}/_.mnt
242
243 # Mount '/cfg' slize in image
244 MD=`mdconfig -a -t vnode -f ${IMG}`
245 mount /dev/${MD}s3 ${MNT}
246
247 # Location of '/cfg' directory
248 cd ${NANO_CONF_DIR}/../cfg-files
249 find . -print | grep -v -e /CVS -e .svn | cpio -dumpv ${MNT}
250
251
252 # Leave in nice end state
253 umount ${MNT}
254 mdconfig -d -u ${MD}
255) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1
256
257last_nano_disk_usage () (
258 # Variables to be used
259 IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME}
260 MNT=${MAKEOBJDIRPREFIX}/_.mnt
261
262 # Mount root slize
263 MD=`mdconfig -a -t vnode -f ${IMG}`
264 mount /dev/${MD}s1a ${MNT}
265
266 # Show disk usage (percent free) inc header
267 pprint 2 $(df -h | head -1)
268 pprint 2 "$(df -h | grep /dev/${MD})"
269
270 # Leave in nice end state
271 umount ${MNT}
272 mdconfig -d -u ${MD}
273)
274
275last_orders () (
276 last_nano_fill_cfg
277 last_nano_disk_usage
278)
279
280# Ugly hack to 'escaping' pprint from inside a customize_cmd to output
281# instead of a file
282exec 3>/dev/stdout
283# Progress Print
284# Print $2 at level $1
285pprint() {
286 if [ "$1" -le $PPLEVEL ]; then
287 printf "%.${1}s %s\n" "#####" "$2" 1>&3
288 fi
289}
290
291# Cust macro`s gestart in onderstaande volgorde
292# XXX: Determine size before installing all find of additions to see how much
293# base we are actually using ## du -h -d 0
294customize_cmd cust_pkg
295customize_cmd cust_install_files
296customize_cmd cust_ntpd
297#customize_cmd cust_install_lvrouted
298customize_cmd cust_version_tag
299customize_cmd cust_allow_ssh_root
300customize_cmd cust_nano_prune
301customize_cmd cust_set_root_password
302customize_cmd cust_apply_nanobsd_patches
Note: See TracBrowser for help on using the repository browser.