diff options
-rw-r--r-- | lib/40-os | 57 | ||||
-rw-r--r-- | scripts/hostclass/laptop | 29 | ||||
-rw-r--r-- | scripts/hostname/rlaptop1 | 25 | ||||
-rw-r--r-- | scripts/os/freebsd/10-rc-conf | 4 | ||||
-rw-r--r-- | vars/hostname/rlaptop1 | 4 |
5 files changed, 99 insertions, 20 deletions
@@ -49,7 +49,7 @@ x load_kernel_module(){ # Ensure the given kernel modules are loaded. - # $1..$N = bootloader options (as "name=value" strings) + # $1..$N = module names case $BOXCONF_OS in freebsd) while [ $# -gt 0 ]; do @@ -62,3 +62,58 @@ load_kernel_module(){ ;; esac } + +add_local_user(){ + _bcalu_homedir_mode=700 + _bcalu_create_homedir= + _bcalu_homedir= + _bcalu_comment= + _bcalu_shell=/sbin/nologin + _bcalu_pgroup= + _bcalu_grouplist= + _bcalu_uid= + + # Add a local user if it doesn't exist. + while getopts c:d:G:g:mM:s:u: _bcalu_opt; do + case $_bcalu_opt in + c) _bcalu_comment=$OPTARG ;; + d) _bcalu_homedir=$OPTARG ;; + G) _bcalu_grouplist=$OPTARG ;; + g) _bcalu_pgroup=$OPTARG ;; + M) _bcalu_homedir_mode=$OPTARG ;; + m) _bcalu_create_homedir=true ;; + s) _bcalu_shell=$OPTARG ;; + u) _bcalu_uid=$OPTARG ;; + esac + done + shift $((OPTIND - 1)) + + _bcalu_username=$1 + : ${_bcalu_homedir:="/home/${_bcalu_username}"} + : ${_bcalu_comment:="${_bcalu_username} user"} + + case $BOXCONF_OS in + freebsd) + if pw usershow "$_bcalu_username" > /dev/null 2>&1; then + log "local user ${_bcalu_username} already exists" + return 0 + fi + + pw useradd \ + -n "$_bcalu_username" \ + -c "$_bcalu_comment" \ + -s "$_bcalu_shell" \ + -M "$_bcalu_homedir_mode" \ + -d "$_bcalu_homedir" \ + ${_bcalu_create_homedir:+-m} \ + ${_bcalu_grouplist:+-G ${_bcalu_grouplist}} \ + ${_bcalu_pgroup:+-g ${_bcalu_pgroup}} \ + ${_bcalu_uid:+-u ${_bcalu_uid}} + + log "added local user ${_bcalu_username}" + ;; + *) + die "add_local_user unimplemented for ${BOXCONF_OS}" + ;; + esac +} diff --git a/scripts/hostclass/laptop b/scripts/hostclass/laptop index 83c7457..58dfa7f 100644 --- a/scripts/hostclass/laptop +++ b/scripts/hostclass/laptop @@ -9,7 +9,36 @@ install_file -m 0555 /usr/local/libexec/lid-close install_file -m 0644 /etc/devd/lid-close.conf service devd restart +case ${wireless_type:-} in + iwm*) + set_loader_conf \ + if_iwm_load=YES \ + "${wireless_type}fw_load=YES" + + load_kernel_module \ + if_iwm \ + "${wireless_type}fw" + + sysrc -v wlans_iwm0='wlan0' + ;; +esac + # Configure wireless card. sysrc -v \ create_args_wlan0='country US regdomain FCC' \ ifconfig_wlan0="WPA DHCP powersave" + +# On some graphics cards, kern.vt.suspendswitch=1 (the default) breaks graphics +# acceleration after resuming from sleep. +set_sysctl kern.vt.suspendswitch="${vt_suspendswitch:-1}" + +# Hardware-specific fixes. +case ${laptop_type:-} in + thinkpad) + # Set brightness using function keys. + set_sysctl dev.acpi_ibm.0.handlerevents='0x10 0x11' + install_file -m 0555 /usr/local/libexec/thinkpad-brightness + install_file -m 0644 /etc/devd/thinkpad-brightness.conf + service devd restart + ;; +esac diff --git a/scripts/hostname/rlaptop1 b/scripts/hostname/rlaptop1 index 874c9dd..b1c9865 100644 --- a/scripts/hostname/rlaptop1 +++ b/scripts/hostname/rlaptop1 @@ -1,21 +1,8 @@ #!/bin/sh -set_loader_conf \ - if_iwm_load=YES \ - iwm8265fw_load=YES - -sysrc -v wlans_iwm0='wlan0' - -# On this laptop, kern.vt.suspendswitch=1 (the default) breaks graphics -# acceleration after resuming from sleep. -set_sysctl \ - dev.acpi_ibm.0.handlerevents='0x10 0x11' \ - kern.vt.suspendswitch=0 - -install_file -m 0555 /usr/local/libexec/thinkpad-brightness -install_file -m 0644 /etc/devd/thinkpad-brightness.conf - -service devd restart - -pw usershow cullum || \ - pw useradd cullum -c "Cullum Smith" -d /home/cullum -G wheel,operator,video -s /bin/sh -m -M 700 +add_local_user \ + -c "Cullum Smith" \ + -G wheel,operator,video \ + -s /bin/sh \ + -m \ + cullum diff --git a/scripts/os/freebsd/10-rc-conf b/scripts/os/freebsd/10-rc-conf index a8a3d22..629c72b 100644 --- a/scripts/os/freebsd/10-rc-conf +++ b/scripts/os/freebsd/10-rc-conf @@ -5,3 +5,7 @@ sysrc -v \ dumpdev=NO \ ipv6_activate_all_interfaces=NO \ syslogd_flags=-ss + +if [ -n "${console_font:-}" ]; then + sysrc -v allscreens_flags="-f ${console_font}" +fi diff --git a/vars/hostname/rlaptop1 b/vars/hostname/rlaptop1 index 0eb1518..3e1b34c 100644 --- a/vars/hostname/rlaptop1 +++ b/vars/hostname/rlaptop1 @@ -1,3 +1,7 @@ #!/bin/sh desktop_type=i3 +wireless_type=iwm8265 +console_font=spleen-12x24 +laptop_type=thinkpad +vt_suspendswitch=0 |