close Warning: Can't use blame annotator:
No changeset 6797 in the repository

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