Update for FreeBSD on AMD Framework laptop.

This commit is contained in:
Tom Alexander 2024-04-28 12:53:25 -04:00
parent 32eca75f4e
commit a7fe423583
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
14 changed files with 79 additions and 50 deletions

View File

@ -16,6 +16,7 @@ users:
- backup_fido
- homeassistant
gitconfig: "gitconfig_home"
periodic_scrub_pools: [zroot]
zfs_snapshot_datasets:
# - zroot/linux/archmain/home
- path: zroot/linux/archmain/be

View File

@ -17,6 +17,7 @@ users:
- main_fido
- backup_fido
gitconfig: "gitconfig_work"
periodic_scrub_pools: [zroot]
zfs_snapshot_datasets:
- path: zroot/linux/archwork/be
install_graphics: true

View File

@ -0,0 +1 @@
clear_tmp_enable="YES"

View File

@ -1,13 +1,6 @@
clear_tmp_enable="YES"
syslogd_flags="-ss"
sendmail_enable="NONE"
hostname="odo"
wlans_iwlwifi0="wlan0"
ifconfig_wlan0="WPA DHCP"
ifconfig_wlan0_ipv6="inet6 accept_rtadv"
sshd_enable="YES"
ntpd_enable="YES"
powerd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
zfs_enable="YES"

View File

@ -7,6 +7,16 @@
- rust-coreutils
state: present
- name: Install service configuration
copy:
src: "files/{{ item }}_rc.conf"
dest: "/etc/rc.conf.d/{{ item }}"
mode: 0644
owner: root
group: wheel
loop:
- cleartmp
- name: Install login.conf
copy:
src: login.conf

View File

@ -27,3 +27,14 @@
group: wheel
loop:
- aesni
- name: Install loader.conf
when: hwpstate is defined and hwpstate
copy:
src: "files/{{ item }}_loader.conf"
dest: "/boot/loader.conf.d/{{ item }}.conf"
mode: 0644
owner: root
group: wheel
loop:
- per_core_hwpstate

View File

@ -78,4 +78,4 @@
owner: root
group: wheel
loop:
- percorespeedshift
- per_core_hwpstate

View File

@ -1,3 +1,3 @@
wlans_ath0="wlan0"
wlans_iwlwifi0="wlan0"
ifconfig_wlan0="WPA DHCP"
ifconfig_wlan0_ipv6="inet6 accept_rtadv"

View File

@ -1,36 +0,0 @@
#!/usr/bin/env bash
#
# Read volume status in FreeBSD
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
while true; do
current_vol_mixer=$(mixer -S vol)
vol_left=$(cut -d ':' -f 2 <<<"$current_vol_mixer")
vol_right=$(cut -d ':' -f 3 <<<"$current_vol_mixer")
avg_vol=$(((vol_left + vol_right) / 2))
tooltip="<tt>$(mixer)</tt>"
class=""
icon=""
if [ $avg_vol -eq 0 ]; then
icon="🔇"
elif [ $avg_vol -le 50 ]; then
icon="🔉"
else
icon="🔊"
fi
jq --unbuffered --compact-output <<EOF
{
"text":"${avg_vol}% ${icon}",
"tooltip":"${tooltip//$'\n'/\\n}",
"percentage":${avg_vol},
"class":"${class}"
}
EOF
sleep $SLEEP_INTERVAL
done

View File

@ -0,0 +1,41 @@
#!/usr/bin/env zsh
#
# Read volume status in FreeBSD
set -euo pipefail
IFS=$'\n\t'
SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
while true; do
(
# current_vol_mixer=$(mixer -S vol)
# vol_left=$(cut -d ':' -f 2 <<<"$current_vol_mixer")
# vol_right=$(cut -d ':' -f 3 <<<"$current_vol_mixer")
current_vol_mixer=$(mixer -o)
vol_left=$(grep -E 'vol.volume=' <<<"$current_vol_mixer" | cut -d = -f 2 | cut -d ':' -f 1)
vol_right=$(grep -E 'vol.volume=' <<<"$current_vol_mixer" | cut -d = -f 2 | cut -d ':' -f 2)
avg_vol=$((100 * (vol_left + vol_right) / 2))
avg_vol=$(echo "$avg_vol" | cut -d '.' -f 1)
tooltip="<tt>$(mixer)</tt>"
class=""
icon=""
if [ $avg_vol -eq 0 ]; then
icon="🔇"
elif [ $avg_vol -le 50 ]; then
icon="🔉"
else
icon="🔊"
fi
jq --unbuffered --compact-output <<EOF
{
"text":"${avg_vol}% ${icon}",
"tooltip":"${tooltip//$'\n'/\\n}",
"percentage":${avg_vol},
"class":"${class}"
}
EOF
sleep $SLEEP_INTERVAL
)
done

View File

@ -5,13 +5,11 @@ set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# TODO: Maybe I should be reading hw.acpi.thermal.tz0.temperature
# TODO: I could get the number of cores with kern.smp.cpus
SLEEP_INTERVAL=${SLEEP_INTERVAL:-30}
while true; do
current_cpu_temps=$(sysctl 'dev.cpu' | grep -E 'dev\.cpu\.[0-9]+\.temperature' | sort)
current_cpu_temps=$(sysctl 'hw.acpi.thermal' | grep -E 'hw\.acpi\.thermal\.tz[0-9]+\.temperature' | sort)
#current_cpu_temps=$(sysctl 'dev.cpu' | grep -E 'dev\.cpu\.[0-9]+\.temperature' | sort)
sum_temperature=0
num_temperature=0
max_temperature=0

View File

@ -2,6 +2,7 @@
package:
name:
- waybar
- python
state: present
- name: Install scripts
@ -16,7 +17,7 @@
dest: /usr/local/bin/waybar_custom_battery
- src: waybar_available_memory_freebsd.bash
dest: /usr/local/bin/waybar_custom_available_memory
- src: waybar_sound_freebsd.bash
- src: waybar_sound_freebsd.zsh
dest: /usr/local/bin/waybar_custom_sound
- src: waybar_temperature_freebsd.bash
dest: /usr/local/bin/waybar_custom_temperature

View File

@ -53,3 +53,11 @@
- zfs-mount.service
- zfs.target
- zfs-import.target
- name: Enable periodic scrub
when: periodic_scrub_pools is defined
systemd:
enabled: yes
name: "zfs-scrub-weekly@{{ item }}.timer"
daemon_reload: yes
loop: "{{ periodic_scrub_pools }}"