From a7fe4235837f63fe398051a9b5dc595d5a450622 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sun, 28 Apr 2024 12:53:25 -0400 Subject: [PATCH] Update for FreeBSD on AMD Framework laptop. --- .../environments/laptop/host_vars/odolinux | 1 + ansible/environments/laptop/host_vars/odowork | 1 + ansible/roles/base/files/cleartmp_rc.conf | 1 + ansible/roles/base/files/odofreebsd_rc.conf | 7 ---- ansible/roles/base/tasks/freebsd.yaml | 10 +++++ ...der.conf => per_core_hwpstate_loader.conf} | 0 ansible/roles/cpu/tasks/freebsd_amd.yaml | 11 +++++ ansible/roles/cpu/tasks/freebsd_intel.yaml | 2 +- .../network/files/odofreebsd_network.conf | 2 +- .../waybar_scripts/waybar_sound_freebsd.bash | 36 ---------------- .../waybar_scripts/waybar_sound_freebsd.zsh | 41 +++++++++++++++++++ .../waybar_temperature_freebsd.bash | 6 +-- ansible/roles/waybar/tasks/freebsd.yaml | 3 +- ansible/roles/zfs/tasks/linux.yaml | 8 ++++ 14 files changed, 79 insertions(+), 50 deletions(-) create mode 100644 ansible/roles/base/files/cleartmp_rc.conf rename ansible/roles/cpu/files/{percorespeedshift_loader.conf => per_core_hwpstate_loader.conf} (100%) delete mode 100644 ansible/roles/waybar/files/waybar_scripts/waybar_sound_freebsd.bash create mode 100644 ansible/roles/waybar/files/waybar_scripts/waybar_sound_freebsd.zsh diff --git a/ansible/environments/laptop/host_vars/odolinux b/ansible/environments/laptop/host_vars/odolinux index 495f1dd..c3a5f1f 100644 --- a/ansible/environments/laptop/host_vars/odolinux +++ b/ansible/environments/laptop/host_vars/odolinux @@ -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 diff --git a/ansible/environments/laptop/host_vars/odowork b/ansible/environments/laptop/host_vars/odowork index f6dbeb4..b9700af 100644 --- a/ansible/environments/laptop/host_vars/odowork +++ b/ansible/environments/laptop/host_vars/odowork @@ -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 diff --git a/ansible/roles/base/files/cleartmp_rc.conf b/ansible/roles/base/files/cleartmp_rc.conf new file mode 100644 index 0000000..a5bcd83 --- /dev/null +++ b/ansible/roles/base/files/cleartmp_rc.conf @@ -0,0 +1 @@ +clear_tmp_enable="YES" \ No newline at end of file diff --git a/ansible/roles/base/files/odofreebsd_rc.conf b/ansible/roles/base/files/odofreebsd_rc.conf index 968bffd..79bc806 100644 --- a/ansible/roles/base/files/odofreebsd_rc.conf +++ b/ansible/roles/base/files/odofreebsd_rc.conf @@ -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" diff --git a/ansible/roles/base/tasks/freebsd.yaml b/ansible/roles/base/tasks/freebsd.yaml index f0ad089..246a740 100644 --- a/ansible/roles/base/tasks/freebsd.yaml +++ b/ansible/roles/base/tasks/freebsd.yaml @@ -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 diff --git a/ansible/roles/cpu/files/percorespeedshift_loader.conf b/ansible/roles/cpu/files/per_core_hwpstate_loader.conf similarity index 100% rename from ansible/roles/cpu/files/percorespeedshift_loader.conf rename to ansible/roles/cpu/files/per_core_hwpstate_loader.conf diff --git a/ansible/roles/cpu/tasks/freebsd_amd.yaml b/ansible/roles/cpu/tasks/freebsd_amd.yaml index e48a76e..6835962 100644 --- a/ansible/roles/cpu/tasks/freebsd_amd.yaml +++ b/ansible/roles/cpu/tasks/freebsd_amd.yaml @@ -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 diff --git a/ansible/roles/cpu/tasks/freebsd_intel.yaml b/ansible/roles/cpu/tasks/freebsd_intel.yaml index 6ba3a69..1216891 100644 --- a/ansible/roles/cpu/tasks/freebsd_intel.yaml +++ b/ansible/roles/cpu/tasks/freebsd_intel.yaml @@ -78,4 +78,4 @@ owner: root group: wheel loop: - - percorespeedshift + - per_core_hwpstate diff --git a/ansible/roles/network/files/odofreebsd_network.conf b/ansible/roles/network/files/odofreebsd_network.conf index bc9cca2..c3937c0 100644 --- a/ansible/roles/network/files/odofreebsd_network.conf +++ b/ansible/roles/network/files/odofreebsd_network.conf @@ -1,3 +1,3 @@ -wlans_ath0="wlan0" +wlans_iwlwifi0="wlan0" ifconfig_wlan0="WPA DHCP" ifconfig_wlan0_ipv6="inet6 accept_rtadv" diff --git a/ansible/roles/waybar/files/waybar_scripts/waybar_sound_freebsd.bash b/ansible/roles/waybar/files/waybar_scripts/waybar_sound_freebsd.bash deleted file mode 100644 index b9cef40..0000000 --- a/ansible/roles/waybar/files/waybar_scripts/waybar_sound_freebsd.bash +++ /dev/null @@ -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="$(mixer)" - class="" - icon="" - - if [ $avg_vol -eq 0 ]; then - icon="🔇" - elif [ $avg_vol -le 50 ]; then - icon="🔉" - else - icon="🔊" - fi - - jq --unbuffered --compact-output <