# Bazzite Post-Upgrade Automation

## Problem

Bazzite is an immutable OS (Fedora Atomic/ublue-os based). After every major `ujust update` or `rpm-ostree upgrade`, `/usr/` is replaced with a new image, wiping:

- Packages installed via `dnf install` (not layered)
- `ujust` command results
- Decky plugins that got wiped from `/usr/`

## What survives upgrades

| Path | Survives? | Examples |
|---|---|---|
| `/etc/` | Yes | oberon-config.yaml, modules-load.d, udev rules, systemd enablements |
| `/home/` | Yes | Scripts, flatpaks, Decky loader plugins, fgmod |
| `/var/` | Yes | Toolbox containers, rpm-ostree deployments |
| `/usr/` | No (replaced) | dnf-installed packages |
| rpm-ostree layers | Yes | `coolercontrol`, `liquidctl`, `solaar` |
| rpm-ostree kargs | Yes | `mitigations=off`, `bluetooth.disable_ertm=1` |

## Solution

`setup-bazzite` (deployed to `~/post-upgrade.sh` on the Bazzite server at `192.168.1.40`) is an idempotent script that handles everything. Run after each major upgrade:

```
ssh -t bazzite@192.168.1.40 sudo ~/post-upgrade.sh
```

The `-t` flag is required for sudo password prompts.

### What the script does

1. **Layers packages** with `rpm-ostree install` (survives upgrades): coolercontrol, liquidctl, solaar, mangohud, lm_sensors
2. **Sets kernel args** (survives upgrades): mitigations=off, bluetooth.disable_ertm=1
3. **Kernel modules**: nct6687 sensor chip via `/etc/modules-load.d/`
4. **Oberon GPU governor**: Installs and enables oberon-governor.service
5. **Services**: Enables coolercontrold, sshd
6. **Firewall**: Opens SSH port
7. **ujust tweaks**: enable-ryzenadj-max-performance, get-decky-bazzite-buddy
8. **SimpleDeckyTDP**: Decky plugin for TDP control
9. **SSH key**: Authorized key from cachyos-otter

## Files

| File | Location |
|---|---|
| `setup-bazzite` | Repo root, backup copy |
| `~/post-upgrade.sh` | Live script on Bazzite server (192.168.1.40) |
| `/etc/oberon-config.yaml` | GPU governor config (persists) |
| `/etc/modules-load.d/nct6687.conf` | Sensor module config (persists) |
| `/etc/udev/rules.d/99-ryzenadj-power-source-change.rules` | Power source udev rule (persists) |
