#!/bin/sh # Craig Jennings # optimizes and enables functionality in the boot sequence # ensure root if ! [ $(id -u) -eq 0 ] then echo "Must run as root. Exiting." exit fi # disable devil icon in boot menu sysrc -f /boot/loader.conf loader_logo="none" # hide kernel diagnostics sysrc -f /boot/loader.conf boot_mute="YES" # reduce default wait time before boot sysrc -f /boot/loader.conf autoboot_delay=2 # don't print start messages sysrc rc_startmsgs=NO # create console.log with the proper permissions touch /var/log/console.log chmod 600 /var/log/console.log # move from printing errors to the console to printing them to the above console.log file sed -i '' 's#/dev/console#/var/log/console.log#' /etc/syslog.conf # prevent core dumps echo "kern.coredump=0" >> /etc/sysctl.conf # enable linuxulator sysrc -v linux_enable=YES # load microcode sysrc -f /boot/loader.conf cpu_microcode_load="YES" sysrc -f /boot/loader.conf cpu_microcode_name="/boot/firmware/intel-ucode.bin" # Enable querying CPU information and temperature. sysrc -f /boot/loader.conf cpuctl_load="YES" sysrc -f /boot/loader.conf coretemp_load="YES" # Optimizations for Intel graphics. echo 'compat.linuxkpi.i915_enable_fbc="1"' | sudo tee -a /boot/loader.conf echo 'compat.linuxkpi.i915_fastboot="1"' | sudo tee -a /boot/loader.conf # Power saving for Intel graphics. echo 'compat.linuxkpi.i915_disable_power_well="1"' | sudo tee -a /boot/loader.conf echo 'compat.linuxkpi.i915_enable_dc="2"' | sudo tee -a /boot/loader.conf # Allow unprivileged users to mount echo 'vfs.usermount=1' | sudo tee -a /etc/sysctl.conf # Increase ZFS transaction timeout to save battery. echo 'vfs.zfs.txg.timeout="10"' | sudo tee -a /boot/loader.conf # fuse filesystems sysrc kld_list="${kld_list} fusefs" # allow for usb mounting (e.g., kobo reader) pw groupadd usb pw groupmod usb -m root,cjennings echo "[usb=12]" | tee -a /etc/devfs.rules echo "add path 'usb/*' mode 0660 group usb" | tee -a /etc/devfs.rules sysrc devfs_system_ruleset="usb" service devfs restart