#!/bin/sh -Cefu # # Copyright (c) 2024 Sulev-Madis Silber # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # set -Cefu ###################################################################### keymap=ee wall_cmos_clock=1 timezone=Europe/Tallinn ping=example.com ntp_servers='ntp ntp.si.pri.ee' ###################################################################### _mount_unionfs() { local dst="$1" local src="/tmp/unionfs$dst" if [ ! -d "$src" ] then mkdir -p "$src" fi if [ ! -d "$dst" ] then mkdir -p "$dst" fi if ! mount -t unionfs | fgrep -q "$dst" then mount_unionfs -o noatime "$src" "$dst" fi } if [ "$keymap" ] then kbdcontrol -r fast -l "$keymap" fi if [ ! -f /tmp/tmp-mount-done ] then echo mount -t tmpfs tmpfs /tmp service cleartmp start mkdir /tmp/bsdinstall_etc touch /tmp/bsdinstall_log touch /tmp/tmp-mount-done fi for dst in /etc /root /usr/local /var/cache/pkg /var/db/pkg do _mount_unionfs "$dst" done if [ "$wall_cmos_clock" ] then if [ ! -f /etc/wall_cmos_clock ] then touch /etc/wall_cmos_clock fi fi if [ "$timezone" ] then if [ ! -f /etc/localtime ] then tzsetup "$timezone" fi fi if ! pgrep -q adjkerntz then service adjkerntz start fi for if in `ifconfig -l` do if [ "$if" = lo0 ] then continue fi ifconfig "$if" inet6 -ifdisabled accept_rtadv up if ! service dhclient status "$if" > /dev/null then echo service dhclient forcestart "$if" fi done if ! pgrep -q rtsold then rtsold -am fi if [ "$ping" ] then echo for af in 4 6 do if ping "-${af}oq" "$ping" > /dev/null then echo "v$af ok" else echo "v$af fail" fi done fi if [ "$ntp_servers" ] then if [ ! -f /tmp/ntpdate-run-done ] then echo ntpdate $ntp_servers touch /tmp/ntpdate-run-done fi fi if ! service ntpd onestatus > /dev/null then echo service ntpd onestart fi if [ "$ntp_servers" ] then echo if [ -f /tmp/ntpdate-run-done ] then ntpdate -q $ntp_servers fi fi echo date echo for kld in coretemp amdtemp do if [ -f "/boot/kernel/$kld.ko" ] then kldload -n "$kld" fi done sysctl -a | grep '[0-9]C$' | egrep -v '(_(CRT|PSV)|\.tjmax)' if sysctl -a | fgrep -q battery then echo acpiconf -i 0 | grep -v ':[[:space:]]*$' fi echo