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

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

tootls and name

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