| 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 | # Wireless Leiden ports from $WL_PORTSDIR are copied OVER $PORTSDIR | 
|---|
| 31 | PORTSDIR='/usr/ports' | 
|---|
| 32 | WL_PORTSDIR="$NANO_CONF_DIR/../ports/" | 
|---|
| 33 |  | 
|---|
| 34 | # Dirty quirk to allow comments in part below | 
|---|
| 35 | PACKAGE_LIST=`cat <<EOF | sed -e 's/#.*$//g' | xargs | 
|---|
| 36 | benchmarks/iperf | 
|---|
| 37 | devel/py-Jinja2 | 
|---|
| 38 | devel/py-yaml | 
|---|
| 39 | dns/dnsmasq | 
|---|
| 40 | editors/vim-lite | 
|---|
| 41 | ftp/curl | 
|---|
| 42 | lang/python | 
|---|
| 43 | net-mgmt/net-snmp | 
|---|
| 44 | net-mgmt/nrpe2 | 
|---|
| 45 | net/mtr | 
|---|
| 46 | net/isc-dhcp42-server | 
|---|
| 47 | net/pen | 
|---|
| 48 | net/sixxs-aiccu | 
|---|
| 49 | security/nmap | 
|---|
| 50 | security/openvpn | 
|---|
| 51 | security/sudo | 
|---|
| 52 | shells/bash-static | 
|---|
| 53 | sysutils/screen | 
|---|
| 54 | sysutils/ucspi-tcp | 
|---|
| 55 | www/thttpd | 
|---|
| 56 | www/tinyproxy | 
|---|
| 57 |  | 
|---|
| 58 | # Extra WL ports | 
|---|
| 59 | net/lvrouted | 
|---|
| 60 | ` | 
|---|
| 61 | # Package target | 
|---|
| 62 | # Dirty quirk to allow comments in part below | 
|---|
| 63 | PKG_MAKE_ARGS=`cat <<EOF | sed 's/#.*$//g' | xargs | 
|---|
| 64 | PACKAGES=$(dirname $NANO_PACKAGE_DIR) | 
|---|
| 65 | BATCH=yes PACKAGE_BUILDING=yes | 
|---|
| 66 | # www/py-cherrypy | 
|---|
| 67 | WITH_APACHE=yes | 
|---|
| 68 | # net-mgmt/net-snmp | 
|---|
| 69 | WITHOUT_PERL=yes | 
|---|
| 70 | WITHOUT_PERL_EMBEDDED=yes | 
|---|
| 71 | # net-mgmt/nagios-plugins | 
|---|
| 72 | WITH_FPING=yes | 
|---|
| 73 | # threads is broken in the version (atleast up to 9.0 - 20120213) | 
|---|
| 74 | # Should be fix in current version in linux, but for some reason | 
|---|
| 75 | # Not yet in BSD. We don't need threads | 
|---|
| 76 | WITHOUT_THREADS=yes | 
|---|
| 77 | # shells/bash-static | 
|---|
| 78 | WITH_SYSLOG=yes | 
|---|
| 79 | # net/mtr | 
|---|
| 80 | WITHOUT_X11=yes | 
|---|
| 81 | ` | 
|---|
| 82 |  | 
|---|
| 83 | ##NANO_PACKAGE_LIST= | 
|---|
| 84 |  | 
|---|
| 85 | # Warning: set to 1 to debug make build errors | 
|---|
| 86 | # Number of recurrent parrallel make builds | 
|---|
| 87 | if `grep -q 'acpi0: <PRLS PRLS_OEM> on motherboard' /var/run/dmesg.boot`; then | 
|---|
| 88 | # Mac OS X Parallels virtual machine | 
|---|
| 89 | NANO_PMAKE="make -B" | 
|---|
| 90 | else | 
|---|
| 91 | # Default 2 times number of CPU's inside machine | 
|---|
| 92 | NANO_PARALLEL_MAKE=`expr $(sysctl -n hw.ncpu) \* 2` | 
|---|
| 93 | NANO_PMAKE="make -j ${NANO_PARALLEL_MAKE}" | 
|---|
| 94 | fi | 
|---|
| 95 |  | 
|---|
| 96 | # Starting from soekris bios version 1.31 upwards boot0sio does not seems work | 
|---|
| 97 | # anymore, but boot0 does (weird) | 
|---|
| 98 | NANO_BOOTLOADER="boot/boot0" | 
|---|
| 99 |  | 
|---|
| 100 | # Strip down to a more acceptable size | 
|---|
| 101 | # hints from http://people.freebsd.org/~phk/nanobsd/soekris_4x26/make.soekris_4x26.conf (46MB) | 
|---|
| 102 | NANO_PRUNE="$NANO_PRUNE usr/share/examples" | 
|---|
| 103 | NANO_PRUNE="$NANO_PRUNE usr/share/syscons" | 
|---|
| 104 | NANO_PRUNE="$NANO_PRUNE usr/share/calendar" | 
|---|
| 105 | # NB!  usr/share/misc contains termcap, vi(1) etc fails to work without it. | 
|---|
| 106 | # NANOBSD_PRUNE +=      usr/share/misc | 
|---|
| 107 | NANO_PRUNE="$NANO_PRUNE usr/share/pcvt" | 
|---|
| 108 | NANO_PRUNE="$NANO_PRUNE usr/share/me" | 
|---|
| 109 | NANO_PRUNE="$NANO_PRUNE usr/share/doc" | 
|---|
| 110 |  | 
|---|
| 111 |  | 
|---|
| 112 |  | 
|---|
| 113 |  | 
|---|
| 114 |  | 
|---|
| 115 | # Opties parsed gedurende build & install world | 
|---|
| 116 | # Also check man 3 src.conf for details | 
|---|
| 117 | # Some flags are misleading, e.g. could only be installworld (e.g.), for details: | 
|---|
| 118 | #     http://phk.freebsd.dk/misc/build_options/ | 
|---|
| 119 | # For details on make options also check: | 
|---|
| 120 | #     /usr/src/share/mk/bsd.own.mk | 
|---|
| 121 | CONF_COMMON=' | 
|---|
| 122 | # Specific enabled options | 
|---|
| 123 | #WITHOUT_ACPI=YES                       # geen advanced configuration power interface | 
|---|
| 124 | #WITHOUT_BIND=YES                       # geen bind tools, dns/named geinstalleerd | 
|---|
| 125 | #WITHOUT_CXX=YES                        # Set to not build g++(1) and related libraries. | 
|---|
| 126 | #WITHOUT_GROFF=YES                      # Set to not build groff(1). | 
|---|
| 127 | #WITHOUT_INET6=YES                      # geen ondersteuning inet versie 6 architectuur | 
|---|
| 128 | #WITHOUT_INFO=YES                       # geen info bestanden, readable online docs | 
|---|
| 129 | #WITHOUT_IPFILTER=YES                   # geen ip filtering geinstalleerd | 
|---|
| 130 | #WITHOUT_KLDLOAD=YES                    # do not allow loading of kernel modules | 
|---|
| 131 | #WITHOUT_MAILWRAPPER=YES                # geen mailwrapper bij gebruik sendmail | 
|---|
| 132 | #WITHOUT_MAN=YES                        # geen handleidingen gecompileerd | 
|---|
| 133 | #WITHOUT_MISC=YES                       # geen misc sub directory | 
|---|
| 134 | #WITHOUT_MODULES=YES                    # geen ondersteuning toevoegen modules | 
|---|
| 135 | #WITHOUT_PAM=YES                        # geen ondersteuning pa modules | 
|---|
| 136 | #WITHOUT_PF=YES                         # geen packet filtering geinstalleerd | 
|---|
| 137 | #WITHOUT_SHARE=YES                      # geen share sub directory | 
|---|
| 138 | #WITHOUT_USB=YES                        # geen ondersteuning usb modules | 
|---|
| 139 | # Specific disabled options | 
|---|
| 140 | WITHOUT_ATM=YES                         # geen ondersteuning Asynchronous Transfer Mode | 
|---|
| 141 | WITHOUT_AUDIT=YES                       # geen event auditing / audit trails | 
|---|
| 142 | WITHOUT_AUTHPF=YES                      # geen authenticating gateway user shell | 
|---|
| 143 | WITHOUT_BLUETOOTH=YES                   # geen ondersteuning Bluetooth modules | 
|---|
| 144 | WITHOUT_CALENDAR=YES                    # geen calendar reminder service gecompileerd | 
|---|
| 145 | WITHOUT_CDDL=YES                        # Set to not build code licensed under Sun CDDL. (also ZFS) | 
|---|
| 146 | WITHOUT_CPP=YES                         # Set to not build cpp(1). | 
|---|
| 147 | WITHOUT_CVS=YES                         # geen cvs tools geinstalleerd | 
|---|
| 148 | WITHOUT_DICT=YES                        # geen dictionary ondersteuning | 
|---|
| 149 | WITHOUT_EXAMPLES=YES                    # geen voorbeeld configuratiebestanden | 
|---|
| 150 | WITHOUT_FORTRAN=YES                     # geen ondersteuning fortran compilers | 
|---|
| 151 | WITHOUT_GAMES=YES                       # geen games gecompileerd | 
|---|
| 152 | WITHOUT_GCOV=YES                        # geen gcov test coverage program | 
|---|
| 153 | WITHOUT_GDB=YES                         # geen gnu debugger gecompileerd | 
|---|
| 154 | WITHOUT_GPIB=YES                        # geen ondersteuning gpib kaarten | 
|---|
| 155 | WITHOUT_HTML=YES                        # geen html help bestanden gecompileerd | 
|---|
| 156 | WITHOUT_I4B=YES                         # geen ondersteuning voor isdn | 
|---|
| 157 | WITHOUT_IPX=YES                         # geen ondersteuning ipx protocols | 
|---|
| 158 | WITHOUT_KERBEROS=YES                    # geen ondersteuning Kerberos authenticatie | 
|---|
| 159 | WITHOUT_LOCALES=YES                     # geen ondersteuning lokalisatie | 
|---|
| 160 | WITHOUT_LPR=YES                         # geen ondersteuning print services | 
|---|
| 161 | WITHOUT_NIS=YES                         # geen ondersteuning network information system | 
|---|
| 162 | WITHOUT_PROFILE=YES                     # Set to avoid compiling profiled libraries. | 
|---|
| 163 | WITHOUT_RCMDS=YES                       # geen ondersteuning rcmds, | 
|---|
| 164 | WITHOUT_RESCUE=YES                      # geen rescue bestanden gecompileerd | 
|---|
| 165 | WITHOUT_SENDMAIL=YES                    # geen sendmail geinstalleerd | 
|---|
| 166 | WITHOUT_SHAREDOCS=YES                   # geen share/docs directories | 
|---|
| 167 | WITHOUT_SYSCONS=YES                     # geen syscon devices gecompileerd | 
|---|
| 168 | ' | 
|---|
| 169 |  | 
|---|
| 170 | CONF_BUILD=" | 
|---|
| 171 | ${CONF_COMMON} | 
|---|
| 172 | " | 
|---|
| 173 |  | 
|---|
| 174 | CONF_INSTALL=" | 
|---|
| 175 | ${CONF_COMMON} | 
|---|
| 176 | WITHOUT_TOOLCHAIN=YES                   # geen freebsd toolchain | 
|---|
| 177 | " | 
|---|
| 178 |  | 
|---|
| 179 |  | 
|---|
| 180 | # Flash disks arrived, sandisk 1g seems to match the geometry of the (blanc) cards | 
|---|
| 181 | #FlashDevice sandisk  1g        # nanobsd flashdevice entry | 
|---|
| 182 | #FlashDevice sandisk 512mb      # nanobsd flashdevice entry | 
|---|
| 183 | #FlashDevice transcend 2g       # nanobsd flashdevice entry | 
|---|
| 184 | # Calculated value of PEAK hardware 1GB CF card | 
|---|
| 185 | # C/H/S phys 1954/16/63, logical 977/32/63 | 
|---|
| 186 | # Mediasize is calculated as C*H*S*512 | 
|---|
| 187 |  | 
|---|
| 188 | # Using logical values reported by ALIX board | 
|---|
| 189 | # values for PCEngines blanc 1 GB cards | 
|---|
| 190 | # C/H/S phys 1966/16/63, logical 983/32/63 | 
|---|
| 191 | NANO_MEDIASIZE=`expr 1008451584 / 512` | 
|---|
| 192 | NANO_HEADS=32 | 
|---|
| 193 | NANO_SECTS=63 | 
|---|
| 194 |  | 
|---|
| 195 |  | 
|---|
| 196 | # Version tagging | 
|---|
| 197 | cust_version_tag() ( | 
|---|
| 198 | VERSION_FILE="${NANO_WORLDDIR}/tools/wl-release.txt" | 
|---|
| 199 | ( | 
|---|
| 200 | echo "Generated by `id -un`@`hostname -f` at `date`" | 
|---|
| 201 | echo "" | 
|---|
| 202 | echo "=== CONFIG specifics ===" | 
|---|
| 203 | svn info ${NANO_CONF_DIR}/../ || exit 0 | 
|---|
| 204 | svn diff ${NANO_CONF_DIR}/../ || exit 0 | 
|---|
| 205 | echo "=== BEGIN CONFIG specifics ===" | 
|---|
| 206 | ) > $VERSION_FILE | 
|---|
| 207 | ) | 
|---|
| 208 |  | 
|---|
| 209 | # Takes a very long time (10+) minutes to generate this file on an ALIX board, | 
|---|
| 210 | # not practical for quick debugging and configuration. | 
|---|
| 211 | cust_openvpn_dhparam() ( | 
|---|
| 212 | DHFILE=${NANO_WORLDDIR}/etc/easy-rsa-keys/dh1024.pem | 
|---|
| 213 | mkdir -p `dirname $DHFILE` | 
|---|
| 214 | openssl dhparam -out $DHFILE 1024 | 
|---|
| 215 | ) | 
|---|
| 216 |  | 
|---|
| 217 |  | 
|---|
| 218 |  | 
|---|
| 219 | # Assuming we are running a safe envirionment where snooping could occur during or after the build | 
|---|
| 220 | cust_set_root_password() ( | 
|---|
| 221 | if [ -n "${CFG_ROOT_PASSWORD}" ]; then | 
|---|
| 222 | pprint 2 "Set root password using CFG_ROOT_PASSWORD variable" | 
|---|
| 223 | chroot ${NANO_WORLDDIR} sh -c "echo '${CFG_ROOT_PASSWORD}' | pw usermod -h 0 -u root" | 
|---|
| 224 | else | 
|---|
| 225 | pprint 2 "Root password is <blank>, no password provided at variable CFG_ROOT_PASSWORD" | 
|---|
| 226 | fi | 
|---|
| 227 | ) | 
|---|
| 228 |  | 
|---|
| 229 |  | 
|---|
| 230 |  | 
|---|
| 231 | # EXPERIMENTAL patch like envirionment | 
|---|
| 232 | # Using '*-nanobsd.patch' files to only specify the bare differences between the base/default file to | 
|---|
| 233 | # keep us as close as possible to the base OS | 
|---|
| 234 | # Patches are applied to the directory they live in | 
|---|
| 235 | cust_apply_nanobsd_patches() ( | 
|---|
| 236 | for PATCHFILE in `find ${NANO_WORLDDIR} -regex '.*-nanobsd\.patch$'`; do | 
|---|
| 237 | cd `dirname ${PATCHFILE}` | 
|---|
| 238 | patch -t -N -p0 -i `basename ${PATCHFILE}` | 
|---|
| 239 | #XX: What to with installed patch files? Delete them for the  time beeing | 
|---|
| 240 | rm -v ${PATCHFILE} | 
|---|
| 241 | done | 
|---|
| 242 |  | 
|---|
| 243 |  | 
|---|
| 244 |  | 
|---|
| 245 | ) | 
|---|
| 246 |  | 
|---|
| 247 |  | 
|---|
| 248 |  | 
|---|
| 249 | # Compile & install lvroute daemon vanuit source in svn | 
|---|
| 250 | cust_install_lvrouted() ( | 
|---|
| 251 | svn co http://svn.wirelessleiden.nl/svn/node-config/other/lvrouted/trunk/ /tmp/lvrouted | 
|---|
| 252 | cd /tmp/lvrouted && autoconf && autoheader && ./configure && make || true | 
|---|
| 253 | cp src/lvrouted.opt ${NANO_WORLDDIR}/usr/local/sbin | 
|---|
| 254 | ) | 
|---|
| 255 |  | 
|---|
| 256 |  | 
|---|
| 257 |  | 
|---|
| 258 | # Customize ntpd | 
|---|
| 259 | cust_ntpd() ( | 
|---|
| 260 | chroot ${NANO_WORLDDIR} sh -c "ln -fs /usr/local/etc/ntp.drift /var/db/ntp.drift" | 
|---|
| 261 | ) | 
|---|
| 262 |  | 
|---|
| 263 |  | 
|---|
| 264 | # Enable Serial TTYs | 
|---|
| 265 | cust_serial_ttys() ( | 
|---|
| 266 | chroot ${NANO_WORLDDIR} sed -i '' -e '/ttyv[0-9]/s/on /off/' -e '/ttyu0/s/off/on/' -e '/ttyu0/s/dialup/ansi/' /etc/ttys | 
|---|
| 267 | ) | 
|---|
| 268 |  | 
|---|
| 269 |  | 
|---|
| 270 |  | 
|---|
| 271 | # Install files from specific relative location | 
|---|
| 272 | cust_install_files () ( | 
|---|
| 273 | cd ${NANO_CONF_DIR}/../files | 
|---|
| 274 | find . -print | grep -v -e /CVS -e .svn  | cpio -dumpv ${NANO_WORLDDIR} | 
|---|
| 275 | ) | 
|---|
| 276 |  | 
|---|
| 277 |  | 
|---|
| 278 | # pkgdb should live on persistent storage only | 
|---|
| 279 | cust_alternate_pkg_db () ( | 
|---|
| 280 | mkdir -p ${NANO_WORLDDIR}/usr/local/var/db/pkg ${NANO_WORLDDIR}/usr/local/tmp | 
|---|
| 281 | touch ${NANO_WORLDDIR}/usr/local/tmp/.hack-to-avoid-pruning-directory | 
|---|
| 282 | # sh profile | 
|---|
| 283 | ( echo 'PKG_DBDIR=/usr/local/var/db/pkg; export PKG_DBDIR'; \ | 
|---|
| 284 | echo 'PKG_TMPDIR=/usr/local/tmp; export PKG_TMPDIR' ) >> ${NANO_WORLDDIR}/etc/profile | 
|---|
| 285 | # csh profile | 
|---|
| 286 | ( echo 'setenv PKG_DBDIR /usr/local/var/db/pkg'; \ | 
|---|
| 287 | echo 'setenv PKG_TMPDIR /usr/local/tmp' ) >> ${NANO_WORLDDIR}/etc/csh.cshrc | 
|---|
| 288 |  | 
|---|
| 289 | rmdir ${NANO_WORLDDIR}/var/db/pkg | 
|---|
| 290 | ln -s /usr/local/var/db/pkg ${NANO_WORLDDIR}/var/db/pkg | 
|---|
| 291 | ) | 
|---|
| 292 |  | 
|---|
| 293 | # Make tools available for root by default | 
|---|
| 294 | cust_root_bin_to_tools() { | 
|---|
| 295 | ln -s /tools ${NANO_WORLDDIR}/root/bin | 
|---|
| 296 | } | 
|---|
| 297 |  | 
|---|
| 298 | # Directly stolen from /usr/src/tools/tools/nanobsd/nanobsd.sh, and make sure | 
|---|
| 299 | # to source /etc/profile in chroot to get PKG_* included, for alternate installs | 
|---|
| 300 | cust_pkg () ( | 
|---|
| 301 | # If the package directory doesn't exist, we're done. | 
|---|
| 302 | if [ ! -d ${NANO_PACKAGE_DIR} ]; then | 
|---|
| 303 | echo "DONE 0 packages" | 
|---|
| 304 | return 0 | 
|---|
| 305 | fi | 
|---|
| 306 |  | 
|---|
| 307 | # Make sure to enable /dev as easy_install requires it for example | 
|---|
| 308 | mount -t devfs devfs ${NANO_WORLDDIR}/dev | 
|---|
| 309 | trap "umount ${NANO_WORLDDIR}/dev" 0 | 
|---|
| 310 | trap "exit 1" 1 2 3 15 | 
|---|
| 311 |  | 
|---|
| 312 | # Copy packages into chroot | 
|---|
| 313 | mkdir -p ${NANO_WORLDDIR}/Pkg | 
|---|
| 314 | ( | 
|---|
| 315 | cd ${NANO_PACKAGE_DIR} | 
|---|
| 316 | find ${NANO_PACKAGE_LIST} -print | | 
|---|
| 317 | cpio -Ldumpv ${NANO_WORLDDIR}/Pkg | 
|---|
| 318 | ) | 
|---|
| 319 |  | 
|---|
| 320 | # Count & report how many we have to install | 
|---|
| 321 | todo=`ls ${NANO_WORLDDIR}/Pkg | wc -l` | 
|---|
| 322 | echo "=== TODO: $todo" | 
|---|
| 323 | ls ${NANO_WORLDDIR}/Pkg | 
|---|
| 324 | echo "===" | 
|---|
| 325 | NANO_PKG_DBDIR=${NANO_WORLDDIR}/`chroot ${NANO_WORLDDIR} sh -c '. /etc/profile; echo ${PKG_DBDIR:-/var/db/pkg}'` | 
|---|
| 326 | while true | 
|---|
| 327 | do | 
|---|
| 328 | # Record how many we have now | 
|---|
| 329 | have=`ls ${NANO_PKG_DBDIR} | wc -l` | 
|---|
| 330 |  | 
|---|
| 331 | # Attempt to install more packages | 
|---|
| 332 | # ...but no more than 200 at a time due to pkg_add's internal | 
|---|
| 333 | # limitations. | 
|---|
| 334 | chroot ${NANO_WORLDDIR} sh -c \ | 
|---|
| 335 | '. /etc/profile; ls Pkg/*tbz | xargs -n 200 pkg_add -F' || true | 
|---|
| 336 |  | 
|---|
| 337 | # See what that got us | 
|---|
| 338 | now=`ls ${NANO_PKG_DBDIR} | wc -l` | 
|---|
| 339 | echo "=== NOW $now" | 
|---|
| 340 | ls ${NANO_PKG_DBDIR} | 
|---|
| 341 | echo "===" | 
|---|
| 342 |  | 
|---|
| 343 |  | 
|---|
| 344 | if [ $now -eq $todo ] ; then | 
|---|
| 345 | echo "DONE $now packages" | 
|---|
| 346 | break | 
|---|
| 347 | elif [ $now -eq $have ] ; then | 
|---|
| 348 | echo "FAILED: Nothing happened on this pass" | 
|---|
| 349 | exit 2 | 
|---|
| 350 | fi | 
|---|
| 351 | done | 
|---|
| 352 | rm -rf ${NANO_WORLDDIR}/Pkg | 
|---|
| 353 |  | 
|---|
| 354 | # Return normal trap behaviour | 
|---|
| 355 | trap - 1 2 3 15 | 
|---|
| 356 | ) | 
|---|
| 357 |  | 
|---|
| 358 |  | 
|---|
| 359 | # Prune no needed directories of image | 
|---|
| 360 | cust_nano_prune () ( | 
|---|
| 361 | cd ${NANO_WORLDDIR} | 
|---|
| 362 | for ENTRY in ${NANO_PRUNE}; do | 
|---|
| 363 | rm -vfR ${ENTRY} | 
|---|
| 364 | done | 
|---|
| 365 | ) | 
|---|
| 366 |  | 
|---|
| 367 | # We actually do need an seperate /tmp, so undo the symlinking done in | 
|---|
| 368 | # setup_nanobsd() | 
|---|
| 369 | late_cust_unset_common_var_and_tmp() ( | 
|---|
| 370 | cd ${NANO_WORLDDIR} | 
|---|
| 371 | rm tmp | 
|---|
| 372 | mkdir -m 1777 tmp | 
|---|
| 373 | ) | 
|---|
| 374 |  | 
|---|
| 375 |  | 
|---|
| 376 | # Fill /cfg wmth custom files, based on 'create_i386_diskimage ( )' | 
|---|
| 377 | last_nano_fill_cfg () ( | 
|---|
| 378 | # Variables to be used | 
|---|
| 379 | IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} | 
|---|
| 380 | MNT=${MAKEOBJDIRPREFIX}/_.mnt | 
|---|
| 381 |  | 
|---|
| 382 | # Mount '/cfg' slize in image | 
|---|
| 383 | MD=`mdconfig -a -t vnode -f ${IMG}` | 
|---|
| 384 | mount /dev/${MD}s3 ${MNT} | 
|---|
| 385 |  | 
|---|
| 386 | # Location of '/cfg' directory | 
|---|
| 387 | cd ${NANO_CONF_DIR}/../cfg-files | 
|---|
| 388 | find . -print | grep -v -e /CVS -e .svn  | cpio -dumpv ${MNT} | 
|---|
| 389 |  | 
|---|
| 390 |  | 
|---|
| 391 | # Leave in nice end state | 
|---|
| 392 | umount ${MNT} | 
|---|
| 393 | mdconfig -d -u ${MD} | 
|---|
| 394 | ) > ${MAKEOBJDIRPREFIX}/_.fc 2>&1 | 
|---|
| 395 |  | 
|---|
| 396 | last_nano_disk_usage () ( | 
|---|
| 397 | # Variables to be used | 
|---|
| 398 | IMG=${NANO_DISKIMGDIR}/${NANO_IMGNAME} | 
|---|
| 399 | MNT=${MAKEOBJDIRPREFIX}/_.mnt | 
|---|
| 400 |  | 
|---|
| 401 | # Mount root slize | 
|---|
| 402 | MD=`mdconfig -a -t vnode -f ${IMG}` | 
|---|
| 403 | mount /dev/${MD}s1a ${MNT} | 
|---|
| 404 |  | 
|---|
| 405 | # Show disk usage (percent free) inc header | 
|---|
| 406 | pprint 2  $(df -h | head -1) | 
|---|
| 407 | pprint 2 "$(df -h | grep /dev/${MD})" | 
|---|
| 408 |  | 
|---|
| 409 | # Leave in nice end state | 
|---|
| 410 | umount ${MNT} | 
|---|
| 411 | mdconfig -d -u ${MD} | 
|---|
| 412 | ) | 
|---|
| 413 |  | 
|---|
| 414 | last_orders () ( | 
|---|
| 415 | last_nano_fill_cfg | 
|---|
| 416 | last_nano_disk_usage | 
|---|
| 417 | ) | 
|---|
| 418 |  | 
|---|
| 419 | # Ugly hack to 'escaping' pprint from inside a customize_cmd to output | 
|---|
| 420 | # instead of a file | 
|---|
| 421 | exec 3>/dev/stdout | 
|---|
| 422 | # Progress Print | 
|---|
| 423 | #       Print $2 at level $1 | 
|---|
| 424 | pprint() { | 
|---|
| 425 | if [ "$1" -le $PPLEVEL ]; then | 
|---|
| 426 | printf "%.${1}s %s\n" "#####" "$2" 1>&3 | 
|---|
| 427 | fi | 
|---|
| 428 | } | 
|---|
| 429 |  | 
|---|
| 430 | # Cust macro`s gestart in onderstaande volgorde | 
|---|
| 431 | # XXX: Determine size before installing all find of additions to see how much | 
|---|
| 432 | # base we are actually using ## du -h -d 0 | 
|---|
| 433 | customize_cmd cust_alternate_pkg_db | 
|---|
| 434 | customize_cmd cust_pkg | 
|---|
| 435 | customize_cmd cust_install_files | 
|---|
| 436 | customize_cmd cust_ntpd | 
|---|
| 437 | customize_cmd cust_serial_ttys | 
|---|
| 438 | customize_cmd cust_version_tag | 
|---|
| 439 | customize_cmd cust_root_bin_to_tools | 
|---|
| 440 | customize_cmd cust_allow_ssh_root | 
|---|
| 441 | customize_cmd cust_openvpn_dhparam | 
|---|
| 442 | customize_cmd cust_nano_prune | 
|---|
| 443 | customize_cmd cust_set_root_password | 
|---|
| 444 | customize_cmd cust_apply_nanobsd_patches | 
|---|
| 445 | late_customize_cmd late_cust_unset_common_var_and_tmp | 
|---|
| 446 |  | 
|---|
| 447 | # Standard overwrite | 
|---|
| 448 | if [ -r "$NANO_CONF_DIR/nanobsd.local" ]; then | 
|---|
| 449 | . $NANO_CONF_DIR/nanobsd.local | 
|---|
| 450 | fi | 
|---|
| 451 |  | 
|---|
| 452 | # Extra config if existing is not suffient | 
|---|
| 453 | if [ -n "$EXTRA_NANOBSD_CONFIG" ]; then | 
|---|
| 454 | for FILE in $EXTRA_NANOBSD_CONFIG; do | 
|---|
| 455 | # File relative to config directory | 
|---|
| 456 | if [ "`echo $FILE | cut -c1`" != "/" ]; then | 
|---|
| 457 | FILE=$NANO_CONF_DIR/$FILE | 
|---|
| 458 | fi | 
|---|
| 459 | pprint 1 "Loading $FILE" | 
|---|
| 460 | . $FILE || exit 1 | 
|---|
| 461 | done | 
|---|
| 462 | fi | 
|---|