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
|
---|
6 | if [ -n "$NANO_CFG_FILE" ]; then
|
---|
7 | NANO_CONF_DIR=$(cd $(dirname $NANO_CFG_FILE); pwd -P)
|
---|
8 | else
|
---|
9 | NANO_CONF_DIR=$(cd $(dirname $2); pwd -P)
|
---|
10 | fi
|
---|
11 |
|
---|
12 | # object naam in /usr/obj/nanobsd.{obj}
|
---|
13 | NANO_NAME=wleiden-hybrid
|
---|
14 | NANO_SRC=/usr/src # nanobsd source tree
|
---|
15 | NANO_KERNEL=$NANO_CONF_DIR/kernel.wleiden # naam van het kernel configuratiebestand
|
---|
16 | NANO_IMAGES=2 # aantal nanobsd code slices/installs (1/2)
|
---|
17 |
|
---|
18 | NANO_CONFSIZE=8192 # volume van de config slice, default 2048 (512bs)
|
---|
19 | NANO_DATASIZE=0 # volume van de data slice, 0 = not configured
|
---|
20 | NANO_CODESIZE=819200
|
---|
21 | NANO_RAM_TMPVARSIZE=20480
|
---|
22 |
|
---|
23 | NANO_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
|
---|
28 | NANO_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
|
---|
38 | if `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"
|
---|
41 | elif [ "`sysctl -n hw.model`" = "AMD Sempron(tm) Processor 3000+" ]; then
|
---|
42 | # Parralel builds on this friend fails somehow
|
---|
43 | NANO_PMAKE="make -B"
|
---|
44 | else
|
---|
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}"
|
---|
48 | fi
|
---|
49 |
|
---|
50 | # Starting from soekris bios version 1.31 upwards boot0sio does not seems work
|
---|
51 | # anymore, but boot0 does (weird)
|
---|
52 | NANO_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 | NANO_PRUNE="$NANO_PRUNE usr/share/examples"
|
---|
57 | NANO_PRUNE="$NANO_PRUNE usr/share/syscons"
|
---|
58 | NANO_PRUNE="$NANO_PRUNE usr/share/calendar"
|
---|
59 | NANO_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
|
---|
62 | NANO_PRUNE="$NANO_PRUNE usr/share/pcvt"
|
---|
63 | NANO_PRUNE="$NANO_PRUNE usr/share/me"
|
---|
64 | NANO_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
|
---|
76 | CONF_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
|
---|
95 | WITHOUT_ATM=YES # geen ondersteuning Asynchronous Transfer Mode
|
---|
96 | WITHOUT_AUDIT=YES # geen event auditing / audit trails
|
---|
97 | WITHOUT_AUTHPF=YES # geen authenticating gateway user shell
|
---|
98 | WITHOUT_BLUETOOTH=YES # geen ondersteuning Bluetooth modules
|
---|
99 | WITHOUT_CALENDAR=YES # geen calendar reminder service gecompileerd
|
---|
100 | WITHOUT_CDDL=YES # Set to not build code licensed under Sun CDDL. (also ZFS)
|
---|
101 | WITHOUT_CPP=YES # Set to not build cpp(1).
|
---|
102 | WITHOUT_CVS=YES # geen cvs tools geinstalleerd
|
---|
103 | WITHOUT_DICT=YES # geen dictionary ondersteuning
|
---|
104 | WITHOUT_EXAMPLES=YES # geen voorbeeld configuratiebestanden
|
---|
105 | WITHOUT_FORTRAN=YES # geen ondersteuning fortran compilers
|
---|
106 | WITHOUT_GAMES=YES # geen games gecompileerd
|
---|
107 | WITHOUT_GCOV=YES # geen gcov test coverage program
|
---|
108 | WITHOUT_GDB=YES # geen gnu debugger gecompileerd
|
---|
109 | WITHOUT_GPIB=YES # geen ondersteuning gpib kaarten
|
---|
110 | WITHOUT_HTML=YES # geen html help bestanden gecompileerd
|
---|
111 | WITHOUT_I4B=YES # geen ondersteuning voor isdn
|
---|
112 | WITHOUT_IPX=YES # geen ondersteuning ipx protocols
|
---|
113 | WITHOUT_KERBEROS=YES # geen ondersteuning Kerberos authenticatie
|
---|
114 | WITHOUT_LOCALES=YES # geen ondersteuning lokalisatie
|
---|
115 | WITHOUT_LPR=YES # geen ondersteuning print services
|
---|
116 | WITHOUT_NIS=YES # geen ondersteuning network information system
|
---|
117 | WITHOUT_PROFILE=YES # Set to avoid compiling profiled libraries.
|
---|
118 | WITHOUT_RCMDS=YES # geen ondersteuning rcmds,
|
---|
119 | WITHOUT_RESCUE=YES # geen rescue bestanden gecompileerd
|
---|
120 | WITHOUT_SENDMAIL=YES # geen sendmail geinstalleerd
|
---|
121 | WITHOUT_SHAREDOCS=YES # geen share/docs directories
|
---|
122 | WITHOUT_SYSCONS=YES # geen syscon devices gecompileerd
|
---|
123 | '
|
---|
124 |
|
---|
125 | CONF_BUILD="
|
---|
126 | ${CONF_COMMON}
|
---|
127 | "
|
---|
128 |
|
---|
129 | CONF_INSTALL="
|
---|
130 | ${CONF_COMMON}
|
---|
131 | WITHOUT_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
|
---|
146 | NANO_MEDIASIZE=`expr 1008451584 / 512`
|
---|
147 | NANO_HEADS=32
|
---|
148 | NANO_SECTS=63
|
---|
149 |
|
---|
150 |
|
---|
151 | # Version tagging
|
---|
152 | cust_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
|
---|
167 | cust_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
|
---|
182 | cust_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
|
---|
197 | cust_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
|
---|
206 | cust_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
|
---|
212 | cust_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
|
---|
219 | cust_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
|
---|
227 | cust_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 ( )'
|
---|
236 | last_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 |
|
---|
255 | last_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 |
|
---|
273 | last_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
|
---|
280 | exec 3>/dev/stdout
|
---|
281 | # Progress Print
|
---|
282 | # Print $2 at level $1
|
---|
283 | pprint() {
|
---|
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
|
---|
292 | customize_cmd cust_pkg
|
---|
293 | customize_cmd cust_install_files
|
---|
294 | customize_cmd cust_ntpd
|
---|
295 | customize_cmd cust_serial_ttys
|
---|
296 | customize_cmd cust_version_tag
|
---|
297 | customize_cmd cust_allow_ssh_root
|
---|
298 | customize_cmd cust_nano_prune
|
---|
299 | customize_cmd cust_set_root_password
|
---|
300 | customize_cmd cust_apply_nanobsd_patches
|
---|
301 |
|
---|
302 |
|
---|
303 | # Extra config if existing is not suffient
|
---|
304 | if [ -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
|
---|
313 | fi
|
---|