mirror of
https://github.com/fscotto/infra.git
synced 2026-11-26 21:59:50 +00:00
Compare commits
57 Commits
e29b3ed8b4
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1a9ecffecf | ||
| 012cb3534b | |||
| 47acda71b6 | |||
|
|
e74088e85b | ||
|
|
e2370ec91d | ||
|
|
59160abf0d | ||
| cdc102a970 | |||
| 66925b1d0d | |||
| 3facf61866 | |||
| 0b30890464 | |||
| ffa9960c64 | |||
| 7b85314cca | |||
| 95630f74d3 | |||
|
|
a2dca0e0d1 | ||
|
|
269f08a332 | ||
| 3f3781437b | |||
| 52c3615d26 | |||
| 4df3067c38 | |||
|
|
94eb555ff3 | ||
|
|
25a3b97b14 | ||
|
|
e8db4e5f38 | ||
|
|
2cadbf25eb | ||
|
|
d26dddd822 | ||
| 0bd0a4589b | |||
| bc01cd3863 | |||
| 9bc8e9bf72 | |||
| 4041af0799 | |||
|
|
4bd3c21295 | ||
| f09a708fe9 | |||
| ccb4a0daa6 | |||
| 695fdf4711 | |||
| 08728f45a1 | |||
| da13299a8a | |||
| da5742e1e1 | |||
| 5e62a02feb | |||
| ada83e97d3 | |||
| 667f55b87b | |||
| 69196460c9 | |||
| e4e99d2a2f | |||
| 775840d3ef | |||
| bde34e19f4 | |||
| 849e522287 | |||
| 1e40a867e7 | |||
| 4e8665a7d4 | |||
| 146c93c6c6 | |||
| 57c34a6de0 | |||
| 7928ff3825 | |||
| 90fe7a1671 | |||
| f6ef70a43f | |||
| 5d5339637d | |||
| 92a05e1f36 | |||
| 740a3571a6 | |||
| 6f6dabd532 | |||
| e48b0dce3d | |||
|
|
8b13e63a35 | ||
|
|
272667a20d | ||
| 393b633103 |
48
AGENTS.md
48
AGENTS.md
@@ -6,9 +6,10 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
|||||||
- Main orchestration: `ansible/site.yml`
|
- Main orchestration: `ansible/site.yml`
|
||||||
- Inventory and layering inputs: `ansible/inventory/hosts.yml`, `ansible/inventory/group_vars/*.yml`, `ansible/inventory/host_vars/*.yml`
|
- Inventory and layering inputs: `ansible/inventory/hosts.yml`, `ansible/inventory/group_vars/*.yml`, `ansible/inventory/host_vars/*.yml`
|
||||||
- Dotfiles live under `dotfiles/`
|
- Dotfiles live under `dotfiles/`
|
||||||
- AI agent instructions (bootstrap, rules, knowledge) are centralized in `dotfiles/common/.config/ai/` and shared between OpenCode, Codex, and Gemini CLI.
|
- AI agent instructions (bootstrap, dispatcher, knowledge, rules, patterns) are centralized in `dotfiles/common/.config/ai/` and shared between OpenCode, Codex, Gemini CLI, and Cline.
|
||||||
- OpenCode loads its entrypoint configuration from `dotfiles/common/.config/opencode/opencode.json`.
|
- OpenCode loads its entrypoint configuration from `dotfiles/common/.config/opencode/opencode.json`; Codex global instructions deploy from `dotfiles/common/.codex/AGENTS.md`; Cline deploys both the cross-tool `dotfiles/common/.agents/AGENTS.md` pointer (to `~/.agents/AGENTS.md`) and the always-on global rule `dotfiles/common/.cline/rules/ai-context.md` (to `~/.cline/rules/`), which auto-binds the deployed `bootstrap.md`, dispatcher, safety directives, and distilled ChatGPT knowledge.
|
||||||
- Codex config is rendered from `dotfiles/common/.codex/config.toml.j2` so `model_instructions_file` points to the deployed `~/.config/ai/bootstrap.md`.
|
- Codex config is rendered from `dotfiles/common/.codex/config.toml.j2` so `model_instructions_file` points to the deployed `~/.config/ai/bootstrap.md`.
|
||||||
|
- ChatGPT conversation memory is stored in `dotfiles/common/.config/ai/memory/chatgpt/` and regenerated incrementally by `scripts/chatgpt_export_to_memory.py` from an official ChatGPT data export.
|
||||||
|
|
||||||
## Topology
|
## Topology
|
||||||
- Current personal desktop: `ikaros = platform_fedora + role_personal_workstation + graphical_desktop + desktop_gnome`
|
- Current personal desktop: `ikaros = platform_fedora + role_personal_workstation + graphical_desktop + desktop_gnome`
|
||||||
@@ -28,9 +29,10 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
|||||||
- Keep completed one-time cleanup operations out of the playbook. Execute them directly
|
- Keep completed one-time cleanup operations out of the playbook. Execute them directly
|
||||||
with explicit authorization; retain only the ongoing desired-state configuration and
|
with explicit authorization; retain only the ongoing desired-state configuration and
|
||||||
historical documentation, not permanent cleanup flags or tasks.
|
historical documentation, not permanent cleanup flags or tasks.
|
||||||
- Use Git Flow branch prefixes: `feature/` for new functionality, `bugfix/` for non-urgent fixes,
|
- Use trunk-based development: `main` is the single long-lived branch. Land small,
|
||||||
`hotfix/` for urgent production fixes, `release/` for release preparation, and `support/` for
|
validated changes quickly, either as direct commits or via short-lived branches merged
|
||||||
maintained release lines. Do not use abbreviated prefixes such as `feat/`.
|
as soon as validation passes. Do not maintain `release/`, `support/`, or other
|
||||||
|
long-lived branch lines: tag releases from the trunk and fix production issues on it.
|
||||||
- Desktop and WSL hosts use `ansible_connection: local`; remote infrastructure hosts use SSH.
|
- Desktop and WSL hosts use `ansible_connection: local`; remote infrastructure hosts use SSH.
|
||||||
- Treat `secrets/` as sensitive. Never print secret values.
|
- Treat `secrets/` as sensitive. Never print secret values.
|
||||||
- Tmux plugins are bootstrapped by TPM on the host; the repo only keeps tmux config and custom helper scripts.
|
- Tmux plugins are bootstrapped by TPM on the host; the repo only keeps tmux config and custom helper scripts.
|
||||||
@@ -56,7 +58,9 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
|||||||
- Focused checks:
|
- Focused checks:
|
||||||
- Emacs is disabled by default; temporary Emacs check: `ansible-playbook ansible/site.yml --limit <host> --tags emacs --check --diff -e emacs_enabled=true`
|
- Emacs is disabled by default; temporary Emacs check: `ansible-playbook ansible/site.yml --limit <host> --tags emacs --check --diff -e emacs_enabled=true`
|
||||||
- AI coding agents: `ansible-playbook ansible/site.yml --limit <host> --tags ai_agents --check --diff`
|
- AI coding agents: `ansible-playbook ansible/site.yml --limit <host> --tags ai_agents --check --diff`
|
||||||
|
- AI desktop apps lifecycle: `ansible-playbook ansible/site.yml --limit ikaros --tags chatgpt,opencode_desktop,cline_desktop --check --diff`
|
||||||
- Mail bootstrap: `sh -n scripts/bootstrap_mail.sh` and `shellcheck scripts/bootstrap_mail.sh`
|
- Mail bootstrap: `sh -n scripts/bootstrap_mail.sh` and `shellcheck scripts/bootstrap_mail.sh`
|
||||||
|
- Thunderbird iCloud profile: `ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird --check --diff`
|
||||||
- Server NPM Quadlet: `systemctl status prometheus-npm.service`; the Compose fallback is retired.
|
- Server NPM Quadlet: `systemctl status prometheus-npm.service`; the Compose fallback is retired.
|
||||||
- Explicit Prometheus legacy cleanup (destructive only without check mode):
|
- Explicit Prometheus legacy cleanup (destructive only without check mode):
|
||||||
`ansible-playbook ansible/site.yml --limit prometheus --tags server_legacy_cleanup --check --diff -e server_legacy_cleanup=true`
|
`ansible-playbook ansible/site.yml --limit prometheus --tags server_legacy_cleanup --check --diff -e server_legacy_cleanup=true`
|
||||||
@@ -101,6 +105,8 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
|||||||
- Prefer declarative modules over `command`/`shell`; when `shell` is required, make idempotency and failure behavior explicit.
|
- Prefer declarative modules over `command`/`shell`; when `shell` is required, make idempotency and failure behavior explicit.
|
||||||
- Start YAML files with `---`, use 2-space indentation, and keep file modes quoted like `"0644"`.
|
- Start YAML files with `---`, use 2-space indentation, and keep file modes quoted like `"0644"`.
|
||||||
- Keep booleans as booleans and structured vars as YAML lists/maps.
|
- Keep booleans as booleans and structured vars as YAML lists/maps.
|
||||||
|
- Group similar tasks into list variables (typically in `group_vars`) and apply them
|
||||||
|
with a single task looping over the list, rather than one near-identical task per item.
|
||||||
- Put host-specific overrides in `host_vars`, not shared `group_vars`.
|
- Put host-specific overrides in `host_vars`, not shared `group_vars`.
|
||||||
- Use `no_log: true` for secret-bearing task inputs or outputs.
|
- Use `no_log: true` for secret-bearing task inputs or outputs.
|
||||||
|
|
||||||
@@ -116,6 +122,7 @@ Ansible-driven personal infrastructure repo for Fedora and Void desktops, Fedora
|
|||||||
- `dotfiles/desktop/.config/niri/config.kdl` and `session-env` deployed via `desktop_niri_dotfiles` (Niri / Wayland)
|
- `dotfiles/desktop/.config/niri/config.kdl` and `session-env` deployed via `desktop_niri_dotfiles` (Niri / Wayland)
|
||||||
- Void Niri lives in `profile_desktop_niri`, gated on `'niri' in desktop_sessions_enabled`; it installs the `emptty` `niri.desktop` session, the `/usr/local/bin/start-niri` launcher, and the xdg-desktop-portal config, mirroring `profile_desktop_sway`.
|
- Void Niri lives in `profile_desktop_niri`, gated on `'niri' in desktop_sessions_enabled`; it installs the `emptty` `niri.desktop` session, the `/usr/local/bin/start-niri` launcher, and the xdg-desktop-portal config, mirroring `profile_desktop_sway`.
|
||||||
- Fedora GNOME (`desktop_gnome`) assumes GNOME comes from the Fedora Workstation base install; Ansible deploys shared desktop dotfiles and git/GPG config for `ikaros` and `nymph`, not GNOME settings.
|
- Fedora GNOME (`desktop_gnome`) assumes GNOME comes from the Fedora Workstation base install; Ansible deploys shared desktop dotfiles and git/GPG config for `ikaros` and `nymph`, not GNOME settings.
|
||||||
|
- `profile_desktop_gnome` first discovers configured Thunderbird accounts in both `~/.thunderbird` and `~/.config/thunderbird` and selects an existing profile without changing its account settings. Only if no account exists does it seed a new iCloud IMAP/SMTP profile with CalDAV and CardDAV through a non-overwriting `user.js`. Registry changes preserve other profiles and create backups; Thunderbird must be closed. The bootstrap address comes from `vault_icloud_email` and the app-specific password is never stored by Ansible.
|
||||||
- Do not switch or restart the display manager during a playbook run from an active graphical session.
|
- Do not switch or restart the display manager during a playbook run from an active graphical session.
|
||||||
- `nymph` is the Fedora/GNOME laptop target; keep GNOME settings unmanaged for now and add host-specific tuning only after real use.
|
- `nymph` is the Fedora/GNOME laptop target; keep GNOME settings unmanaged for now and add host-specific tuning only after real use.
|
||||||
|
|
||||||
@@ -134,7 +141,6 @@ The dotfile vars follow the same split: `desktop_common_dotfiles` carries mode-i
|
|||||||
## Workstation Notes
|
## Workstation Notes
|
||||||
- `deadalus` is modeled as Windows + Fedora WSL and is the sole workstation target.
|
- `deadalus` is modeled as Windows + Fedora WSL and is the sole workstation target.
|
||||||
- Fedora WSL belongs to `platform_fedora`, `workstation_dev_fedora`, and the shared WSL layer. It must not receive Flatpak or Snap runtimes.
|
- Fedora WSL belongs to `platform_fedora`, `workstation_dev_fedora`, and the shared WSL layer. It must not receive Flatpak or Snap runtimes.
|
||||||
- Fedora WSL installs Mise from the official `jdxcode/mise` COPR and uses its pinned Temurin Java 11 JDK; update the declared Mise version deliberately.
|
|
||||||
- Windows applications are installed manually and are not managed from the WSL profile.
|
- Windows applications are installed manually and are not managed from the WSL profile.
|
||||||
|
|
||||||
## Rocky Server Notes
|
## Rocky Server Notes
|
||||||
@@ -224,6 +230,19 @@ The dotfile vars follow the same split: `desktop_common_dotfiles` carries mode-i
|
|||||||
injecting the private token for JSON-RPC POST clients; keep this route
|
injecting the private token for JSON-RPC POST clients; keep this route
|
||||||
authenticated and never expose the gateway directly. See `docs/atlas-aria2.md`.
|
authenticated and never expose the gateway directly. See `docs/atlas-aria2.md`.
|
||||||
|
|
||||||
|
- Atlas Nextcloud backup preparation (`atlas-nextcloud-backup.service`) is an ordered
|
||||||
|
requirement of the nightly `atlas-borg-backup.service` and the operator-started
|
||||||
|
`atlas-usb-backup.service`. A structurally complete bundle younger than
|
||||||
|
`atlas_nextcloud_backup_reuse_max_seconds` (20 h, asserted below 24 h so the nightly
|
||||||
|
Borg cycle always refreshes it) is reused without pausing the applications: a manual
|
||||||
|
USB run therefore reaches its LUKS prompt within seconds, while preparation failure
|
||||||
|
still blocks the dependent job. Force one fresh preparation with
|
||||||
|
`systemctl set-environment ATLAS_NEXTCLOUD_BACKUP_FORCE=1` before the start and unset
|
||||||
|
the variable afterwards. Deployed and validated on 2026-11-15: a dependency start reused
|
||||||
|
a verified bundle 14 h old and skipped preparation in 14 ms, and an operator-started
|
||||||
|
USB run reached its LUKS prompt in under a second; the FORCE path has not been exercised
|
||||||
|
in production yet. See `docs/atlas-nextcloud.md`.
|
||||||
|
|
||||||
## Atlas NAS TODO
|
## Atlas NAS TODO
|
||||||
Completed validation: the existing RAIDZ2 pool and datasets, SELinux, LAN firewall, SSH, Cockpit with
|
Completed validation: the existing RAIDZ2 pool and datasets, SELinux, LAN firewall, SSH, Cockpit with
|
||||||
the selected 45Drives plugins, encrypted SMB3 `Archive`, the Aegis-only NFSv4 `photobook` export, and the
|
the selected 45Drives plugins, encrypted SMB3 `Archive`, the Aegis-only NFSv4 `photobook` export, and the
|
||||||
@@ -545,9 +564,13 @@ validated exports of older historical data will use a dedicated Atlas NFS datase
|
|||||||
- Shared agent dotfiles live in `ai_agents_dotfiles`; rendered configs live in `ai_agents_templates`.
|
- Shared agent dotfiles live in `ai_agents_dotfiles`; rendered configs live in `ai_agents_templates`.
|
||||||
- Every `ai_agents.<agent>` entry has independent `install_enabled`, `deploy_enabled`, and `uninstall_enabled` flags. Installation and removal must not both be true for the same agent; the common pre-task fails before changes when they conflict.
|
- Every `ai_agents.<agent>` entry has independent `install_enabled`, `deploy_enabled`, and `uninstall_enabled` flags. Installation and removal must not both be true for the same agent; the common pre-task fails before changes when they conflict.
|
||||||
- Fedora, Void desktop, and WSL workstation profiles consume the shared agent definitions; do not duplicate package entries in profile-specific vars. IBM Bob on the workstation follows its own flags.
|
- Fedora, Void desktop, and WSL workstation profiles consume the shared agent definitions; do not duplicate package entries in profile-specific vars. IBM Bob on the workstation follows its own flags.
|
||||||
|
- WSL (`deadalus`) installs Claude Code, Codex and the Cline CLI; every other managed agent (including IBM Bob) is disabled and selected for removal through host overrides. `cline_deploy_enabled: true` also keeps Cline's cross-tool AGENTS pointer, global rules, and shared `~/.config/ai` context deployed on the host for the ecaas/cdp devcontainer bind mounts. Existing user state remains untouched.
|
||||||
- `dotfiles_common` deploys `ai_agents_dotfiles` and renders `ai_agents_templates` only when deployment is enabled.
|
- `dotfiles_common` deploys `ai_agents_dotfiles` and renders `ai_agents_templates` only when deployment is enabled.
|
||||||
- Removal is limited to the managed npm packages and `/usr/local/bin/bob`; never remove agent dotfiles, instructions, credentials, or user data.
|
- Removal is limited to the managed npm packages and `/usr/local/bin/bob`; never remove agent dotfiles, instructions, credentials, or user data.
|
||||||
- Keep `.config/ai/` as the common instruction source; update agent-specific entrypoints to reference it rather than duplicating instruction text.
|
- Keep `.config/ai/` as the common instruction source; update agent-specific entrypoints to reference it rather than duplicating instruction text.
|
||||||
|
- Fedora desktop AI apps (`chatgpt_desktop`, `opencode_desktop`, `cline_desktop`) follow the same lifecycle pattern through `ai_desktop_apps` in `ansible/inventory/group_vars/fedora.yml`; `install_enabled` and `uninstall_enabled` are independent per app and mutually exclusive (enforced by the common pre-task).
|
||||||
|
- ChatGPT opts in per host (`ikaros`, `nymph`); Cline opts in through `desktop_gnome` group vars; OpenCode Desktop keeps removal selected by default because Cline replaced it.
|
||||||
|
- Desktop-app removal deletes only managed artifacts: the RPM package (`chatgpt`, `opencode`, `cline`), ChatGPT's managed repository and signing key, and every cached download; it never removes user data, GNOME favorites, or the npm-managed CLI counterparts.
|
||||||
|
|
||||||
## Tooling Notes
|
## Tooling Notes
|
||||||
- Install local tooling with:
|
- Install local tooling with:
|
||||||
@@ -581,3 +604,16 @@ validated exports of older historical data will use a dedicated Atlas NFS datase
|
|||||||
not depend on the AdGuard container during startup.
|
not depend on the AdGuard container during startup.
|
||||||
- Aegis iCloudPD has been retired and is no longer managed by this role. Its service, Quadlet,
|
- Aegis iCloudPD has been retired and is no longer managed by this role. Its service, Quadlet,
|
||||||
data, and MFA state were removed with the operator's explicit authorization.
|
data, and MFA state were removed with the operator's explicit authorization.
|
||||||
|
|
||||||
|
## Project Devcontainer Generator
|
||||||
|
- `cmd/devcontainer/` generates standalone per-project language configurations;
|
||||||
|
it does not replace existing deadalus ecaas/cdp provisioning or remove host tools.
|
||||||
|
- Keep shared Git/agent behavior documented in `docs/project-devcontainers.md`.
|
||||||
|
- Focused validation: `go -C cmd/devcontainer test ./...`.
|
||||||
|
- Real engine builds, host credential forwarding and Fedora SELinux/Podman checks
|
||||||
|
require target-host validation; do not report generator tests as runtime evidence.
|
||||||
|
|
||||||
|
- `devcontainer_generator` builds the CLI natively on Fedora graphical desktops
|
||||||
|
and development workstations and installs it in `~/.local/bin/devcontainer`.
|
||||||
|
Validate with `ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator --check --diff`;
|
||||||
|
check mode skips compilation and binary installation explicitly.
|
||||||
|
|||||||
@@ -164,7 +164,6 @@ Lo stato attuale del profilo workstation include:
|
|||||||
|
|
||||||
- installazione pacchetti base Fedora via dnf
|
- installazione pacchetti base Fedora via dnf
|
||||||
- installazione e configurazione di Docker dal repository ufficiale
|
- installazione e configurazione di Docker dal repository ufficiale
|
||||||
- installazione di Mise dal COPR ufficiale con JDK Eclipse Temurin Java 11 fissato
|
|
||||||
- gestione dei dotfiles workstation e rendering dei template dev condivisi
|
- gestione dei dotfiles workstation e rendering dei template dev condivisi
|
||||||
- preparazione di Fedora WSL con `systemd` per il toolchain di sviluppo
|
- preparazione di Fedora WSL con `systemd` per il toolchain di sviluppo
|
||||||
- attivazione del firewall `firewalld` sui target Fedora che dichiarano regole host-specifiche
|
- attivazione del firewall `firewalld` sui target Fedora che dichiarano regole host-specifiche
|
||||||
@@ -754,7 +753,7 @@ Allo stato attuale `ansible/site.yml` espone questi tag:
|
|||||||
| Tag | Scopo | Ambito principale |
|
| Tag | Scopo | Ambito principale |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
| `always` | pre-task sempre eseguiti, inclusi caricamento vault e validazioni preliminari | common |
|
| `always` | pre-task sempre eseguiti, inclusi caricamento vault e validazioni preliminari | common |
|
||||||
| `ai_agents` | installazione agenti AI condivisi | Fedora, WSL |
|
| `ai_agents` | installazione agenti AI condivisi e distribuzione del contesto condiviso (bootstrap, regole, memoria ChatGPT) | Fedora, WSL |
|
||||||
| `atlas` | account, storage, condivisioni e container Atlas | NAS Atlas |
|
| `atlas` | account, storage, condivisioni e container Atlas | NAS Atlas |
|
||||||
| `backend_phase1` | Quadlet rootless Navidrome e Syncthing | NAS Atlas |
|
| `backend_phase1` | Quadlet rootless Navidrome e Syncthing | NAS Atlas |
|
||||||
| `containers` | Quadlet rootful Atlas | NAS Atlas |
|
| `containers` | Quadlet rootful Atlas | NAS Atlas |
|
||||||
|
|||||||
146
README.md
146
README.md
@@ -63,9 +63,11 @@ nymph is allowed to break
|
|||||||
|
|
||||||
`ikaros` is the stable personal Fedora/GNOME desktop. `nymph` is the laptop and gets the same shared desktop dotfiles while GNOME itself stays close to the Fedora defaults. The legacy `void` and `desktop` groups are compatibility parents; the main axes are `platform_*`, `role_*`, and `desktop_*`.
|
`ikaros` is the stable personal Fedora/GNOME desktop. `nymph` is the laptop and gets the same shared desktop dotfiles while GNOME itself stays close to the Fedora defaults. The legacy `void` and `desktop` groups are compatibility parents; the main axes are `platform_*`, `role_*`, and `desktop_*`.
|
||||||
|
|
||||||
The official ChatGPT desktop RPM is enabled only on `ikaros` and `nymph`. The
|
The official ChatGPT desktop RPM is installed only on `ikaros` and `nymph`
|
||||||
playbook configures OpenAI's signed RPM repository and imports its pinned RPM
|
through their `chatgpt_desktop_install_enabled` host overrides. The playbook
|
||||||
signing key before installation; subsequent updates are handled by DNF.
|
configures OpenAI's signed RPM repository and imports its pinned RPM signing
|
||||||
|
key before installation; subsequent updates are handled by DNF. Enabling
|
||||||
|
`chatgpt_desktop_uninstall_enabled` removes the package, repository, and key.
|
||||||
|
|
||||||
## Deferred planned node: Cerberus
|
## Deferred planned node: Cerberus
|
||||||
|
|
||||||
@@ -114,7 +116,7 @@ The workstation receives two layers:
|
|||||||
- Fedora development setup through `workstation_dev_fedora`.
|
- Fedora development setup through `workstation_dev_fedora`.
|
||||||
- WSL setup with `systemd` through `workstation_dev_wsl`.
|
- WSL setup with `systemd` through `workstation_dev_wsl`.
|
||||||
|
|
||||||
That gives it Fedora packages through DNF, Docker from the official repository, Mise from its official COPR repository with a pinned Eclipse Temurin Java 11 JDK, shared workstation dotfiles and templates, tmux helpers, and WSL systemd configuration. Windows applications are installed manually; the WSL profile does not manage Python remoting components for them.
|
That gives it Fedora packages through DNF, Docker from the official repository, shared workstation dotfiles and templates, tmux helpers, and WSL systemd configuration. Windows applications are installed manually; the WSL profile does not manage Python remoting components for them.
|
||||||
|
|
||||||
### WSL workflow
|
### WSL workflow
|
||||||
|
|
||||||
@@ -575,8 +577,8 @@ ansible-playbook ansible/site.yml --limit <host> --tags emacs -e emacs_enabled=t
|
|||||||
## AI coding agents
|
## AI coding agents
|
||||||
|
|
||||||
The shared npm-managed agents are OpenCode, Claude Code, Codex, Gemini CLI, and
|
The shared npm-managed agents are OpenCode, Claude Code, Codex, Gemini CLI, and
|
||||||
GitHub Copilot; IBM Bob is also managed on `deadalus`. Codex Relay is installed
|
GitHub Copilot; IBM Bob is also managed on Fedora workstations. Codex Relay is installed
|
||||||
only on `ikaros`. Each agent has its own lifecycle flags in
|
only on `ikaros`. On WSL (`deadalus`), Claude Code is the only installed coding agent. Each agent has its own lifecycle flags in
|
||||||
`ansible/inventory/group_vars/all.yml`, so one agent can be installed,
|
`ansible/inventory/group_vars/all.yml`, so one agent can be installed,
|
||||||
configured, or removed without affecting the others:
|
configured, or removed without affecting the others:
|
||||||
|
|
||||||
@@ -596,6 +598,48 @@ instructions, credentials, and user data. Installation and removal are mutually
|
|||||||
exclusive per agent: the playbook fails before making changes when both flags are
|
exclusive per agent: the playbook fails before making changes when both flags are
|
||||||
true for the same agent. Servers set `ai_agents: {}` and therefore manage none.
|
true for the same agent. Servers set `ai_agents: {}` and therefore manage none.
|
||||||
|
|
||||||
|
On WSL (`deadalus`), Claude Code, Codex and the Cline CLI are installed through
|
||||||
|
`profile_workstation_dev_common`. Every other managed coding agent is disabled through
|
||||||
|
host overrides and its managed npm package or `bob` binary is selected for removal.
|
||||||
|
`cline_deploy_enabled: true` also keeps Cline's cross-tool AGENTS pointer, global rules,
|
||||||
|
and shared `~/.config/ai` context deployed on the WSL host for the ecaas/cdp devcontainers.
|
||||||
|
Existing configuration, credentials, and user data are left untouched.
|
||||||
|
|
||||||
|
The shared agent context is centralized in `dotfiles/common/.config/ai/` and
|
||||||
|
deployed to `~/.config/ai/` for every enabled agent: `bootstrap.md` (operating
|
||||||
|
context), `AGENTS.md` (task-specific file dispatcher), plus `knowledge/`,
|
||||||
|
`rules/`, and `patterns/`. Each agent is wired to it: OpenCode through the
|
||||||
|
`instructions` array in `opencode.json`, Codex through `model_instructions_file`
|
||||||
|
plus the global `~/.codex/AGENTS.md`, Gemini CLI through its settings context
|
||||||
|
files, Claude Code through the `@` imports in `~/.claude/CLAUDE.md`, and Cline
|
||||||
|
through both the cross-tool `~/.agents/AGENTS.md` pointer and the always-on
|
||||||
|
global rule `~/.cline/rules/ai-context.md`, which binds `bootstrap.md`, the
|
||||||
|
dispatcher, the safety directives, and the distilled ChatGPT knowledge under
|
||||||
|
`memory/chatgpt/` (both deployed with `cline_deploy_enabled: true`). Cline
|
||||||
|
shows the rule in its Rules panel as `global:ai-context`, where it can be
|
||||||
|
toggled per project.
|
||||||
|
|
||||||
|
ChatGPT conversation memory lives in
|
||||||
|
`dotfiles/common/.config/ai/memory/chatgpt/`: one Markdown transcript per
|
||||||
|
conversation, a generated `INDEX.md`, and topic-distilled knowledge files under
|
||||||
|
`memory/chatgpt/knowledge/` that agents load through the dispatcher. Regenerate
|
||||||
|
it incrementally from an official ChatGPT data export with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 scripts/chatgpt_export_to_memory.py --export-dir ~/Downloads/<export>
|
||||||
|
```
|
||||||
|
|
||||||
|
Binary and personal assets (PDFs, images) are deliberately not imported;
|
||||||
|
textual ones are copied under `memory/chatgpt/assets/`. Non-technical personal
|
||||||
|
conversations are excluded from import by a privacy blocklist in the script,
|
||||||
|
which also prunes any previously imported copy.
|
||||||
|
|
||||||
|
The `opencode-mobile` npm package is no longer installed on managed hosts: its
|
||||||
|
agent entry sets `install_enabled: false` and `uninstall_enabled: true`, so the
|
||||||
|
playbook removes the managed package. The plugin declaration and `/mobile`
|
||||||
|
command are still deployed with the OpenCode dotfiles, and pairing and
|
||||||
|
connectivity remain manual; see the [upstream instructions](https://github.com/doza62/opencode-mobile#readme).
|
||||||
|
|
||||||
Run a focused dry run with:
|
Run a focused dry run with:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -610,6 +654,86 @@ only in the entry for the agent being removed, then run:
|
|||||||
ansible-playbook ansible/site.yml --limit deadalus --tags ai_agents --check --diff
|
ansible-playbook ansible/site.yml --limit deadalus --tags ai_agents --check --diff
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### AI desktop applications
|
||||||
|
|
||||||
|
The same lifecycle-flag pattern manages the Fedora desktop applications
|
||||||
|
through `ai_desktop_apps` in `ansible/inventory/group_vars/fedora.yml`.
|
||||||
|
`chatgpt_desktop`, `opencode_desktop` and `cline_desktop` each expose
|
||||||
|
`install_enabled` and `uninstall_enabled`, and the common pre-task rejects
|
||||||
|
both being true for the same app. ChatGPT opts in per host (`ikaros`, `nymph`),
|
||||||
|
Cline opts in through `desktop_gnome` group vars, and OpenCode Desktop keeps
|
||||||
|
removal selected because Cline replaced it.
|
||||||
|
|
||||||
|
Removal deletes only what the playbook manages — the installed RPM package,
|
||||||
|
ChatGPT's managed repository and signing key, and every cached download — and
|
||||||
|
leaves GNOME favorites, user data, and the npm-managed CLI counterparts
|
||||||
|
untouched. To switch an app between installed and removed, flip exactly one
|
||||||
|
of its lifecycle flags, then preview with:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook ansible/site.yml --limit ikaros --tags chatgpt,opencode_desktop,cline_desktop --check --diff
|
||||||
|
```
|
||||||
|
|
||||||
|
### Cline Desktop on Fedora
|
||||||
|
|
||||||
|
The [official Cline Desktop RPM](https://cline.bot/desktop) is managed on the
|
||||||
|
Fedora/GNOME workstations `ikaros` and `nymph`. WSL, Fedora IoT, Void and servers
|
||||||
|
are excluded. The GNOME profile pins `Cline.desktop` in the position of an old
|
||||||
|
OpenCode favorite, or appends it if there was no OpenCode favorite. Other
|
||||||
|
favorites keep their order. Run the playbook from an active GNOME session.
|
||||||
|
|
||||||
|
The version and per-architecture SHA-256 digests are pinned in
|
||||||
|
`ansible/inventory/group_vars/fedora.yml`; update both together from the official
|
||||||
|
[Desktop release](https://github.com/cline/cline/releases/tag/desktop-v0.0.49).
|
||||||
|
Only the checksum-verified local RPM installation disables DNF signature
|
||||||
|
checking; no repository policy is changed. The Cline VS Code extension and
|
||||||
|
npm-managed CLIs are independent of this app.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook ansible/site.yml --limit ikaros --tags cline_desktop --check --diff
|
||||||
|
ansible-playbook ansible/site.yml --limit ikaros --tags cline_desktop -K
|
||||||
|
```
|
||||||
|
|
||||||
|
Run locally on each workstation (`ansible_connection: local`); use `--limit nymph`
|
||||||
|
on the laptop. With a cold RPM cache, check mode reports that dependency resolution
|
||||||
|
is not validated; the real run downloads, verifies, and installs the package.
|
||||||
|
Cline replaced OpenCode Desktop: its `ai_desktop_apps` entry keeps
|
||||||
|
`opencode_desktop_uninstall_enabled: true` by default, so a previously
|
||||||
|
installed `opencode` RPM converges away on graphical hosts. Flip the entry's
|
||||||
|
flags to reinstall the pinned release instead. Neither removal touches the
|
||||||
|
npm CLI or user data.
|
||||||
|
|
||||||
|
### Thunderbird iCloud profile on Fedora
|
||||||
|
|
||||||
|
`profile_desktop_gnome` seeds a Thunderbird profile for `ikaros` and `nymph` so the
|
||||||
|
iCloud account is already declared: IMAP `imap.mail.me.com:993` over SSL/TLS, SMTP
|
||||||
|
`smtp.mail.me.com:587` over STARTTLS, the identity and folder mapping, one CalDAV
|
||||||
|
calendar (`caldav.icloud.com`) and one CardDAV address book (`contacts.icloud.com`).
|
||||||
|
|
||||||
|
Before provisioning, the role checks both `~/.thunderbird` and
|
||||||
|
`~/.config/thunderbird`, including registered absolute profile paths. If a profile
|
||||||
|
already has a configured mail account, it selects that profile without modifying
|
||||||
|
its account preferences, passwords, calendars or address books. Registered default
|
||||||
|
profiles take priority over other discovered profiles. The active registry keeps
|
||||||
|
its other profiles and is backed up before changes, including installation defaults.
|
||||||
|
|
||||||
|
Only when no configured account exists does the role create the iCloud profile
|
||||||
|
and seed `user.js` without overwriting an existing file. Thunderbird must be closed
|
||||||
|
before applying this tag; the playbook never stops it automatically. No profile or
|
||||||
|
mail data is deleted or copied. A fresh installation uses `~/.config/thunderbird`;
|
||||||
|
an existing legacy `~/.thunderbird` directory is retained.
|
||||||
|
|
||||||
|
The address comes from `vault_icloud_email` and the display name from
|
||||||
|
`vault_personal_full_name`. The password is deliberately not stored: iCloud mail
|
||||||
|
requires an app-specific password, which Thunderbird requests on first use and
|
||||||
|
keeps in its own credential store. Set `thunderbird_icloud_enabled: false` to stop
|
||||||
|
managing the profile without deleting it.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird --check --diff
|
||||||
|
ansible-playbook ansible/site.yml --limit ikaros --tags thunderbird -K
|
||||||
|
```
|
||||||
|
|
||||||
## Main roles
|
## Main roles
|
||||||
|
|
||||||
| Role | What it does |
|
| Role | What it does |
|
||||||
@@ -769,3 +893,13 @@ For a future Void desktop host:
|
|||||||
4. Put hardware-specific details in `host_vars/<host>.yml`.
|
4. Put hardware-specific details in `host_vars/<host>.yml`.
|
||||||
|
|
||||||
The legacy `void` and `desktop` groups remain compatibility parents, so hosts in `platform_void` and `graphical_desktop` still receive the existing Void and desktop variables.
|
The legacy `void` and `desktop` groups remain compatibility parents, so hosts in `platform_void` and `graphical_desktop` still receive the existing Void and desktop variables.
|
||||||
|
|
||||||
|
## Project devcontainer generator
|
||||||
|
|
||||||
|
Generate a reusable language environment for an existing project with
|
||||||
|
`devcontainer ~/src/project --language python --agents codex,cline`.
|
||||||
|
Git and selected coding-agent configuration are shared from the development host.
|
||||||
|
See [profiles, host requirements and validation](docs/project-devcontainers.md).
|
||||||
|
|
||||||
|
Deploy `~/.local/bin/devcontainer` on a Fedora desktop/workstation with
|
||||||
|
`ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator -K`.
|
||||||
|
|||||||
@@ -93,43 +93,75 @@ common_dotfiles:
|
|||||||
# AI coding-agent lifecycle controls are independent for every agent.
|
# AI coding-agent lifecycle controls are independent for every agent.
|
||||||
# Installation and removal are mutually exclusive per agent; the common
|
# Installation and removal are mutually exclusive per agent; the common
|
||||||
# pre-task enforces this before any changes are made.
|
# pre-task enforces this before any changes are made.
|
||||||
|
opencode_install_enabled: true
|
||||||
|
opencode_deploy_enabled: true
|
||||||
|
opencode_uninstall_enabled: false
|
||||||
|
codex_install_enabled: true
|
||||||
|
codex_deploy_enabled: true
|
||||||
|
codex_uninstall_enabled: false
|
||||||
codex_relay_install_enabled: false
|
codex_relay_install_enabled: false
|
||||||
|
codex_relay_uninstall_enabled: false
|
||||||
|
gemini_cli_install_enabled: true
|
||||||
|
gemini_cli_deploy_enabled: true
|
||||||
|
gemini_cli_uninstall_enabled: false
|
||||||
|
claude_code_install_enabled: false
|
||||||
|
claude_code_uninstall_enabled: true
|
||||||
|
cline_install_enabled: true
|
||||||
|
cline_deploy_enabled: true
|
||||||
|
cline_uninstall_enabled: false
|
||||||
|
ibm_bob_install_enabled: true
|
||||||
|
ibm_bob_uninstall_enabled: false
|
||||||
|
|
||||||
|
# npm registry requests can be interrupted transiently. Keep retries bounded
|
||||||
|
# so persistent proxy, DNS, or registry failures still fail the play clearly.
|
||||||
|
ai_agents_npm_install_retries: 3
|
||||||
|
ai_agents_npm_install_retry_delay: 10
|
||||||
|
|
||||||
ai_agents:
|
ai_agents:
|
||||||
opencode:
|
opencode:
|
||||||
npm_package: opencode-ai
|
npm_package: opencode-ai
|
||||||
install_enabled: true
|
install_enabled: "{{ opencode_install_enabled }}"
|
||||||
deploy_enabled: true
|
deploy_enabled: "{{ opencode_deploy_enabled }}"
|
||||||
uninstall_enabled: false
|
uninstall_enabled: "{{ opencode_uninstall_enabled }}"
|
||||||
claude_code:
|
opencode_mobile:
|
||||||
npm_package: "@anthropic-ai/claude-code"
|
npm_package: opencode-mobile
|
||||||
install_enabled: false
|
install_enabled: false
|
||||||
deploy_enabled: false
|
deploy_enabled: false
|
||||||
uninstall_enabled: true
|
uninstall_enabled: true
|
||||||
|
claude_code:
|
||||||
|
npm_package: "@anthropic-ai/claude-code"
|
||||||
|
install_enabled: "{{ claude_code_install_enabled }}"
|
||||||
|
deploy_enabled: false
|
||||||
|
uninstall_enabled: "{{ claude_code_uninstall_enabled }}"
|
||||||
codex:
|
codex:
|
||||||
npm_package: "@openai/codex"
|
npm_package: "@openai/codex"
|
||||||
install_enabled: true
|
install_enabled: "{{ codex_install_enabled }}"
|
||||||
deploy_enabled: true
|
deploy_enabled: "{{ codex_deploy_enabled }}"
|
||||||
uninstall_enabled: false
|
uninstall_enabled: "{{ codex_uninstall_enabled }}"
|
||||||
codex_relay:
|
codex_relay:
|
||||||
npm_package: codex-relay
|
npm_package: codex-relay
|
||||||
install_enabled: "{{ codex_relay_install_enabled }}"
|
install_enabled: "{{ codex_relay_install_enabled }}"
|
||||||
deploy_enabled: false
|
deploy_enabled: false
|
||||||
uninstall_enabled: false
|
uninstall_enabled: "{{ codex_relay_uninstall_enabled }}"
|
||||||
gemini_cli:
|
gemini_cli:
|
||||||
npm_package: "@google/gemini-cli"
|
npm_package: "@google/gemini-cli"
|
||||||
install_enabled: true
|
install_enabled: "{{ gemini_cli_install_enabled }}"
|
||||||
deploy_enabled: true
|
deploy_enabled: "{{ gemini_cli_deploy_enabled }}"
|
||||||
uninstall_enabled: false
|
uninstall_enabled: "{{ gemini_cli_uninstall_enabled }}"
|
||||||
|
cline:
|
||||||
|
npm_package: cline
|
||||||
|
install_enabled: "{{ cline_install_enabled }}"
|
||||||
|
deploy_enabled: "{{ cline_deploy_enabled }}"
|
||||||
|
uninstall_enabled: "{{ cline_uninstall_enabled }}"
|
||||||
github_copilot:
|
github_copilot:
|
||||||
npm_package: "@github/copilot"
|
npm_package: "@github/copilot"
|
||||||
install_enabled: false
|
install_enabled: false
|
||||||
deploy_enabled: false
|
deploy_enabled: false
|
||||||
uninstall_enabled: true
|
uninstall_enabled: true
|
||||||
ibm_bob:
|
ibm_bob:
|
||||||
install_enabled: true
|
install_enabled: "{{ ibm_bob_install_enabled }}"
|
||||||
deploy_enabled: false
|
deploy_enabled: false
|
||||||
uninstall_enabled: false
|
uninstall_enabled: "{{ ibm_bob_uninstall_enabled }}"
|
||||||
|
|
||||||
ai_agents_deploy_enabled_names: >-
|
ai_agents_deploy_enabled_names: >-
|
||||||
{{ ai_agents | dict2items | selectattr('value.deploy_enabled') | map(attribute='key') | list }}
|
{{ ai_agents | dict2items | selectattr('value.deploy_enabled') | map(attribute='key') | list }}
|
||||||
@@ -143,6 +175,7 @@ ai_agents_dotfiles:
|
|||||||
- opencode
|
- opencode
|
||||||
- codex
|
- codex
|
||||||
- gemini_cli
|
- gemini_cli
|
||||||
|
- cline
|
||||||
- name: Gemini CLI config
|
- name: Gemini CLI config
|
||||||
src: .gemini/
|
src: .gemini/
|
||||||
dest: .gemini/
|
dest: .gemini/
|
||||||
@@ -161,6 +194,24 @@ ai_agents_dotfiles:
|
|||||||
mode: preserve
|
mode: preserve
|
||||||
agents:
|
agents:
|
||||||
- claude_code
|
- claude_code
|
||||||
|
- name: Codex global AGENTS instructions
|
||||||
|
src: .codex/AGENTS.md
|
||||||
|
dest: .codex/AGENTS.md
|
||||||
|
mode: "0644"
|
||||||
|
agents:
|
||||||
|
- codex
|
||||||
|
- name: Cline cross-tool AGENTS instructions
|
||||||
|
src: .agents/AGENTS.md
|
||||||
|
dest: .agents/AGENTS.md
|
||||||
|
mode: "0644"
|
||||||
|
agents:
|
||||||
|
- cline
|
||||||
|
- name: Cline global rules
|
||||||
|
src: .cline/rules/
|
||||||
|
dest: .cline/rules/
|
||||||
|
mode: preserve
|
||||||
|
agents:
|
||||||
|
- cline
|
||||||
|
|
||||||
ai_agents_templates:
|
ai_agents_templates:
|
||||||
- name: Codex config
|
- name: Codex config
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ desktop_uv_tools:
|
|||||||
- python-lsp-server
|
- python-lsp-server
|
||||||
|
|
||||||
desktop_common_dotfiles:
|
desktop_common_dotfiles:
|
||||||
- name: XDG autostart entries
|
|
||||||
src: .config/autostart/
|
|
||||||
dest: .config/autostart/
|
|
||||||
mode: preserve
|
|
||||||
- name: fastfetch config
|
- name: fastfetch config
|
||||||
src: .config/fastfetch/
|
src: .config/fastfetch/
|
||||||
dest: .config/fastfetch/
|
dest: .config/fastfetch/
|
||||||
|
|||||||
@@ -4,6 +4,9 @@ desktop_environment: gnome
|
|||||||
desktop_sessions_enabled: []
|
desktop_sessions_enabled: []
|
||||||
desktop_default_session: gnome
|
desktop_default_session: gnome
|
||||||
emacs_enabled: true
|
emacs_enabled: true
|
||||||
|
# Cline Desktop is installed (and pinned in the GNOME favorites) on every
|
||||||
|
# GNOME host; set cline_desktop_uninstall_enabled here to remove it instead.
|
||||||
|
cline_desktop_install_enabled: true
|
||||||
|
|
||||||
# Fedora Workstation/GNOME desktop applications. Keep this profile separate from
|
# Fedora Workstation/GNOME desktop applications. Keep this profile separate from
|
||||||
# workstation_* so nymph can remain a desktop laptop rather than a dev workstation.
|
# workstation_* so nymph can remain a desktop laptop rather than a dev workstation.
|
||||||
@@ -88,5 +91,81 @@ fedora_nerd_fonts:
|
|||||||
fedora_flatpak_packages:
|
fedora_flatpak_packages:
|
||||||
- be.alexandervanhee.gradia
|
- be.alexandervanhee.gradia
|
||||||
- com.spotify.Client
|
- com.spotify.Client
|
||||||
|
- org.desktop_plus.desktop-plus
|
||||||
- org.onlyoffice.desktopeditors
|
- org.onlyoffice.desktopeditors
|
||||||
- org.telegram.desktop
|
- org.telegram.desktop
|
||||||
|
|
||||||
|
# GNOME-only dotfiles. Kept out of desktop_common_dotfiles so the Void desktops
|
||||||
|
# do not receive XDG autostart entries for applications they do not install.
|
||||||
|
# Nextcloud desktop is the `nextcloud-client` package in fedora_desktop_packages;
|
||||||
|
# this entry matches what the client itself writes when "Launch on startup" is on.
|
||||||
|
desktop_gnome_dotfiles:
|
||||||
|
- name: Nextcloud autostart entry
|
||||||
|
src: .config/autostart/Nextcloud.desktop
|
||||||
|
dest: .config/autostart/Nextcloud.desktop
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
|
# Thunderbird is provisioned from a seeded profile plus a managed user.js:
|
||||||
|
# Existing Thunderbird accounts are reused without changing their preferences.
|
||||||
|
# Only a new profile receives account, calendar and address book defaults in user.js.
|
||||||
|
# The address comes from Vault; the app-specific password is never stored here
|
||||||
|
# and is requested by Thunderbird on first use.
|
||||||
|
thunderbird_icloud_enabled: true
|
||||||
|
thunderbird_profile_name: "{{ username }}"
|
||||||
|
thunderbird_profile_dir: "{{ username }}.default-release"
|
||||||
|
thunderbird_full_name: "{{ vault_personal_full_name | default(username) }}"
|
||||||
|
thunderbird_icloud_email: "{{ vault_icloud_email }}"
|
||||||
|
thunderbird_icloud_account_name: iCloud
|
||||||
|
thunderbird_icloud_imap_host: imap.mail.me.com
|
||||||
|
thunderbird_icloud_imap_port: 993
|
||||||
|
thunderbird_icloud_smtp_host: smtp.mail.me.com
|
||||||
|
thunderbird_icloud_smtp_port: 587
|
||||||
|
thunderbird_icloud_caldav_url: https://caldav.icloud.com/
|
||||||
|
thunderbird_icloud_carddav_url: https://contacts.icloud.com/
|
||||||
|
thunderbird_icloud_calendar_id: 4f2c1d6e-9b3a-4f7c-8e21-6d5a0c9b7e13
|
||||||
|
thunderbird_icloud_addressbook_uid: 9e0b7c4a-2d51-4a8f-b6c3-1f7d5e2a8b46
|
||||||
|
|
||||||
|
# Native VS Code; opt in to managing settings only after defining them.
|
||||||
|
vscode_extensions:
|
||||||
|
- esbenp.prettier-vscode
|
||||||
|
- github.remotehub
|
||||||
|
- ms-azuretools.vscode-containers
|
||||||
|
# ms-azuretools.vscode-docker is deprecated: since June 2025 it is just an
|
||||||
|
# extension pack wrapping Container Tools. Only the real extension is kept.
|
||||||
|
- ms-vscode-remote.remote-containers
|
||||||
|
- ms-vscode-remote.remote-ssh
|
||||||
|
- ms-vscode-remote.remote-ssh-edit
|
||||||
|
- ms-vscode-remote.remote-wsl
|
||||||
|
- ms-vscode-remote.vscode-remote-extensionpack
|
||||||
|
- ms-vscode.azure-repos
|
||||||
|
- ms-vscode.remote-explorer
|
||||||
|
- ms-vscode.remote-repositories
|
||||||
|
- ms-vscode.remote-server
|
||||||
|
- pkief.material-icon-theme
|
||||||
|
- redhat.vscode-xml
|
||||||
|
- redhat.vscode-yaml
|
||||||
|
- saoudrizwan.claude-dev
|
||||||
|
- vscodevim.vim
|
||||||
|
# Managed user settings deploy as a full-file overlay with a timestamped backup;
|
||||||
|
# any manual settings.json edit is converged away on the next run. These keys cover
|
||||||
|
# the podman Dev Containers engine selection and the Container Tools clients.
|
||||||
|
# editor.fontFamily uses the canonical 'JetBrainsMono Nerd Font' family name: the
|
||||||
|
# live 'JetBriansMono NF' was a typo whose fallback chain rendered Liberation Mono.
|
||||||
|
vscode_settings:
|
||||||
|
containers.containerClient: com.microsoft.visualstudio.containers.podman
|
||||||
|
containers.orchestratorClient: com.microsoft.visualstudio.orchestrators.podmancompose
|
||||||
|
dev.containers.dockerPath: podman
|
||||||
|
editor.cursorStyle: block
|
||||||
|
editor.fontFamily: "'JetBrainsMono Nerd Font', 'Droid Sans Mono', monospace"
|
||||||
|
editor.formatOnPaste: true
|
||||||
|
workbench.iconTheme: material-icon-theme
|
||||||
|
workbench.startupEditor: none
|
||||||
|
# User-level keybindings apply to every window, including Dev Containers, SSH and WSL remotes.
|
||||||
|
# Keys avoid Ctrl+<letter>, which the Vim extension uses for its motions; Alt is not bound by Vim.
|
||||||
|
vscode_keybindings:
|
||||||
|
- key: alt+j
|
||||||
|
command: workbench.action.terminal.toggleTerminal
|
||||||
|
when: "!terminalFocus"
|
||||||
|
- key: alt+j
|
||||||
|
command: workbench.action.togglePanel
|
||||||
|
when: terminalFocus
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ fedora_packages_base:
|
|||||||
- htop
|
- htop
|
||||||
- jq
|
- jq
|
||||||
- make
|
- make
|
||||||
- nodejs
|
# Keep the LTS stream explicit. Fedora 45's rolling `nodejs` package
|
||||||
|
# conflicts with the nodejs22-bin alternative installed by the F44→F45
|
||||||
|
# upgrade.
|
||||||
|
- nodejs22
|
||||||
- openssl
|
- openssl
|
||||||
- ripgrep
|
- ripgrep
|
||||||
|
|
||||||
@@ -60,10 +63,54 @@ fedora_dev_packages:
|
|||||||
fedora_flatpak_remote_name: flathub
|
fedora_flatpak_remote_name: flathub
|
||||||
fedora_flatpak_remote_url: https://dl.flathub.org/repo/flathub.flatpakrepo
|
fedora_flatpak_remote_url: https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||||
|
|
||||||
chatgpt_desktop_enabled: false
|
cline_desktop_version: "0.0.49"
|
||||||
|
# Launcher file shipped by the pinned RPM; the GNOME profile pins it in the
|
||||||
|
# favorites while installation stays enabled.
|
||||||
|
cline_desktop_launcher: Cline.desktop
|
||||||
|
# Digests published with the official GitHub release; update with the version.
|
||||||
|
cline_desktop_rpm_checksums:
|
||||||
|
x86_64: sha256:e10036a036ee531451695559e2c96feceb3d621408a6615bdd708ffcf9e778ab
|
||||||
|
aarch64: sha256:aec36edb594bdc400b0c2275230f29de6814a78ad60add4938347d20cfb93b74
|
||||||
|
cline_desktop_rpm_url: >-
|
||||||
|
https://github.com/cline/cline/releases/download/desktop-v{{ cline_desktop_version }}/Cline_{{ cline_desktop_version }}_{{ ansible_facts['architecture'] }}.rpm
|
||||||
|
cline_desktop_rpm_path: "/var/cache/cline-desktop-{{ cline_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm"
|
||||||
|
|
||||||
|
# OpenCode Desktop was replaced by Cline Desktop. The pinned release stays
|
||||||
|
# available for reinstall, while removal is selected in the lifecycle flags
|
||||||
|
# below so leftovers from the switch converge away on graphical hosts.
|
||||||
|
opencode_desktop_version: "2.2.5"
|
||||||
|
# Digests published with the official GitHub release; update with the version.
|
||||||
|
opencode_desktop_rpm_checksums:
|
||||||
|
x86_64: sha256:4feb27fe98df9b7579abd31a790d331e9aff87c95f67081beefa2aaaa76ebada
|
||||||
|
aarch64: sha256:e84b1e03e2b4fb337ddfe015b6457a7aa0dfe171338be08e643ad66b1657033a
|
||||||
|
opencode_desktop_rpm_url: >-
|
||||||
|
https://github.com/anomalyco/opencode/releases/download/v{{ opencode_desktop_version }}/opencode-desktop-linux-{{ ansible_facts['architecture'] }}.rpm
|
||||||
|
opencode_desktop_rpm_path: "/var/cache/opencode-desktop-{{ opencode_desktop_version }}-{{ ansible_facts['architecture'] }}.rpm"
|
||||||
|
|
||||||
|
# AI desktop-app lifecycle controls are independent for every app and mirror
|
||||||
|
# the CLI coding-agent flags. Installation and removal are mutually exclusive
|
||||||
|
# per app; the common pre-task enforces this before any changes are made.
|
||||||
|
# ChatGPT opts in per host, Cline opts in through desktop_gnome group vars.
|
||||||
|
chatgpt_desktop_install_enabled: false
|
||||||
|
chatgpt_desktop_uninstall_enabled: false
|
||||||
|
opencode_desktop_install_enabled: false
|
||||||
|
opencode_desktop_uninstall_enabled: true
|
||||||
|
|
||||||
|
ai_desktop_apps:
|
||||||
|
chatgpt_desktop:
|
||||||
|
install_enabled: "{{ chatgpt_desktop_install_enabled }}"
|
||||||
|
uninstall_enabled: "{{ chatgpt_desktop_uninstall_enabled }}"
|
||||||
|
opencode_desktop:
|
||||||
|
install_enabled: "{{ opencode_desktop_install_enabled }}"
|
||||||
|
uninstall_enabled: "{{ opencode_desktop_uninstall_enabled }}"
|
||||||
|
cline_desktop:
|
||||||
|
install_enabled: "{{ cline_desktop_install_enabled | default(false) }}"
|
||||||
|
uninstall_enabled: "{{ cline_desktop_uninstall_enabled | default(false) }}"
|
||||||
|
|
||||||
chatgpt_desktop_supported_fedora_versions:
|
chatgpt_desktop_supported_fedora_versions:
|
||||||
- "43"
|
- "43"
|
||||||
- "44"
|
- "44"
|
||||||
|
- "45"
|
||||||
chatgpt_desktop_supported_architectures:
|
chatgpt_desktop_supported_architectures:
|
||||||
- x86_64
|
- x86_64
|
||||||
- aarch64
|
- aarch64
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
---
|
---
|
||||||
emacs_enabled: true
|
emacs_enabled: true
|
||||||
|
|
||||||
|
workstation_git_https_cas:
|
||||||
|
- url: https://gitlab.ecaas.datacenter.comune.roma
|
||||||
|
certificate: ecaas.datacenter.comune.roma.crt
|
||||||
|
- url: https://gitlab.datacenter.comune.roma
|
||||||
|
certificate: datacenter.comune.roma.crt
|
||||||
|
|
||||||
workstation_user_directories:
|
workstation_user_directories:
|
||||||
- path: "{{ user_home }}/.config"
|
- path: "{{ user_home }}/.config"
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|||||||
@@ -1,4 +1,8 @@
|
|||||||
---
|
---
|
||||||
|
# Claude Code is managed only on the Fedora WSL development profile.
|
||||||
|
claude_code_install_enabled: true
|
||||||
|
claude_code_uninstall_enabled: false
|
||||||
|
|
||||||
enabled_services:
|
enabled_services:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
@@ -7,26 +11,17 @@ workstation_dev_wsl_packages:
|
|||||||
- helm
|
- helm
|
||||||
# Fedora ships the kubectl client binary in the kubernetes-client package.
|
# Fedora ships the kubectl client binary in the kubernetes-client package.
|
||||||
- kubernetes-client
|
- kubernetes-client
|
||||||
- mise
|
|
||||||
- pinentry-curses
|
- pinentry-curses
|
||||||
- python3-pip
|
- python3-pip
|
||||||
- tmux
|
- tmux
|
||||||
|
|
||||||
# Java 11, Java 25 and Maven are managed by Mise on this Fedora WSL profile.
|
# Maven version pinned in the devcontainer images; update it deliberately.
|
||||||
# Keep their versions pinned; update them deliberately.
|
workstation_maven_version: 3.9.16
|
||||||
workstation_mise_java_version: temurin-11.0.31+11
|
workstation_cdp_node_version: 20.18.3
|
||||||
workstation_mise_java_25_version: 25.0.2
|
|
||||||
workstation_mise_maven_version: 3.9.16
|
|
||||||
|
|
||||||
workstation_is_wsl: true
|
workstation_is_wsl: true
|
||||||
workstation_wsl_systemd_enabled: true
|
workstation_wsl_systemd_enabled: true
|
||||||
workstation_dev_wsl_dotfiles:
|
workstation_dev_wsl_dotfiles:
|
||||||
- src: .bashrc.d/30-mise.sh
|
|
||||||
dest: .bashrc.d/30-mise.sh
|
|
||||||
mode: "0644"
|
|
||||||
- src: .config/mise/
|
|
||||||
dest: .config/mise/
|
|
||||||
mode: preserve
|
|
||||||
- src: .gnupg/gpg-agent.conf
|
- src: .gnupg/gpg-agent.conf
|
||||||
dest: .gnupg/gpg-agent.conf
|
dest: .gnupg/gpg-agent.conf
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
|
|||||||
@@ -1,6 +1,30 @@
|
|||||||
---
|
---
|
||||||
hostname: deadalus
|
hostname: deadalus
|
||||||
workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO
|
workstation_wsl_windows_user_home: /mnt/c/Users/FABIOSCOTTODISANTOLO
|
||||||
|
workstation_ecaas_workspace: "{{ user_home }}/Work/sipo/ecaas"
|
||||||
|
workstation_cdp_workspace: "{{ user_home }}/Work/sipo/cdp"
|
||||||
|
workstation_ecaas_git_required_ca: ecaas.datacenter.comune.roma.crt
|
||||||
|
|
||||||
|
# Claude Code, Codex and the Cline CLI are the coding agents installed on WSL; every
|
||||||
|
# other managed agent is disabled. Cline's cross-tool instructions (.agents/AGENTS.md,
|
||||||
|
# .cline/rules/) and the shared ~/.config/ai context are deployed for the ecaas/cdp
|
||||||
|
# devcontainers, and the cline npm package is installed by profile_workstation_dev_common.
|
||||||
|
claude_code_install_enabled: true
|
||||||
|
claude_code_uninstall_enabled: false
|
||||||
|
opencode_install_enabled: false
|
||||||
|
opencode_deploy_enabled: false
|
||||||
|
opencode_uninstall_enabled: true
|
||||||
|
codex_install_enabled: true
|
||||||
|
codex_deploy_enabled: false
|
||||||
|
codex_uninstall_enabled: false
|
||||||
|
gemini_cli_install_enabled: false
|
||||||
|
gemini_cli_deploy_enabled: false
|
||||||
|
gemini_cli_uninstall_enabled: true
|
||||||
|
cline_install_enabled: true
|
||||||
|
cline_deploy_enabled: true
|
||||||
|
cline_uninstall_enabled: false
|
||||||
|
ibm_bob_install_enabled: false
|
||||||
|
ibm_bob_uninstall_enabled: true
|
||||||
|
|
||||||
host_packages: []
|
host_packages: []
|
||||||
host_enabled_services: []
|
host_enabled_services: []
|
||||||
|
|||||||
@@ -1,9 +1,17 @@
|
|||||||
---
|
---
|
||||||
hostname: ikaros
|
hostname: ikaros
|
||||||
|
|
||||||
codex_relay_install_enabled: true
|
codex_relay_install_enabled: false
|
||||||
chatgpt_desktop_enabled: true
|
codex_relay_uninstall_enabled: true
|
||||||
|
gemini_cli_install_enabled: false
|
||||||
|
gemini_cli_deploy_enabled: false
|
||||||
|
gemini_cli_uninstall_enabled: true
|
||||||
|
chatgpt_desktop_install_enabled: true
|
||||||
desktop_ai_media_enabled: true
|
desktop_ai_media_enabled: true
|
||||||
|
desktop_ai_media_external_storage_enabled: true
|
||||||
|
desktop_ai_media_external_luks_uuid: 6948c504-2d60-4cc8-9e7f-3ccdf28e80d7
|
||||||
|
desktop_ai_media_external_mountpoint: /run/media/fscotto/Backup
|
||||||
|
desktop_ai_media_external_source: /run/media/fscotto/Backup/ai-media
|
||||||
|
|
||||||
host_packages:
|
host_packages:
|
||||||
- podman
|
- podman
|
||||||
@@ -143,7 +151,7 @@ gnome_gsettings_settings:
|
|||||||
value: "'file:///usr/share/backgrounds/gnome/morphogenesis-l.svg'"
|
value: "'file:///usr/share/backgrounds/gnome/morphogenesis-l.svg'"
|
||||||
- schema: org.gnome.desktop.search-providers
|
- schema: org.gnome.desktop.search-providers
|
||||||
key: sort-order
|
key: sort-order
|
||||||
value: "['org.gnome.Settings.desktop', 'org.gnome.Contacts.desktop', 'org.gnome.Nautilus.desktop']"
|
value: "['org.gnome.Settings.desktop', 'org.gnome.Contacts.desktop', 'org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'org.gnome.seahorse.Application.desktop', 'org.gnome.Calculator.desktop', 'org.gnome.Calendar.desktop', 'org.gnome.Software.desktop', 'org.gnome.Characters.desktop', 'org.gnome.Boxes.desktop', 'org.gnome.clocks.desktop', 'com.mattjakeman.ExtensionManager.desktop']"
|
||||||
- schema: org.gnome.desktop.wm.keybindings
|
- schema: org.gnome.desktop.wm.keybindings
|
||||||
key: switch-to-workspace-1
|
key: switch-to-workspace-1
|
||||||
value: "['<Super>1']"
|
value: "['<Super>1']"
|
||||||
@@ -206,7 +214,7 @@ gnome_gsettings_settings:
|
|||||||
value: "false"
|
value: "false"
|
||||||
- schema: org.gnome.nautilus.preferences
|
- schema: org.gnome.nautilus.preferences
|
||||||
key: default-folder-viewer
|
key: default-folder-viewer
|
||||||
value: "'list-view'"
|
value: "'icon-view'"
|
||||||
- schema: org.gnome.nautilus.preferences
|
- schema: org.gnome.nautilus.preferences
|
||||||
key: show-create-link
|
key: show-create-link
|
||||||
value: "true"
|
value: "true"
|
||||||
@@ -234,19 +242,19 @@ gnome_gsettings_settings:
|
|||||||
- schema: org.gnome.shell
|
- schema: org.gnome.shell
|
||||||
key: app-picker-layout
|
key: app-picker-layout
|
||||||
value: >-
|
value: >-
|
||||||
[{'System': <{'position': <0>}>, 'Utilities': <{'position': <1>}>, 'org.fedoraproject.MediaWriter.desktop': <{'position': <2>}>, 'org.gnome.Contacts.desktop': <{'position': <3>}>, 'org.gnome.Calendar.desktop': <{'position': <4>}>, 'org.gnome.Calculator.desktop': <{'position': <5>}>, 'org.gnome.Weather.desktop': <{'position': <6>}>, 'org.gnome.clocks.desktop': <{'position': <7>}>, 'org.gnome.Maps.desktop': <{'position': <8>}>, 'org.gnome.SimpleScan.desktop': <{'position': <9>}>, 'org.gnome.TextEditor.desktop': <{'position': <10>}>, 'org.gnome.Settings.desktop': <{'position': <11>}>, 'org.gnome.Boxes.desktop': <{'position': <12>}>, 'org.gnome.Showtime.desktop': <{'position': <13>}>, 'org.gnome.Snapshot.desktop': <{'position': <14>}>, 'org.gnome.Characters.desktop': <{'position': <15>}>, 'org.gnome.Tour.desktop': <{'position': <16>}>, 'org.gnome.Yelp.desktop': <{'position': <17>}>, 'org.gnome.Software.desktop': <{'position': <18>}>, 'be.alexandervanhee.gradia.desktop': <{'position': <19>}>, 'com.github.jeromerobert.pdfarranger.desktop': <{'position': <20>}>, 'org.onlyoffice.desktopeditors.desktop': <{'position': <21>}>, 'org.gnome.Meld.desktop': <{'position': <22>}>, 'com.mattjakeman.ExtensionManager.desktop': <{'position': <23>}>}, {'com.raspberrypi.rpi-imager.desktop': <{'position': <0>}>, 'org.remmina.Remmina.desktop': <{'position': <1>}>, 'com.nextcloud.desktopclient.nextcloud.desktop': <{'position': <2>}>, 'ch.protonmail.protonmail-bridge.desktop': <{'position': <3>}>, 'syncthing-start.desktop': <{'position': <4>}>, 'syncthing-ui.desktop': <{'position': <5>}>, 'emacs.desktop': <{'position': <6>}>, 'emacs-client.desktop': <{'position': <7>}>, 'org.gnome.gitlab.somas.Apostrophe.desktop': <{'position': <8>}>, 'mpv.desktop': <{'position': <9>}>, 'htop.desktop': <{'position': <10>}>, 'ai-media-facefusion.desktop': <{'position': <11>}>, 'ai-media-rvc.desktop': <{'position': <12>}>}]
|
[{'System': <{'position': <0>}>, 'Utilities': <{'position': <1>}>, 'org.fedoraproject.MediaWriter.desktop': <{'position': <2>}>, 'org.gnome.Contacts.desktop': <{'position': <3>}>, 'org.gnome.Calendar.desktop': <{'position': <4>}>, 'org.gnome.Calculator.desktop': <{'position': <5>}>, 'org.gnome.Weather.desktop': <{'position': <6>}>, 'org.gnome.clocks.desktop': <{'position': <7>}>, 'org.gnome.Maps.desktop': <{'position': <8>}>, 'org.gnome.SimpleScan.desktop': <{'position': <9>}>, 'org.gnome.TextEditor.desktop': <{'position': <10>}>, 'org.gnome.Settings.desktop': <{'position': <11>}>, 'org.gnome.Boxes.desktop': <{'position': <12>}>, 'org.gnome.Showtime.desktop': <{'position': <13>}>, 'org.gnome.Snapshot.desktop': <{'position': <14>}>, 'org.gnome.Characters.desktop': <{'position': <15>}>, 'org.gnome.Tour.desktop': <{'position': <16>}>, 'org.gnome.Yelp.desktop': <{'position': <17>}>, 'org.gnome.Software.desktop': <{'position': <18>}>, 'be.alexandervanhee.gradia.desktop': <{'position': <19>}>, 'com.github.jeromerobert.pdfarranger.desktop': <{'position': <20>}>, 'org.onlyoffice.desktopeditors.desktop': <{'position': <21>}>, 'org.gnome.Meld.desktop': <{'position': <22>}>, 'com.mattjakeman.ExtensionManager.desktop': <{'position': <23>}>}, {'com.raspberrypi.rpi-imager.desktop': <{'position': <0>}>, 'org.remmina.Remmina.desktop': <{'position': <1>}>, 'com.nextcloud.desktopclient.nextcloud.desktop': <{'position': <2>}>, 'syncthing-start.desktop': <{'position': <3>}>, 'syncthing-ui.desktop': <{'position': <4>}>, 'emacs.desktop': <{'position': <5>}>, 'emacs-client.desktop': <{'position': <6>}>, 'chatgpt.desktop': <{'position': <7>}>, 'org.gnome.gitlab.somas.Apostrophe.desktop': <{'position': <8>}>, 'mpv.desktop': <{'position': <9>}>, 'htop.desktop': <{'position': <10>}>, 'ai-media-facefusion.desktop': <{'position': <11>}>, 'ai-media-rvc.desktop': <{'position': <12>}>}]
|
||||||
- schema: org.gnome.shell
|
- schema: org.gnome.shell
|
||||||
key: disabled-extensions
|
key: disabled-extensions
|
||||||
value: >-
|
value: >-
|
||||||
['window-list@gnome-shell-extensions.gcampax.github.com', 'background-logo@fedorahosted.org', 'apps-menu@gnome-shell-extensions.gcampax.github.com', 'places-menu@gnome-shell-extensions.gcampax.github.com']
|
['window-list@gnome-shell-extensions.gcampax.github.com', 'background-logo@fedorahosted.org', 'apps-menu@gnome-shell-extensions.gcampax.github.com', 'places-menu@gnome-shell-extensions.gcampax.github.com', 'maximize-new-windows@VitalyOstanin']
|
||||||
- schema: org.gnome.shell
|
- schema: org.gnome.shell
|
||||||
key: enabled-extensions
|
key: enabled-extensions
|
||||||
value: >-
|
value: >-
|
||||||
['status-icons@gnome-shell-extensions.gcampax.github.com', 'gnome-ui-tune@itstime.tech', 'appindicatorsupport@rgcjonas.gmail.com', 'bluetooth-battery-monitor@v8v88v8v88.com', 'clipboard-indicator@tudmotu.com', 'status-area-horizontal-spacing@mathematical.coffee.gmail.com', 'MaximizeWindowIntoNewWorkspace@kyleross.com', 'maximize-new-windows@VitalyOstanin']
|
['status-icons@gnome-shell-extensions.gcampax.github.com', 'gnome-ui-tune@itstime.tech', 'appindicatorsupport@rgcjonas.gmail.com', 'bluetooth-battery-monitor@v8v88v8v88.com', 'clipboard-indicator@tudmotu.com', 'status-area-horizontal-spacing@mathematical.coffee.gmail.com', 'MaximizeWindowIntoNewWorkspace@kyleross.com', 'gnome-shell-extension-maximized-by-default@stiggimy.github.com']
|
||||||
- schema: org.gnome.shell
|
- schema: org.gnome.shell
|
||||||
key: favorite-apps
|
key: favorite-apps
|
||||||
value: >-
|
value: >-
|
||||||
['org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'com.spotify.Client.desktop', 'net.thunderbird.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'chatgpt.desktop', 'org.gnome.Ptyxis.desktop', 'virt-manager.desktop']
|
['org.gnome.Nautilus.desktop', 'org.mozilla.firefox.desktop', 'com.spotify.Client.desktop', 'net.thunderbird.Thunderbird.desktop', 'org.telegram.desktop.desktop', 'Cline.desktop', 'org.desktop_plus.desktop-plus.desktop', 'com.microsoft.VSCode.desktop', 'org.gnome.Ptyxis.desktop', 'virt-manager.desktop']
|
||||||
- schema: org.gnome.shell
|
- schema: org.gnome.shell
|
||||||
key: remember-mount-password
|
key: remember-mount-password
|
||||||
value: "true"
|
value: "true"
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
---
|
---
|
||||||
hostname: nymph
|
hostname: nymph
|
||||||
|
|
||||||
chatgpt_desktop_enabled: true
|
codex_relay_install_enabled: false
|
||||||
|
codex_relay_uninstall_enabled: true
|
||||||
|
gemini_cli_install_enabled: false
|
||||||
|
gemini_cli_deploy_enabled: false
|
||||||
|
gemini_cli_uninstall_enabled: true
|
||||||
|
|
||||||
|
chatgpt_desktop_install_enabled: true
|
||||||
|
|
||||||
# Fedora Workstation/GNOME laptop target. GNOME is provided by the base Fedora
|
# Fedora Workstation/GNOME laptop target. GNOME is provided by the base Fedora
|
||||||
# Workstation install; Ansible deploys shared desktop dotfiles but leaves GNOME
|
# Workstation install; Ansible deploys shared desktop dotfiles but leaves GNOME
|
||||||
|
|||||||
@@ -2,6 +2,10 @@
|
|||||||
desktop_ai_media_enabled: false
|
desktop_ai_media_enabled: false
|
||||||
desktop_ai_media_root: "{{ user_home }}/.local/share/ai-media"
|
desktop_ai_media_root: "{{ user_home }}/.local/share/ai-media"
|
||||||
desktop_ai_media_build_root: "{{ user_home }}/.local/share/ai-media-build"
|
desktop_ai_media_build_root: "{{ user_home }}/.local/share/ai-media-build"
|
||||||
|
desktop_ai_media_external_storage_enabled: false
|
||||||
|
desktop_ai_media_external_luks_uuid: ""
|
||||||
|
desktop_ai_media_external_mountpoint: ""
|
||||||
|
desktop_ai_media_external_source: ""
|
||||||
desktop_ai_media_debian_snapshot: "20261013T000000Z"
|
desktop_ai_media_debian_snapshot: "20261013T000000Z"
|
||||||
desktop_ai_media_base_image: >-
|
desktop_ai_media_base_image: >-
|
||||||
docker.io/library/python@sha256:34386ef0cb081344d7ec1c103ba398e6e9f64e9ab3a1509accc92a4e24a07258
|
docker.io/library/python@sha256:34386ef0cb081344d7ec1c103ba398e6e9f64e9ab3a1509accc92a4e24a07258
|
||||||
|
|||||||
@@ -15,12 +15,23 @@ for line in pathlib.Path("/proc/self/mountinfo").read_text().splitlines():
|
|||||||
fields, description = line.split(" - ", 1)
|
fields, description = line.split(" - ", 1)
|
||||||
mount = re.sub(r"\\([0-7]{3})", lambda m: chr(int(m[1], 8)), fields.split()[4])
|
mount = re.sub(r"\\([0-7]{3})", lambda m: chr(int(m[1], 8)), fields.split()[4])
|
||||||
mounts.append((pathlib.Path(mount), description.split()[0]))
|
mounts.append((pathlib.Path(mount), description.split()[0]))
|
||||||
covering = [(p, kind) for p, kind in mounts if root == p or root.is_relative_to(p)]
|
automount_at_root = any(p == root and kind == "autofs" for p, kind in mounts)
|
||||||
|
backing_mount_at_root = any(
|
||||||
|
p == root and kind != "autofs" for p, kind in mounts
|
||||||
|
)
|
||||||
|
if automount_at_root and not backing_mount_at_root:
|
||||||
|
raise SystemExit("Media storage is not mounted; refusing to start")
|
||||||
|
covering = [
|
||||||
|
(p, kind) for p, kind in mounts
|
||||||
|
if kind != "autofs" and (root == p or root.is_relative_to(p))
|
||||||
|
]
|
||||||
if covering:
|
if covering:
|
||||||
selected = max(covering, key=lambda entry: len(entry[0].parts))
|
selected = max(covering, key=lambda entry: len(entry[0].parts))
|
||||||
if selected[1] not in local_filesystems:
|
if selected[1] not in local_filesystems:
|
||||||
raise SystemExit("Media storage is not on a local filesystem; refusing to start")
|
raise SystemExit("Media storage is not on a local filesystem; refusing to start")
|
||||||
for mount, kind in mounts:
|
for mount, kind in mounts:
|
||||||
|
if mount == root and kind == "autofs":
|
||||||
|
continue
|
||||||
if mount.is_relative_to(root) and kind not in local_filesystems:
|
if mount.is_relative_to(root) and kind not in local_filesystems:
|
||||||
raise SystemExit("Non-local mount beneath media storage; refusing to start")
|
raise SystemExit("Non-local mount beneath media storage; refusing to start")
|
||||||
sync_roots = []
|
sync_roots = []
|
||||||
|
|||||||
384
ansible/roles/desktop_ai_media/files/preset.py
Normal file
384
ansible/roles/desktop_ai_media/files/preset.py
Normal file
@@ -0,0 +1,384 @@
|
|||||||
|
"""Small host-side orchestrator for offline ai-media presets."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
from datetime import datetime
|
||||||
|
import ipaddress
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from urllib.parse import urlsplit
|
||||||
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
|
NAME = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]*\Z")
|
||||||
|
SOURCE_NAMES = tuple(f"source{number}.jpg" for number in range(11, 19))
|
||||||
|
|
||||||
|
|
||||||
|
def video_url(value):
|
||||||
|
parsed = urlsplit(value)
|
||||||
|
if parsed.scheme not in ("http", "https") or not parsed.hostname or parsed.username or parsed.password:
|
||||||
|
raise ValueError("Use an HTTP(S) video URL without embedded credentials")
|
||||||
|
host = parsed.hostname.lower().rstrip(".")
|
||||||
|
if host == "localhost" or host.endswith(".localhost"):
|
||||||
|
raise ValueError("Local URLs are not accepted")
|
||||||
|
try:
|
||||||
|
address = ipaddress.ip_address(host)
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if not address.is_global:
|
||||||
|
raise ValueError("Private or local IP URLs are not accepted")
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
def media_file(root, name, *, video=False):
|
||||||
|
if not NAME.fullmatch(name) or name in (".", ".."):
|
||||||
|
raise ValueError("Use a simple filename in the ai-media input directory")
|
||||||
|
path = root / "input" / name
|
||||||
|
if not path.is_file() or path.is_symlink():
|
||||||
|
raise FileNotFoundError(path)
|
||||||
|
if video and path.suffix.lower() != ".mp4":
|
||||||
|
raise ValueError("The video must be an MP4 file")
|
||||||
|
return path
|
||||||
|
|
||||||
|
|
||||||
|
def audio_file(root, name):
|
||||||
|
if not name or any(not NAME.fullmatch(part) or part in (".", "..")
|
||||||
|
for part in name.split("/")):
|
||||||
|
raise ValueError("Use an audio path relative to input/ or output/ without traversal")
|
||||||
|
matches = [root / directory / name for directory in ("input", "output")]
|
||||||
|
matches = [path for path in matches if path.is_file() and path.resolve() == path]
|
||||||
|
if len(matches) != 1:
|
||||||
|
raise ValueError("Audio must exist in exactly one of input/ or output/")
|
||||||
|
return matches[0]
|
||||||
|
|
||||||
|
|
||||||
|
def container_path(root, path):
|
||||||
|
directory = path.relative_to(root).parts[0]
|
||||||
|
if directory not in ("input", "output"):
|
||||||
|
raise ValueError("Media path outside input/output")
|
||||||
|
return "/work/" + str(path.relative_to(root))
|
||||||
|
|
||||||
|
|
||||||
|
def run(*command):
|
||||||
|
print("+", " ".join(map(str, command)), flush=True)
|
||||||
|
subprocess.run([str(part) for part in command], check=True)
|
||||||
|
|
||||||
|
|
||||||
|
def has_stream(path, kind):
|
||||||
|
result = subprocess.run([
|
||||||
|
"ffprobe", "-v", "error", "-show_entries", "stream=codec_type",
|
||||||
|
"-of", "json", str(path),
|
||||||
|
], check=True, capture_output=True, text=True)
|
||||||
|
return kind in [stream["codec_type"] for stream in json.loads(result.stdout)["streams"]]
|
||||||
|
|
||||||
|
|
||||||
|
def probe(path, kind):
|
||||||
|
if not has_stream(path, kind):
|
||||||
|
raise RuntimeError(f"Missing {kind} stream: {path}")
|
||||||
|
|
||||||
|
|
||||||
|
def duration(path):
|
||||||
|
result = subprocess.run([
|
||||||
|
"ffprobe", "-v", "error", "-show_entries", "format=duration",
|
||||||
|
"-of", "default=noprint_wrappers=1:nokey=1", str(path),
|
||||||
|
], check=True, capture_output=True, text=True)
|
||||||
|
return float(result.stdout.strip())
|
||||||
|
|
||||||
|
|
||||||
|
def output_path(root, video, suffix, extension="mp4"):
|
||||||
|
return root / "output" / f"{video.stem}-{suffix}.{extension}"
|
||||||
|
|
||||||
|
|
||||||
|
def mix_target(root, args):
|
||||||
|
name = args.output or f"{Path(args.vocals).stem}-mix.wav"
|
||||||
|
return wav_target(root, name)
|
||||||
|
|
||||||
|
|
||||||
|
def wav_target(root, name):
|
||||||
|
if not NAME.fullmatch(name) or Path(name).suffix.lower() != ".wav":
|
||||||
|
raise ValueError("Use a simple WAV output filename")
|
||||||
|
target = root / "output" / name
|
||||||
|
if target.exists() or target.is_symlink():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process_voice(args, root, launcher):
|
||||||
|
source = audio_file(root, args.audio)
|
||||||
|
probe(source, "audio")
|
||||||
|
target = wav_target(root, args.output or f"{source.stem}-mia_voce.wav")
|
||||||
|
job = root / "output" / f".{source.stem}-voice-convert-{args.job_id}"
|
||||||
|
job.mkdir(mode=0o700)
|
||||||
|
print("Working directory:", job, flush=True)
|
||||||
|
prepared = job / "audio.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, source), "-map", "0:a:0", "-vn",
|
||||||
|
"-c:a", "pcm_s16le", container_path(root, prepared))
|
||||||
|
run(launcher, "rvc", "cli", container_path(root, prepared),
|
||||||
|
container_path(root, job), "--convert-only")
|
||||||
|
converted = job / "vocals-mia_voce.wav"
|
||||||
|
probe(converted, "audio")
|
||||||
|
os.link(converted, target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process_mix(args, root, launcher):
|
||||||
|
vocals = audio_file(root, args.vocals)
|
||||||
|
instrumental = audio_file(root, args.instrumental)
|
||||||
|
target = mix_target(root, args)
|
||||||
|
for source in (vocals, instrumental):
|
||||||
|
probe(source, "audio")
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, vocals), "-i", container_path(root, instrumental),
|
||||||
|
"-filter_complex", "[0:a][1:a]amix=inputs=2:duration=longest:normalize=0[a]",
|
||||||
|
"-map", "[a]", "-c:a", "pcm_s16le", container_path(root, target))
|
||||||
|
probe(target, "audio")
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def mux(launcher, root, video, audio, target):
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-i", container_path(root, audio),
|
||||||
|
"-map", "0:v:0", "-map", "1:a:0", "-c:v", "copy", "-c:a", "aac",
|
||||||
|
"-b:a", "192k", "-shortest", "-movflags", "+faststart",
|
||||||
|
container_path(root, target))
|
||||||
|
probe(target, "video")
|
||||||
|
probe(target, "audio")
|
||||||
|
|
||||||
|
|
||||||
|
def download_video(root, url, job_id):
|
||||||
|
video_url(url)
|
||||||
|
if not job_id or not NAME.fullmatch(job_id):
|
||||||
|
raise ValueError("Invalid job ID")
|
||||||
|
if shutil.which("yt-dlp") is None:
|
||||||
|
raise RuntimeError("yt-dlp is required for URL downloads")
|
||||||
|
prefix = f"download-{job_id}"
|
||||||
|
destination = root / "input" / f"{prefix}.mp4"
|
||||||
|
if list((root / "input").glob(prefix + ".*")):
|
||||||
|
raise FileExistsError(destination)
|
||||||
|
print("Downloading one video into input/ with yt-dlp", flush=True)
|
||||||
|
subprocess.run([
|
||||||
|
"yt-dlp", "--ignore-config", "--no-playlist", "--no-overwrites",
|
||||||
|
"--no-progress", "-t", "mp4", "--recode-video", "mp4",
|
||||||
|
"--output", str(root / "input" / f"{prefix}.%(ext)s"), url,
|
||||||
|
], check=True)
|
||||||
|
if not destination.is_file() or destination.is_symlink():
|
||||||
|
raise RuntimeError("yt-dlp did not produce the expected MP4 in input/")
|
||||||
|
probe(destination, "video")
|
||||||
|
return destination
|
||||||
|
|
||||||
|
|
||||||
|
def process_split(args, root, launcher, video):
|
||||||
|
probe(video, "audio")
|
||||||
|
target = root / "output" / f"{video.stem}-{args.preset}"
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
job = root / "output" / f".{video.stem}-{args.preset}-{args.job_id}"
|
||||||
|
job.mkdir(mode=0o700)
|
||||||
|
print("Working directory:", job, flush=True)
|
||||||
|
silent = job / "video.mp4"
|
||||||
|
audio = job / "audio.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-map", "0:v:0", "-c:v", "copy",
|
||||||
|
"-an", "-movflags", "+faststart", container_path(root, silent))
|
||||||
|
probe(silent, "video")
|
||||||
|
if has_stream(silent, "audio"):
|
||||||
|
raise RuntimeError("Unexpected audio stream in split video")
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-map", "0:a:0", "-vn",
|
||||||
|
"-c:a", "pcm_s16le", container_path(root, audio))
|
||||||
|
probe(audio, "audio")
|
||||||
|
files = {"video.mp4": silent, "audio.wav": audio}
|
||||||
|
if args.preset == "split-stems":
|
||||||
|
run(launcher, "rvc", "cli", container_path(root, audio),
|
||||||
|
container_path(root, job), "--separate-only")
|
||||||
|
for stem in ("vocals", "instrumental"):
|
||||||
|
matches = list((job / stem).glob("*.wav"))
|
||||||
|
if len(matches) != 1:
|
||||||
|
raise RuntimeError(f"Expected exactly one {stem} stem")
|
||||||
|
probe(matches[0], "audio")
|
||||||
|
files[f"{stem}.wav"] = matches[0]
|
||||||
|
# Publish only after every processing step and stream check succeeded.
|
||||||
|
target.mkdir(mode=0o700)
|
||||||
|
for name, source in files.items():
|
||||||
|
os.link(source, target / name)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process(args, root, launcher):
|
||||||
|
video = media_file(root, args.video, video=True)
|
||||||
|
probe(video, "video")
|
||||||
|
if args.preset in ("split", "split-stems"):
|
||||||
|
return process_split(args, root, launcher, video)
|
||||||
|
if args.preset == "merge":
|
||||||
|
audio = audio_file(root, args.audio)
|
||||||
|
probe(audio, "audio")
|
||||||
|
target = output_path(root, video, "unito")
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
mux(launcher, root, video, audio, target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
suffix = "mia_voce" if args.preset == "audio-convert" else "facefusion"
|
||||||
|
target = output_path(root, video, suffix, "wav" if args.preset == "audio-convert" else "mp4")
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
job = root / "output" / f".{video.stem}-{suffix}-{args.job_id}"
|
||||||
|
job.mkdir(mode=0o700)
|
||||||
|
print("Working directory:", job, flush=True)
|
||||||
|
if args.preset == "audio-convert":
|
||||||
|
probe(video, "audio")
|
||||||
|
extracted = job / "audio.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, video), "-vn", "-c:a", "pcm_s16le",
|
||||||
|
container_path(root, extracted))
|
||||||
|
run(launcher, "rvc", "cli", container_path(root, extracted), container_path(root, job))
|
||||||
|
instrumental = list((job / "instrumental").glob("*.wav"))
|
||||||
|
if len(instrumental) != 1:
|
||||||
|
raise RuntimeError("Expected exactly one instrumental stem")
|
||||||
|
converted = job / "vocals-mia_voce.wav"
|
||||||
|
probe(converted, "audio")
|
||||||
|
mixed = job / "mix.wav"
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, instrumental[0]),
|
||||||
|
"-i", container_path(root, converted),
|
||||||
|
"-filter_complex", "[0:a][1:a]amix=inputs=2:duration=longest:normalize=0[a]",
|
||||||
|
"-map", "[a]", "-c:a", "pcm_s16le", container_path(root, mixed))
|
||||||
|
probe(mixed, "audio")
|
||||||
|
os.link(mixed, target)
|
||||||
|
else:
|
||||||
|
original_has_audio = has_stream(video, "audio")
|
||||||
|
sources = [media_file(root, name) for name in SOURCE_NAMES]
|
||||||
|
processed = job / "swapped.mp4"
|
||||||
|
run(launcher, "facefusion", "cli", "headless-run",
|
||||||
|
"--source-paths", *[container_path(root, path) for path in sources],
|
||||||
|
"--target-path", container_path(root, video),
|
||||||
|
"--output-path", container_path(root, processed),
|
||||||
|
"--processors", "face_swapper", "--face-swapper-model", "hyperswap_1a_256",
|
||||||
|
"--face-swapper-pixel-boost", "256x256", "--face-swapper-weight", "0.5",
|
||||||
|
"--face-detector-model", "yolo_face", "--face-detector-size", "640x640",
|
||||||
|
"--face-detector-angles", "0", "90", "180", "270",
|
||||||
|
"--face-detector-score", "0.5", "--face-selector-mode", "one",
|
||||||
|
"--face-selector-order", "large-small", "--face-selector-gender", "female",
|
||||||
|
"--face-selector-race", "white",
|
||||||
|
"--face-mask-types", "occlusion", "region", "area", "box",
|
||||||
|
"--face-occluder-model", "xseg_1",
|
||||||
|
"--face-parser-model", "bisenet_resnet_34", "--face-mask-blur", "0.3",
|
||||||
|
"--output-video-encoder", "libx264", "--output-video-preset", "veryfast",
|
||||||
|
"--output-video-quality", "80", "--output-video-fps", "30",
|
||||||
|
"--execution-providers", "cpu", "--output-audio-encoder", "aac",
|
||||||
|
"--jobs-path", "/work/state", "--temp-path", "/work/state/tmp")
|
||||||
|
probe(processed, "video")
|
||||||
|
if abs(duration(processed) - duration(video)) > 0.5:
|
||||||
|
raise RuntimeError("FaceFusion output duration differs from the input; refusing a partial result")
|
||||||
|
if original_has_audio:
|
||||||
|
# Restore the original soundtrack explicitly. Some completed
|
||||||
|
# FaceFusion jobs have produced video-only MP4 files.
|
||||||
|
mux(launcher, root, processed, video, target)
|
||||||
|
else:
|
||||||
|
run(launcher, "ffmpeg", "-hide_banner", "-loglevel", "error", "-n",
|
||||||
|
"-i", container_path(root, processed), "-map", "0:v:0",
|
||||||
|
"-c:v", "copy", "-an", "-movflags", "+faststart",
|
||||||
|
container_path(root, target))
|
||||||
|
probe(target, "video")
|
||||||
|
if has_stream(target, "audio"):
|
||||||
|
raise RuntimeError("Unexpected audio stream in silent FaceFusion output")
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def process_complete(args, root, launcher):
|
||||||
|
video = media_file(root, args.video, video=True)
|
||||||
|
if not has_stream(video, "audio"):
|
||||||
|
raise RuntimeError("The video has no audio to convert")
|
||||||
|
common = {"video": video.name, "job_id": args.job_id}
|
||||||
|
audio = process(argparse.Namespace(preset="audio-convert", **common), root, launcher)
|
||||||
|
swapped = process(argparse.Namespace(preset="video-convert", **common), root, launcher)
|
||||||
|
target = output_path(root, video, "completo")
|
||||||
|
if target.exists():
|
||||||
|
raise FileExistsError(target)
|
||||||
|
mux(launcher, root, swapped, audio, target)
|
||||||
|
return target
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser(prog="ai-media preset")
|
||||||
|
parser.add_argument("root", type=Path, help=argparse.SUPPRESS)
|
||||||
|
parser.add_argument("launcher", type=Path, help=argparse.SUPPRESS)
|
||||||
|
parser.add_argument("--run", action="store_true", help=argparse.SUPPRESS)
|
||||||
|
parser.add_argument("--job-id", help=argparse.SUPPRESS)
|
||||||
|
sub = parser.add_subparsers(dest="preset", required=True)
|
||||||
|
for name in ("audio-convert", "video-convert", "merge", "split", "split-stems", "convert"):
|
||||||
|
command = sub.add_parser(name)
|
||||||
|
command.add_argument("video", help="MP4 filename inside input/ or HTTP(S) video URL")
|
||||||
|
if name == "merge":
|
||||||
|
command.add_argument("audio", help="unique audio filename in input/ or output/")
|
||||||
|
mix = sub.add_parser("mix", help="mix vocal and instrumental audio into one WAV")
|
||||||
|
mix.add_argument("vocals", help="vocal audio path relative to input/ or output/")
|
||||||
|
mix.add_argument("instrumental", help="instrumental audio path relative to input/ or output/")
|
||||||
|
mix.add_argument("--output", help="WAV filename in output/ (default: <vocals>-mix.wav)")
|
||||||
|
voice = sub.add_parser("voice-convert", help="apply mia_voce directly to an audio file")
|
||||||
|
voice.add_argument("audio", help="audio path relative to input/ or output/")
|
||||||
|
voice.add_argument("--output", help="WAV filename in output/ (default: <audio>-mia_voce.wav)")
|
||||||
|
args = parser.parse_args()
|
||||||
|
root = args.root.resolve(strict=True)
|
||||||
|
launcher = args.launcher.resolve(strict=True)
|
||||||
|
audio_only = args.preset in ("mix", "voice-convert")
|
||||||
|
remote_video = not audio_only and not NAME.fullmatch(args.video)
|
||||||
|
if args.preset == "voice-convert":
|
||||||
|
source = audio_file(root, args.audio)
|
||||||
|
wav_target(root, args.output or f"{source.stem}-mia_voce.wav")
|
||||||
|
preset_inputs = [args.audio]
|
||||||
|
if args.output:
|
||||||
|
preset_inputs += ["--output", args.output]
|
||||||
|
elif args.preset == "mix":
|
||||||
|
audio_file(root, args.vocals)
|
||||||
|
audio_file(root, args.instrumental)
|
||||||
|
mix_target(root, args)
|
||||||
|
preset_inputs = [args.vocals, args.instrumental]
|
||||||
|
if args.output:
|
||||||
|
preset_inputs += ["--output", args.output]
|
||||||
|
elif remote_video:
|
||||||
|
video_url(args.video)
|
||||||
|
if shutil.which("yt-dlp") is None:
|
||||||
|
raise RuntimeError("yt-dlp is required for URL downloads")
|
||||||
|
else:
|
||||||
|
media_file(root, args.video, video=True)
|
||||||
|
if not audio_only:
|
||||||
|
preset_inputs = [args.video] + ([args.audio] if args.preset == "merge" else [])
|
||||||
|
if args.preset == "merge":
|
||||||
|
audio_file(root, args.audio)
|
||||||
|
if args.preset in ("video-convert", "convert"):
|
||||||
|
for name in SOURCE_NAMES:
|
||||||
|
media_file(root, name)
|
||||||
|
if args.run:
|
||||||
|
if remote_video:
|
||||||
|
args.video = download_video(root, args.video, args.job_id).name
|
||||||
|
if args.preset == "voice-convert":
|
||||||
|
result = process_voice(args, root, launcher)
|
||||||
|
elif args.preset == "mix":
|
||||||
|
result = process_mix(args, root, launcher)
|
||||||
|
else:
|
||||||
|
result = (process_complete(args, root, launcher)
|
||||||
|
if args.preset == "convert" else process(args, root, launcher))
|
||||||
|
print("Completed:", result, flush=True)
|
||||||
|
return
|
||||||
|
unit = "ai-media-preset-" + datetime.now().strftime("%Y%m%d-%H%M%S") + "-" + uuid.uuid4().hex[:8]
|
||||||
|
subprocess.run(["systemd-run", "--user", "--collect", f"--unit={unit}",
|
||||||
|
"--property=Type=exec", "--property=Restart=no",
|
||||||
|
"/usr/bin/python3", str(Path(__file__).resolve()), str(root), str(launcher),
|
||||||
|
"--run", "--job-id", unit, args.preset,
|
||||||
|
*preset_inputs], check=True)
|
||||||
|
print("Job:", unit)
|
||||||
|
print("Logs: journalctl --user -fu", unit)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
try:
|
||||||
|
main()
|
||||||
|
except (ValueError, FileNotFoundError, FileExistsError, subprocess.CalledProcessError) as error:
|
||||||
|
raise SystemExit(str(error)) from error
|
||||||
94
ansible/roles/desktop_ai_media/files/preset_rvc.py
Normal file
94
ansible/roles/desktop_ai_media/files/preset_rvc.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
"""Offline RVC worker for the voice preset (runs inside the RVC container)."""
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument("input_wav", type=Path)
|
||||||
|
parser.add_argument("job_dir", type=Path)
|
||||||
|
mode = parser.add_mutually_exclusive_group()
|
||||||
|
mode.add_argument("--separate-only", action="store_true")
|
||||||
|
mode.add_argument("--convert-only", action="store_true")
|
||||||
|
args = parser.parse_args()
|
||||||
|
source = args.input_wav.resolve(strict=True)
|
||||||
|
job = args.job_dir.resolve(strict=True)
|
||||||
|
output = Path("/work/output").resolve(strict=True)
|
||||||
|
if not source.is_relative_to(output) or not job.is_relative_to(output):
|
||||||
|
raise ValueError("RVC preset paths must be inside /work/output")
|
||||||
|
if source.parent != job or not source.is_file():
|
||||||
|
raise ValueError("Expected the extracted WAV inside the job directory")
|
||||||
|
|
||||||
|
weights = Path("/work/state/weights/mia_voce.pth")
|
||||||
|
index = Path("/work/state/mia_voce/added_IVF256_Flat_nprobe_1_mia_voce_v2.index")
|
||||||
|
if not args.separate_only and not weights.is_file():
|
||||||
|
raise FileNotFoundError(weights)
|
||||||
|
if not args.separate_only and not index.is_file():
|
||||||
|
raise FileNotFoundError(index)
|
||||||
|
os.environ.update(
|
||||||
|
weight_root="/work/state/weights",
|
||||||
|
outside_index_root="/work/models/indices",
|
||||||
|
index_root="/work/state",
|
||||||
|
weight_pymss_root="/opt/app/assets/pymss_weights",
|
||||||
|
rmvpe_root="/opt/app/assets/rmvpe",
|
||||||
|
OMP_NUM_THREADS="4",
|
||||||
|
MKL_NUM_THREADS="4",
|
||||||
|
)
|
||||||
|
|
||||||
|
# The pinned WebUI imports its own argparse configuration at module load.
|
||||||
|
sys.argv = sys.argv[:1]
|
||||||
|
vocal_source = source
|
||||||
|
if not args.convert_only:
|
||||||
|
from tools.pymss_webui import pymss_separate
|
||||||
|
|
||||||
|
vocals_dir = job / "vocals"
|
||||||
|
instrumental_dir = job / "instrumental"
|
||||||
|
vocals_dir.mkdir()
|
||||||
|
instrumental_dir.mkdir()
|
||||||
|
failures = []
|
||||||
|
|
||||||
|
def on_event(event):
|
||||||
|
if event.get("event") in ("fatal", "cancelled", "busy"):
|
||||||
|
failures.append(event.get("message", str(event)))
|
||||||
|
|
||||||
|
for progress in pymss_separate(
|
||||||
|
"vocals-bs-roformer-368", str(source), str(vocals_dir), None,
|
||||||
|
str(instrumental_dir), "wav", event_callback=on_event,
|
||||||
|
):
|
||||||
|
print(progress, flush=True)
|
||||||
|
if failures:
|
||||||
|
raise RuntimeError("RVC separation failed: " + "; ".join(failures))
|
||||||
|
vocals = list(vocals_dir.glob("*.wav"))
|
||||||
|
instrumental = list(instrumental_dir.glob("*.wav"))
|
||||||
|
if len(vocals) != 1 or len(instrumental) != 1:
|
||||||
|
raise RuntimeError("RVC did not produce exactly one vocal and instrumental stem")
|
||||||
|
|
||||||
|
if args.separate_only:
|
||||||
|
print("Vocal and instrumental stems ready (no voice conversion)", flush=True)
|
||||||
|
return
|
||||||
|
|
||||||
|
vocal_source = vocals[0]
|
||||||
|
|
||||||
|
from configs.config import Config
|
||||||
|
from infer.vc.modules import VC
|
||||||
|
import soundfile as sf
|
||||||
|
|
||||||
|
voice = VC(Config())
|
||||||
|
voice.get_vc(weights.name)
|
||||||
|
status, result = voice.vc_single(
|
||||||
|
0, str(vocal_source), 0, "rmvpe", str(index), 0.75, 0, 1, 0.33,
|
||||||
|
)
|
||||||
|
if result is None or result[0] is None or result[1] is None:
|
||||||
|
raise RuntimeError("RVC voice conversion failed: " + str(status))
|
||||||
|
converted = job / "vocals-mia_voce.wav"
|
||||||
|
sf.write(converted, result[1], result[0])
|
||||||
|
if converted.stat().st_size == 0:
|
||||||
|
raise RuntimeError("RVC produced an empty converted voice")
|
||||||
|
print("RVC converted voice ready", flush=True)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
4
ansible/roles/desktop_ai_media/handlers/main.yml
Normal file
4
ansible/roles/desktop_ai_media/handlers/main.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
- name: Reload systemd units
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
daemon_reload: true
|
||||||
@@ -1,7 +1,116 @@
|
|||||||
---
|
---
|
||||||
|
- name: Configure on-demand external ai-media storage
|
||||||
|
become: true
|
||||||
|
when: desktop_ai_media_external_storage_enabled | bool
|
||||||
|
tags: [ai_media, ai_media_storage]
|
||||||
|
block:
|
||||||
|
- name: Validate external ai-media storage paths
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- desktop_ai_media_external_mountpoint is match('^/run/media/[^/]+/[^/]+$')
|
||||||
|
- >-
|
||||||
|
not desktop_ai_media_external_luks_uuid or
|
||||||
|
desktop_ai_media_external_luks_uuid is match('^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$')
|
||||||
|
- desktop_ai_media_external_source.startswith(desktop_ai_media_external_mountpoint + '/')
|
||||||
|
- desktop_ai_media_external_source != desktop_ai_media_external_mountpoint
|
||||||
|
- desktop_ai_media_root.startswith(user_home + '/')
|
||||||
|
- desktop_ai_media_root != user_home
|
||||||
|
|
||||||
|
- name: Derive external source mount unit name
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- systemd-escape
|
||||||
|
- -p
|
||||||
|
- --suffix=mount
|
||||||
|
- "{{ desktop_ai_media_external_mountpoint }}"
|
||||||
|
register: desktop_ai_media_external_source_mount_unit
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Derive ai-media bind mount unit name
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- systemd-escape
|
||||||
|
- -p
|
||||||
|
- --suffix=mount
|
||||||
|
- "{{ desktop_ai_media_root }}"
|
||||||
|
register: desktop_ai_media_bind_mount_unit
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Derive ai-media bind automount unit name
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- systemd-escape
|
||||||
|
- -p
|
||||||
|
- --suffix=automount
|
||||||
|
- "{{ desktop_ai_media_root }}"
|
||||||
|
register: desktop_ai_media_bind_automount_unit
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Create ai-media mount destination in the user home
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ desktop_ai_media_root }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ username }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Install ai-media bind mount unit
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: ai-media-bind.mount.j2
|
||||||
|
dest: "/etc/systemd/system/{{ desktop_ai_media_bind_mount_unit.stdout }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify: Reload systemd units
|
||||||
|
|
||||||
|
- name: Install ai-media bind automount unit
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: ai-media-bind.automount.j2
|
||||||
|
dest: "/etc/systemd/system/{{ desktop_ai_media_bind_automount_unit.stdout }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify: Reload systemd units
|
||||||
|
|
||||||
|
- name: Install ai-media bind automount failure restarter
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: ai-media-bind-restarter.service.j2
|
||||||
|
dest: /etc/systemd/system/ai-media-bind-restarter.service
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
notify: Reload systemd units
|
||||||
|
|
||||||
|
- name: Flush systemd unit changes
|
||||||
|
ansible.builtin.meta: flush_handlers
|
||||||
|
|
||||||
|
- name: Stop a stale ai-media bind mount when the Backup source is absent
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: "{{ desktop_ai_media_bind_mount_unit.stdout }}"
|
||||||
|
state: stopped
|
||||||
|
when:
|
||||||
|
- desktop_ai_media_root in (ansible_facts['mounts'] | default([]) | selectattr('fstype', 'ne', 'autofs') | map(attribute='mount') | list)
|
||||||
|
- desktop_ai_media_external_mountpoint not in (ansible_facts['mounts'] | default([]) | map(attribute='mount') | list)
|
||||||
|
|
||||||
|
- name: Enable and start ai-media bind automount
|
||||||
|
ansible.builtin.systemd_service:
|
||||||
|
name: "{{ desktop_ai_media_bind_automount_unit.stdout }}"
|
||||||
|
enabled: true
|
||||||
|
state: started
|
||||||
|
|
||||||
- name: Configure isolated desktop media tools as the desktop user
|
- name: Configure isolated desktop media tools as the desktop user
|
||||||
become: false
|
become: false
|
||||||
block:
|
block:
|
||||||
|
- name: Determine whether the ai-media storage source is currently available
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
desktop_ai_media_external_available: >-
|
||||||
|
{{ (not (desktop_ai_media_external_storage_enabled | bool)) or
|
||||||
|
(desktop_ai_media_external_mountpoint in
|
||||||
|
(ansible_facts['mounts'] | default([]) | map(attribute='mount') | list)) }}
|
||||||
|
|
||||||
- name: Load pinned public model manifest
|
- name: Load pinned public model manifest
|
||||||
ansible.builtin.include_vars: models.yml
|
ansible.builtin.include_vars: models.yml
|
||||||
|
|
||||||
@@ -49,8 +158,15 @@
|
|||||||
stdin: "{{ lookup('ansible.builtin.file', role_path + '/files/check_storage.py') }}"
|
stdin: "{{ lookup('ansible.builtin.file', role_path + '/files/check_storage.py') }}"
|
||||||
changed_when: false
|
changed_when: false
|
||||||
check_mode: false
|
check_mode: false
|
||||||
|
when: desktop_ai_media_external_available | bool
|
||||||
|
|
||||||
- name: Create private application and media directories
|
- name: Create the data-free local build context
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ desktop_ai_media_build_root }}"
|
||||||
|
state: directory
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Create private application and media directories on mounted media storage
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ item }}"
|
path: "{{ item }}"
|
||||||
state: directory
|
state: directory
|
||||||
@@ -66,7 +182,7 @@
|
|||||||
- "{{ desktop_ai_media_root }}/state"
|
- "{{ desktop_ai_media_root }}/state"
|
||||||
- "{{ desktop_ai_media_root }}/state/facefusion"
|
- "{{ desktop_ai_media_root }}/state/facefusion"
|
||||||
- "{{ desktop_ai_media_root }}/state/rvc"
|
- "{{ desktop_ai_media_root }}/state/rvc"
|
||||||
- "{{ desktop_ai_media_build_root }}"
|
when: desktop_ai_media_external_available | bool
|
||||||
|
|
||||||
- name: Ensure user launcher directories exist without changing existing permissions
|
- name: Ensure user launcher directories exist without changing existing permissions
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@@ -84,6 +200,14 @@
|
|||||||
loop: [session.py, prepare.py, verify.py, check_storage.py]
|
loop: [session.py, prepare.py, verify.py, check_storage.py]
|
||||||
register: desktop_ai_media_support
|
register: desktop_ai_media_support
|
||||||
|
|
||||||
|
- name: Install host-side offline preset workers without rebuilding images
|
||||||
|
tags: [ai_media_presets]
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ item }}"
|
||||||
|
dest: "{{ desktop_ai_media_build_root }}/{{ item }}"
|
||||||
|
mode: "0644"
|
||||||
|
loop: [preset.py, preset_rvc.py]
|
||||||
|
|
||||||
- name: Create public model cache directories
|
- name: Create public model cache directories
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ desktop_ai_media_build_root }}/models/{{ item.app }}/{{ item.path | dirname }}"
|
path: "{{ desktop_ai_media_build_root }}/models/{{ item.app }}/{{ item.path | dirname }}"
|
||||||
@@ -198,10 +322,12 @@
|
|||||||
timeout: 3600
|
timeout: 3600
|
||||||
|
|
||||||
- name: Install offline launcher
|
- name: Install offline launcher
|
||||||
|
tags: [ai_media_launcher]
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: ai-media.j2
|
src: ai-media.j2
|
||||||
dest: "{{ user_home }}/.local/bin/ai-media"
|
dest: "{{ user_home }}/.local/bin/ai-media"
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
validate: /usr/bin/bash -n %s
|
||||||
|
|
||||||
- name: Install manual offline desktop entries
|
- name: Install manual offline desktop entries
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
|
|||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Recover the ai-media bind automount after an unavailable Backup volume
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStartPre=/usr/bin/sleep 3
|
||||||
|
ExecStart=/usr/bin/bash -c '/usr/bin/systemctl restart "$(/usr/bin/systemd-escape -p --suffix=automount {{ desktop_ai_media_root }})"'
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=On-demand ai-media bind mount from the Backup LUKS volume
|
||||||
|
ConditionPathIsDirectory={{ desktop_ai_media_root }}
|
||||||
|
OnFailure=ai-media-bind-restarter.service
|
||||||
|
|
||||||
|
[Automount]
|
||||||
|
Where={{ desktop_ai_media_root }}
|
||||||
|
TimeoutIdleSec=5min
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Bind mount ai-media from the Backup LUKS volume
|
||||||
|
RequiresMountsFor={{ desktop_ai_media_external_mountpoint }}
|
||||||
|
After={{ desktop_ai_media_external_source_mount_unit.stdout }}
|
||||||
|
BindsTo={{ desktop_ai_media_external_source_mount_unit.stdout }}
|
||||||
|
ConditionPathIsMountPoint={{ desktop_ai_media_external_mountpoint }}
|
||||||
|
ConditionPathIsDirectory={{ desktop_ai_media_external_source }}
|
||||||
|
|
||||||
|
[Mount]
|
||||||
|
What={{ desktop_ai_media_external_source }}
|
||||||
|
Where={{ desktop_ai_media_root }}
|
||||||
|
Options=bind
|
||||||
@@ -1,10 +1,111 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
root={{ desktop_ai_media_root | quote }}
|
root={{ desktop_ai_media_root | quote }}
|
||||||
|
build_root={{ desktop_ai_media_build_root | quote }}
|
||||||
|
{% set manage_luks = desktop_ai_media_external_storage_enabled | default(false) and desktop_ai_media_external_luks_uuid | default('') %}
|
||||||
|
{% if manage_luks %}
|
||||||
|
encrypted={{ ('/dev/disk/by-uuid/' + desktop_ai_media_external_luks_uuid) | quote }}
|
||||||
|
external_mount={{ desktop_ai_media_external_mountpoint | quote }}
|
||||||
|
bind_fsroot={{ (desktop_ai_media_external_source | replace(desktop_ai_media_external_mountpoint, '', 1)) | quote }}
|
||||||
|
|
||||||
|
fail() { echo "$*" >&2; exit 1; }
|
||||||
|
|
||||||
|
read_mapper() {
|
||||||
|
local devices mapping
|
||||||
|
devices=$(lsblk -nrpo NAME,TYPE,MAJ:MIN -- "$encrypted") ||
|
||||||
|
fail "The configured LUKS volume is not available: $encrypted"
|
||||||
|
mapping=$(awk '$2 == "crypt" {print $1, $3}' <<< "$devices")
|
||||||
|
[[ "$mapping" != *$'\n'* ]] || fail "Multiple mappings for $encrypted; refusing to continue"
|
||||||
|
read -r mapper mapper_id <<< "$mapping"
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_info() {
|
||||||
|
# Inspect the kernel mount table without following the automount path.
|
||||||
|
findmnt -krnC --mountpoint "$1" --types noautofs --output MAJ:MIN,FSROOT || [[ $? == 1 ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
volume_mounts() {
|
||||||
|
[[ -n "$mapper_id" ]] || return 0
|
||||||
|
findmnt -krnC --source "$mapper_id" --output TARGET || [[ $? == 1 ]]
|
||||||
|
}
|
||||||
|
|
||||||
|
require_external_bind() {
|
||||||
|
read_mapper
|
||||||
|
[[ -n "$mapper_id" && "$(mount_info "$root")" == "$mapper_id $bind_fsroot" ]] ||
|
||||||
|
fail "Encrypted media storage is not mounted; run ai-media mount first"
|
||||||
|
}
|
||||||
|
|
||||||
|
manage_volume() {
|
||||||
|
local action=$1 mapper mapper_id bind_unit automount_unit mounted bind jobs containers
|
||||||
|
[[ $# == 1 ]] || fail "Usage: ai-media $action"
|
||||||
|
bind_unit=$(systemd-escape -p --suffix=mount -- "$root")
|
||||||
|
automount_unit=$(systemd-escape -p --suffix=automount -- "$root")
|
||||||
|
read_mapper
|
||||||
|
mounted=$(mount_info "$external_mount")
|
||||||
|
bind=$(mount_info "$root")
|
||||||
|
[[ -z "$mounted" || "$mounted" == "$mapper_id /" ]] ||
|
||||||
|
fail "Unexpected filesystem at $external_mount; refusing to continue"
|
||||||
|
[[ -z "$bind" || "$bind" == "$mapper_id $bind_fsroot" ]] ||
|
||||||
|
fail "Unexpected filesystem at $root; refusing to continue"
|
||||||
|
|
||||||
|
if [[ "$action" == mount ]]; then
|
||||||
|
if [[ -z "$mapper" ]]; then
|
||||||
|
udisksctl unlock --block-device "$encrypted"
|
||||||
|
read_mapper
|
||||||
|
[[ -n "$mapper" ]] || fail "No decrypted block device found after unlock"
|
||||||
|
fi
|
||||||
|
if [[ -z "$mounted" ]]; then
|
||||||
|
[[ -z "$(volume_mounts)" ]] || fail "The LUKS volume is already mounted elsewhere"
|
||||||
|
udisksctl mount --block-device "$mapper"
|
||||||
|
fi
|
||||||
|
[[ "$(mount_info "$external_mount")" == "$mapper_id /" ]] ||
|
||||||
|
fail "The LUKS volume is not mounted at the expected path: $external_mount"
|
||||||
|
sudo systemctl start "$automount_unit" "$bind_unit"
|
||||||
|
require_external_bind
|
||||||
|
echo "Encrypted media storage mounted at $root"
|
||||||
|
else
|
||||||
|
jobs=$(systemctl --user list-units --type=service --state=active,activating,deactivating \
|
||||||
|
--no-legend --no-pager 'ai-media-*.service')
|
||||||
|
containers=$(podman --remote=false ps -q \
|
||||||
|
--filter ancestor=localhost/ai-media-facefusion:managed \
|
||||||
|
--filter ancestor=localhost/ai-media-rvc:managed)
|
||||||
|
[[ -z "$jobs" && -z "$containers" ]] ||
|
||||||
|
fail "Stop the running ai-media jobs and applications before unmounting"
|
||||||
|
sudo systemctl stop ai-media-bind-restarter.service "$automount_unit" "$bind_unit"
|
||||||
|
[[ -z "$(mount_info "$root")" ]] || fail "The media bind mount is still in use"
|
||||||
|
mounted=$(volume_mounts)
|
||||||
|
if [[ -n "$mounted" ]]; then
|
||||||
|
[[ "$mounted" == "$external_mount" && "$(mount_info "$external_mount")" == "$mapper_id /" ]] ||
|
||||||
|
fail "The LUKS volume has other mounts; refusing to unmount or lock it"
|
||||||
|
udisksctl unmount --block-device "$mapper"
|
||||||
|
fi
|
||||||
|
if [[ -n "$mapper" ]]; then
|
||||||
|
[[ -z "$(volume_mounts)" ]] || fail "The LUKS volume is still mounted"
|
||||||
|
udisksctl lock --block-device "$encrypted"
|
||||||
|
fi
|
||||||
|
echo "Encrypted media storage unmounted and locked"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
{% endif %}
|
||||||
app="${1:-}"
|
app="${1:-}"
|
||||||
case "$app" in
|
case "$app" in
|
||||||
|
{% if manage_luks %}
|
||||||
|
mount|umount) manage_volume "$@"; exit ;;
|
||||||
|
{% endif %}
|
||||||
facefusion|rvc) shift ;;
|
facefusion|rvc) shift ;;
|
||||||
ffmpeg) app=facefusion; shift; set -- ffmpeg "$@" ;;
|
ffmpeg) app=facefusion; shift; set -- ffmpeg "$@" ;;
|
||||||
|
preset)
|
||||||
|
shift
|
||||||
|
for path in "$root" "$root/input" "$root/output"; do
|
||||||
|
[[ -d "$path" && "$(realpath -- "$path")" == "$path" ]] || {
|
||||||
|
echo "Unsafe or missing media directory: $path" >&2; exit 1;
|
||||||
|
}
|
||||||
|
done
|
||||||
|
{% if manage_luks %}
|
||||||
|
require_external_bind
|
||||||
|
{% endif %}
|
||||||
|
python3 "$build_root/check_storage.py" "$root"
|
||||||
|
exec python3 "$build_root/preset.py" "$root" "$(realpath -- "$0")" "$@" ;;
|
||||||
verify)
|
verify)
|
||||||
for tool in facefusion rvc; do
|
for tool in facefusion rvc; do
|
||||||
podman --remote=false run --rm --pull=never --network=none --read-only \
|
podman --remote=false run --rm --pull=never --network=none --read-only \
|
||||||
@@ -17,7 +118,7 @@ case "$app" in
|
|||||||
"localhost/ai-media-$tool:managed" verify
|
"localhost/ai-media-$tool:managed" verify
|
||||||
done
|
done
|
||||||
exit 0 ;;
|
exit 0 ;;
|
||||||
*) echo "Usage: ai-media {facefusion|rvc|ffmpeg|verify} [cli ...]" >&2; exit 2 ;;
|
*) echo "Usage: ai-media {facefusion|rvc|ffmpeg|preset|verify{% if manage_luks %}|mount|umount{% endif %}} [args ...]" >&2; exit 2 ;;
|
||||||
esac
|
esac
|
||||||
# Fail closed if an existing data path was replaced by a symlink.
|
# Fail closed if an existing data path was replaced by a symlink.
|
||||||
for path in "$root" "$root/input" "$root/output" "$root/models" "$root/state/$app"; do
|
for path in "$root" "$root/input" "$root/output" "$root/models" "$root/state/$app"; do
|
||||||
@@ -25,6 +126,9 @@ for path in "$root" "$root/input" "$root/output" "$root/models" "$root/state/$ap
|
|||||||
echo "Unsafe or missing media directory: $path" >&2; exit 1;
|
echo "Unsafe or missing media directory: $path" >&2; exit 1;
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
{% if manage_luks %}
|
||||||
|
require_external_bind
|
||||||
|
{% endif %}
|
||||||
python3 {{ (desktop_ai_media_build_root + "/check_storage.py") | quote }} "$root"
|
python3 {{ (desktop_ai_media_build_root + "/check_storage.py") | quote }} "$root"
|
||||||
# Run interactive sessions under the user manager, not the launching terminal.
|
# Run interactive sessions under the user manager, not the launching terminal.
|
||||||
# No autostart or automatic restart: recovering a training run remains explicit.
|
# No autostart or automatic restart: recovering a training run remains explicit.
|
||||||
@@ -45,6 +149,13 @@ fi
|
|||||||
if [[ "${1:-}" == --foreground ]]; then
|
if [[ "${1:-}" == --foreground ]]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
if [[ "$app" == rvc && "${1:-}" == cli ]]; then
|
||||||
|
shift
|
||||||
|
rvc_cli=1
|
||||||
|
set -- /opt/preset_rvc.py "$@"
|
||||||
|
else
|
||||||
|
rvc_cli=0
|
||||||
|
fi
|
||||||
args=(
|
args=(
|
||||||
run --rm --pull=never --network=none --read-only --userns=keep-id --http-proxy=false
|
run --rm --pull=never --network=none --read-only --userns=keep-id --http-proxy=false
|
||||||
--cap-drop=ALL --security-opt=no-new-privileges
|
--cap-drop=ALL --security-opt=no-new-privileges
|
||||||
@@ -56,7 +167,10 @@ args=(
|
|||||||
--volume "$root/models:/work/models:ro,Z"
|
--volume "$root/models:/work/models:ro,Z"
|
||||||
--volume "$root/state/$app:/work/state:rw,Z"
|
--volume "$root/state/$app:/work/state:rw,Z"
|
||||||
)
|
)
|
||||||
if [[ "${1:-}" != cli && "${1:-}" != ffmpeg ]]; then
|
if [[ "$rvc_cli" == 1 ]]; then
|
||||||
|
args+=(--volume "$build_root/preset_rvc.py:/opt/preset_rvc.py:ro,Z" --entrypoint python)
|
||||||
|
fi
|
||||||
|
if [[ "$rvc_cli" != 1 && "${1:-}" != cli && "${1:-}" != ffmpeg ]]; then
|
||||||
: "${XDG_RUNTIME_DIR:?Run this launcher from the GNOME Wayland session}"
|
: "${XDG_RUNTIME_DIR:?Run this launcher from the GNOME Wayland session}"
|
||||||
: "${WAYLAND_DISPLAY:?A Wayland session is required}"
|
: "${WAYLAND_DISPLAY:?A Wayland session is required}"
|
||||||
[[ "$WAYLAND_DISPLAY" != */* && -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] || exit 1
|
[[ "$WAYLAND_DISPLAY" != */* && -S "$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY" ]] || exit 1
|
||||||
|
|||||||
Binary file not shown.
@@ -5,6 +5,8 @@ import socket
|
|||||||
import subprocess
|
import subprocess
|
||||||
import tempfile
|
import tempfile
|
||||||
import unittest
|
import unittest
|
||||||
|
import wave
|
||||||
|
import struct
|
||||||
|
|
||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
import shlex
|
import shlex
|
||||||
@@ -27,6 +29,8 @@ class LauncherTest(unittest.TestCase):
|
|||||||
(ROLE / 'templates/ai-media.j2').read_text()
|
(ROLE / 'templates/ai-media.j2').read_text()
|
||||||
).render(desktop_ai_media_root=str(self.media), desktop_ai_media_build_root=str(self.root)))
|
).render(desktop_ai_media_root=str(self.media), desktop_ai_media_build_root=str(self.root)))
|
||||||
(self.root / 'check_storage.py').write_text((ROLE / 'files/check_storage.py').read_text())
|
(self.root / 'check_storage.py').write_text((ROLE / 'files/check_storage.py').read_text())
|
||||||
|
for name in ('preset.py', 'preset_rvc.py'):
|
||||||
|
(self.root / name).write_text((ROLE / 'files' / name).read_text())
|
||||||
self.log = self.root / 'podman.json'
|
self.log = self.root / 'podman.json'
|
||||||
podman = self.root / 'podman'
|
podman = self.root / 'podman'
|
||||||
podman.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
podman.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
@@ -39,6 +43,207 @@ class LauncherTest(unittest.TestCase):
|
|||||||
return subprocess.run(['bash', str(self.launcher), *args], env=self.env,
|
return subprocess.run(['bash', str(self.launcher), *args], env=self.env,
|
||||||
capture_output=True, text=True)
|
capture_output=True, text=True)
|
||||||
|
|
||||||
|
def fake_media_launcher(self):
|
||||||
|
fake = self.root / 'fake-ai-media'
|
||||||
|
fake.write_text('''#!/usr/bin/python3
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
root = Path(os.environ["TEST_MEDIA"])
|
||||||
|
def host(path):
|
||||||
|
return str(path).replace("/work/input/", str(root / "input") + "/").replace(
|
||||||
|
"/work/output/", str(root / "output") + "/")
|
||||||
|
|
||||||
|
tool = sys.argv[1]
|
||||||
|
args = sys.argv[2:]
|
||||||
|
if tool == "ffmpeg":
|
||||||
|
os.execvp("ffmpeg", ["ffmpeg", *[host(arg) for arg in args]])
|
||||||
|
if tool == "facefusion":
|
||||||
|
(root / "facefusion-args.json").write_text(__import__("json").dumps(args))
|
||||||
|
shutil.copyfile(host(args[args.index("--target-path") + 1]),
|
||||||
|
host(args[args.index("--output-path") + 1]))
|
||||||
|
raise SystemExit(0)
|
||||||
|
if tool == "rvc":
|
||||||
|
(root / "rvc-args.json").write_text(__import__("json").dumps(args))
|
||||||
|
source = Path(host(args[1]))
|
||||||
|
job = Path(host(args[2]))
|
||||||
|
if "--convert-only" not in args:
|
||||||
|
(job / "instrumental").mkdir()
|
||||||
|
shutil.copyfile(source, job / "instrumental/stem.wav")
|
||||||
|
if "--separate-only" in args:
|
||||||
|
(job / "vocals").mkdir()
|
||||||
|
shutil.copyfile(source, job / "vocals/stem.wav")
|
||||||
|
else:
|
||||||
|
shutil.copyfile(source, job / "vocals-mia_voce.wav")
|
||||||
|
raise SystemExit(0)
|
||||||
|
raise SystemExit("Unexpected tool: " + tool)
|
||||||
|
''')
|
||||||
|
fake.chmod(0o755)
|
||||||
|
return fake
|
||||||
|
|
||||||
|
def fake_downloader(self, fixture):
|
||||||
|
downloader = self.root / 'yt-dlp'
|
||||||
|
downloader.write_text('''#!/usr/bin/python3
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shutil
|
||||||
|
import sys
|
||||||
|
|
||||||
|
args = sys.argv[1:]
|
||||||
|
Path(os.environ["TEST_LOG"]).write_text(json.dumps(args))
|
||||||
|
destination = args[args.index("--output") + 1].replace("%(ext)s", "mp4")
|
||||||
|
shutil.copyfile(os.environ["TEST_DOWNLOAD_FIXTURE"], destination)
|
||||||
|
''')
|
||||||
|
downloader.chmod(0o755)
|
||||||
|
self.env['TEST_DOWNLOAD_FIXTURE'] = str(fixture)
|
||||||
|
return downloader
|
||||||
|
|
||||||
|
def run_preset(self, fake, *args, job_id='test'):
|
||||||
|
return subprocess.run(['python3', str(self.root / 'preset.py'),
|
||||||
|
str(self.media), str(fake), '--run', '--job-id', job_id, *args],
|
||||||
|
env={**self.env, 'TEST_MEDIA': str(self.media)},
|
||||||
|
capture_output=True, text=True)
|
||||||
|
|
||||||
|
def create_video(self, *, audio=False):
|
||||||
|
video = self.media / 'input/video1.mp4'
|
||||||
|
command = ['ffmpeg', '-hide_banner', '-loglevel', 'error', '-f', 'lavfi',
|
||||||
|
'-i', 'color=c=black:s=64x64:d=1']
|
||||||
|
if audio:
|
||||||
|
command += ['-f', 'lavfi', '-i', 'sine=frequency=440:duration=1']
|
||||||
|
command += ['-c:v', 'mpeg4']
|
||||||
|
if audio:
|
||||||
|
command += ['-c:a', 'aac', '-shortest']
|
||||||
|
subprocess.run([*command, str(video)], check=True)
|
||||||
|
return video
|
||||||
|
|
||||||
|
def stream_types(self, path):
|
||||||
|
probe = subprocess.check_output(['ffprobe', '-v', 'error', '-show_entries',
|
||||||
|
'stream=codec_type', '-of', 'json', str(path)])
|
||||||
|
return {stream['codec_type'] for stream in json.loads(probe)['streams']}
|
||||||
|
|
||||||
|
def create_audio(self, relative, sample=1000, seconds=1):
|
||||||
|
path = self.media / relative
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
with wave.open(str(path), 'wb') as audio:
|
||||||
|
audio.setparams((1, 2, 8000, 0, 'NONE', 'not compressed'))
|
||||||
|
audio.writeframes(struct.pack('<h', sample) * (8000 * seconds))
|
||||||
|
return path
|
||||||
|
|
||||||
|
def test_mix_sums_stems_and_preserves_longest_duration(self):
|
||||||
|
vocals = self.create_audio('output/video1-split-stems/vocals.wav')
|
||||||
|
instrumental = self.create_audio('output/video1-split-stems/instrumental.wav',
|
||||||
|
sample=2000, seconds=2)
|
||||||
|
before = [path.read_bytes() for path in (vocals, instrumental)]
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'mix',
|
||||||
|
'video1-split-stems/vocals.wav',
|
||||||
|
'video1-split-stems/instrumental.wav', '--output', 'song.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/song.wav'
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'})
|
||||||
|
with wave.open(str(output), 'rb') as audio:
|
||||||
|
self.assertEqual(audio.getnframes(), 16000)
|
||||||
|
samples = struct.unpack('<16000h', audio.readframes(16000))
|
||||||
|
self.assertAlmostEqual(samples[4000], 3000, delta=1)
|
||||||
|
self.assertAlmostEqual(samples[12000], 2000, delta=1)
|
||||||
|
self.assertEqual([path.read_bytes() for path in (vocals, instrumental)], before)
|
||||||
|
|
||||||
|
def test_voice_convert_audio_skips_separation_and_preserves_input(self):
|
||||||
|
source = self.create_audio('output/video1-split-stems/vocals.wav')
|
||||||
|
before = source.read_bytes()
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'voice-convert',
|
||||||
|
'video1-split-stems/vocals.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/vocals-mia_voce.wav'
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'})
|
||||||
|
args = json.loads((self.media / 'rvc-args.json').read_text())
|
||||||
|
self.assertIn('--convert-only', args)
|
||||||
|
self.assertFalse(list((self.media / 'output').rglob('instrumental')))
|
||||||
|
self.assertFalse((self.media / 'facefusion-args.json').exists())
|
||||||
|
self.assertEqual(source.read_bytes(), before)
|
||||||
|
repeated = self.run_preset(self.fake_media_launcher(), 'voice-convert',
|
||||||
|
'video1-split-stems/vocals.wav')
|
||||||
|
self.assertNotEqual(repeated.returncode, 0)
|
||||||
|
|
||||||
|
def test_voice_convert_dispatches_with_custom_output(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
result = self.launch('preset', 'voice-convert', 'voice.wav', '--output', 'mine.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertEqual(args[-4:], ['voice-convert', 'voice.wav', '--output', 'mine.wav'])
|
||||||
|
|
||||||
|
def test_voice_convert_rejects_invalid_audio_and_output(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
for name in ('missing.wav', '../voice.wav', 'https://example.org/audio.wav'):
|
||||||
|
self.assertNotEqual(self.launch('preset', 'voice-convert', name).returncode, 0)
|
||||||
|
for name in ('../mine.wav', 'mine.mp3'):
|
||||||
|
self.assertNotEqual(self.launch('preset', 'voice-convert', 'voice.wav',
|
||||||
|
'--output', name).returncode, 0)
|
||||||
|
self.create_audio('output/voice.wav')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'voice-convert', 'voice.wav').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_mix_default_output_and_no_overwrite(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
args = ('mix', 'voice.wav', 'instrumental.wav')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), *args)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
target = self.media / 'output/voice-mix.wav'
|
||||||
|
original = target.read_bytes()
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), *args)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertEqual(target.read_bytes(), original)
|
||||||
|
|
||||||
|
def test_mix_dispatches_audio_only_background_job(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
result = self.launch('preset', 'mix', 'voice.wav', 'instrumental.wav',
|
||||||
|
'--output', 'song.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertEqual(args[-5:], ['mix', 'voice.wav', 'instrumental.wav',
|
||||||
|
'--output', 'song.wav'])
|
||||||
|
self.assertFalse((self.media / 'output/song.wav').exists())
|
||||||
|
|
||||||
|
def test_mix_rejects_unsafe_paths_and_ambiguous_audio(self):
|
||||||
|
self.create_audio('input/voice.wav')
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
for unsafe in ('../voice.wav', '/tmp/voice.wav', 'https://example.org/voice.wav'):
|
||||||
|
result = self.launch('preset', 'mix', unsafe, 'instrumental.wav')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
for unsafe in ('../song.wav', '/tmp/song.wav', 'song.mp3'):
|
||||||
|
result = self.launch('preset', 'mix', 'voice.wav', 'instrumental.wav',
|
||||||
|
'--output', unsafe)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
(self.media / 'output/linked').symlink_to(self.media / 'input', target_is_directory=True)
|
||||||
|
self.assertNotEqual(self.launch('preset', 'mix', 'linked/voice.wav',
|
||||||
|
'instrumental.wav').returncode, 0)
|
||||||
|
self.create_audio('output/voice.wav')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'mix', 'voice.wav',
|
||||||
|
'instrumental.wav').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_mix_rejects_missing_audio_stream(self):
|
||||||
|
video = self.create_video()
|
||||||
|
self.create_audio('output/instrumental.wav')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'mix', video.name,
|
||||||
|
'instrumental.wav')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse((self.media / 'output/video1-mix.wav').exists())
|
||||||
|
|
||||||
def test_cli_has_no_network_or_host_home(self):
|
def test_cli_has_no_network_or_host_home(self):
|
||||||
result = self.launch('facefusion', 'cli', '--help')
|
result = self.launch('facefusion', 'cli', '--help')
|
||||||
self.assertEqual(result.returncode, 0, result.stderr)
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
@@ -65,6 +270,211 @@ class LauncherTest(unittest.TestCase):
|
|||||||
self.assertNotIn('--publish', args)
|
self.assertNotIn('--publish', args)
|
||||||
self.assertFalse(any('dbus' in arg for arg in args))
|
self.assertFalse(any('dbus' in arg for arg in args))
|
||||||
|
|
||||||
|
def test_rvc_cli_is_offline_and_mounts_only_preset_code(self):
|
||||||
|
result = self.launch('rvc', 'cli', '/work/output/job/audio.wav', '/work/output/job')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--network=none', args)
|
||||||
|
self.assertIn('--entrypoint', args)
|
||||||
|
self.assertIn('python', args)
|
||||||
|
self.assertIn(str(self.root / 'preset_rvc.py') + ':/opt/preset_rvc.py:ro,Z', args)
|
||||||
|
self.assertIn('/opt/preset_rvc.py', args)
|
||||||
|
self.assertNotIn('label=disable', args)
|
||||||
|
|
||||||
|
def test_voice_preset_dispatches_to_user_service(self):
|
||||||
|
(self.media / 'input/video1.mp4').write_bytes(b'not processed in dispatch')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
result = self.launch('preset', 'audio-convert', 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertIn('--property=Restart=no', args)
|
||||||
|
self.assertIn('audio-convert', args)
|
||||||
|
self.assertIn('video1.mp4', args)
|
||||||
|
|
||||||
|
def test_face_preset_requires_all_sources(self):
|
||||||
|
(self.media / 'input/video1.mp4').write_bytes(b'video')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'video-convert', 'video1.mp4').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_complete_preset_rejects_local_url(self):
|
||||||
|
result = self.launch('preset', 'convert', 'file:///tmp/video.mp4')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_old_preset_names_are_rejected(self):
|
||||||
|
for name in ('voce', 'volti', 'unisci', 'completo'):
|
||||||
|
with self.subTest(name=name):
|
||||||
|
self.assertEqual(self.launch('preset', name, 'video1.mp4').returncode, 2)
|
||||||
|
|
||||||
|
def test_all_url_presets_dispatch_one_background_job(self):
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
runner = self.root / 'systemd-run'
|
||||||
|
runner.write_text('#!/usr/bin/python3\nimport json,os,sys\n'
|
||||||
|
'open(os.environ["TEST_LOG"], "w").write(json.dumps(sys.argv[1:]))\n')
|
||||||
|
runner.chmod(0o755)
|
||||||
|
(self.media / 'input/audio.wav').write_bytes(b'audio')
|
||||||
|
for preset in ('audio-convert', 'video-convert', 'merge', 'split',
|
||||||
|
'split-stems', 'convert'):
|
||||||
|
with self.subTest(preset=preset):
|
||||||
|
extra = ['audio.wav'] if preset == 'merge' else []
|
||||||
|
result = self.launch('preset', preset, 'https://example.org/video', *extra)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--user', args)
|
||||||
|
self.assertIn(preset, args)
|
||||||
|
self.assertIn('https://example.org/video', args)
|
||||||
|
if extra:
|
||||||
|
self.assertEqual(args[-1], 'audio.wav')
|
||||||
|
self.assertFalse(list((self.media / 'input').glob('download-*')))
|
||||||
|
|
||||||
|
def test_mux_preset_rejects_ambiguous_audio(self):
|
||||||
|
(self.media / 'input/video1.mp4').write_bytes(b'video')
|
||||||
|
(self.media / 'input/audio.wav').write_bytes(b'audio')
|
||||||
|
(self.media / 'output/audio.wav').write_bytes(b'audio')
|
||||||
|
self.assertNotEqual(self.launch('preset', 'merge', 'video1.mp4', 'audio.wav').returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_mux_preset_creates_audio_video_with_streams(self):
|
||||||
|
if subprocess.run(['bash', '-c', 'command -v ffmpeg && command -v ffprobe'],
|
||||||
|
capture_output=True).returncode != 0:
|
||||||
|
self.skipTest('ffmpeg and ffprobe required')
|
||||||
|
self.create_video()
|
||||||
|
audio = self.media / 'input/audio.wav'
|
||||||
|
subprocess.run(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-f', 'lavfi',
|
||||||
|
'-i', 'sine=frequency=440:duration=1', str(audio)], check=True)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'merge', 'video1.mp4', 'audio.wav')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/video1-unito.mp4'
|
||||||
|
self.assertTrue(output.is_file())
|
||||||
|
self.assertEqual(self.stream_types(output), {'video', 'audio'})
|
||||||
|
|
||||||
|
def test_voice_preset_outputs_audio_only(self):
|
||||||
|
self.create_video(audio=True)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'audio-convert', 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output/video1-mia_voce.wav'
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'})
|
||||||
|
self.assertFalse((self.media / 'output/video1-mia_voce.mp4').exists())
|
||||||
|
|
||||||
|
def test_split_presets_output_separate_streams_without_conversion(self):
|
||||||
|
original = self.create_video(audio=True).read_bytes()
|
||||||
|
for preset in ('split', 'split-stems'):
|
||||||
|
with self.subTest(preset=preset):
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
output = self.media / 'output' / f'video1-{preset}'
|
||||||
|
expected = {'video.mp4', 'audio.wav'}
|
||||||
|
if preset == 'split-stems':
|
||||||
|
expected |= {'vocals.wav', 'instrumental.wav'}
|
||||||
|
args = json.loads((self.media / 'rvc-args.json').read_text())
|
||||||
|
self.assertIn('--separate-only', args)
|
||||||
|
else:
|
||||||
|
self.assertFalse((self.media / 'rvc-args.json').exists())
|
||||||
|
self.assertEqual({p.name for p in output.iterdir()}, expected)
|
||||||
|
for name in expected:
|
||||||
|
self.assertEqual(self.stream_types(output / name),
|
||||||
|
{'video'} if name == 'video.mp4' else {'audio'})
|
||||||
|
self.assertEqual((self.media / 'input/video1.mp4').read_bytes(), original)
|
||||||
|
self.assertFalse(list((self.media / 'output').rglob('*mia_voce*')))
|
||||||
|
before = {p.name: p.read_bytes() for p in output.iterdir()}
|
||||||
|
repeated = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4',
|
||||||
|
job_id='repeat')
|
||||||
|
self.assertNotEqual(repeated.returncode, 0)
|
||||||
|
self.assertEqual({p.name: p.read_bytes() for p in output.iterdir()}, before)
|
||||||
|
|
||||||
|
def test_split_presets_reject_video_without_audio(self):
|
||||||
|
self.create_video()
|
||||||
|
for preset in ('split', 'split-stems'):
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), preset, 'video1.mp4')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(list((self.media / 'output').iterdir()))
|
||||||
|
|
||||||
|
def test_face_preset_preserves_audio_only_when_present(self):
|
||||||
|
for audio in (False, True):
|
||||||
|
with self.subTest(audio=audio):
|
||||||
|
video = self.media / 'input/video1.mp4'
|
||||||
|
if video.exists():
|
||||||
|
video.unlink()
|
||||||
|
self.create_video(audio=audio)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
output = self.media / 'output/video1-facefusion.mp4'
|
||||||
|
if output.exists():
|
||||||
|
output.unlink()
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'video-convert', 'video1.mp4',
|
||||||
|
job_id=f'test-{audio}')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(self.stream_types(output),
|
||||||
|
{'video', 'audio'} if audio else {'video'})
|
||||||
|
|
||||||
|
def test_face_preset_uses_requested_options(self):
|
||||||
|
self.create_video(audio=True)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'video-convert', 'video1.mp4')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
args = json.loads((self.media / 'facefusion-args.json').read_text())
|
||||||
|
source_start = args.index('--source-paths') + 1
|
||||||
|
self.assertEqual(args[source_start:source_start + 8],
|
||||||
|
[f'/work/input/source{number}.jpg' for number in range(11, 19)])
|
||||||
|
expected = {
|
||||||
|
'--processors': ['face_swapper'],
|
||||||
|
'--face-swapper-model': ['hyperswap_1a_256'],
|
||||||
|
'--face-swapper-pixel-boost': ['256x256'],
|
||||||
|
'--face-swapper-weight': ['0.5'],
|
||||||
|
'--face-detector-model': ['yolo_face'],
|
||||||
|
'--face-detector-size': ['640x640'],
|
||||||
|
'--face-detector-angles': ['0', '90', '180', '270'],
|
||||||
|
'--face-detector-score': ['0.5'],
|
||||||
|
'--face-selector-mode': ['one'],
|
||||||
|
'--face-selector-order': ['large-small'],
|
||||||
|
'--face-selector-gender': ['female'],
|
||||||
|
'--face-selector-race': ['white'],
|
||||||
|
'--face-mask-types': ['occlusion', 'region', 'area', 'box'],
|
||||||
|
'--face-occluder-model': ['xseg_1'],
|
||||||
|
'--face-parser-model': ['bisenet_resnet_34'],
|
||||||
|
'--face-mask-blur': ['0.3'],
|
||||||
|
'--output-video-encoder': ['libx264'],
|
||||||
|
'--output-video-preset': ['veryfast'],
|
||||||
|
'--output-video-quality': ['80'],
|
||||||
|
'--output-video-fps': ['30'],
|
||||||
|
'--execution-providers': ['cpu'],
|
||||||
|
'--output-audio-encoder': ['aac'],
|
||||||
|
'--jobs-path': ['/work/state'],
|
||||||
|
'--temp-path': ['/work/state/tmp'],
|
||||||
|
}
|
||||||
|
for flag, values in expected.items():
|
||||||
|
with self.subTest(flag=flag):
|
||||||
|
start = args.index(flag) + 1
|
||||||
|
self.assertEqual(args[start:start + len(values)], values)
|
||||||
|
|
||||||
|
def test_complete_preset_downloads_and_combines_both_results(self):
|
||||||
|
fixture = self.create_video(audio=True)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
self.fake_downloader(fixture)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'convert',
|
||||||
|
'https://example.org/video', job_id='test')
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertTrue((self.media / 'input/download-test.mp4').is_file())
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/download-test-mia_voce.wav'),
|
||||||
|
{'audio'})
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/download-test-facefusion.mp4'),
|
||||||
|
{'video', 'audio'})
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/download-test-completo.mp4'),
|
||||||
|
{'video', 'audio'})
|
||||||
|
face_args = json.loads((self.media / 'facefusion-args.json').read_text())
|
||||||
|
self.assertEqual(face_args[face_args.index('--face-selector-gender') + 1], 'female')
|
||||||
|
self.assertEqual(face_args[face_args.index('--output-video-fps') + 1], '30')
|
||||||
|
downloader_args = json.loads(self.log.read_text())
|
||||||
|
self.assertIn('--ignore-config', downloader_args)
|
||||||
|
self.assertIn('--no-playlist', downloader_args)
|
||||||
|
|
||||||
def test_default_gui_uses_independent_user_service(self):
|
def test_default_gui_uses_independent_user_service(self):
|
||||||
self.env.update(XDG_RUNTIME_DIR=str(self.root), WAYLAND_DISPLAY='wayland-0')
|
self.env.update(XDG_RUNTIME_DIR=str(self.root), WAYLAND_DISPLAY='wayland-0')
|
||||||
runner = self.root / 'systemd-run'
|
runner = self.root / 'systemd-run'
|
||||||
@@ -84,6 +494,72 @@ class LauncherTest(unittest.TestCase):
|
|||||||
self.assertNotIn('--pty', args)
|
self.assertNotIn('--pty', args)
|
||||||
self.assertNotIn('--wait', args)
|
self.assertNotIn('--wait', args)
|
||||||
|
|
||||||
|
def test_all_presets_download_url_before_processing(self):
|
||||||
|
fixture = self.create_video(audio=True)
|
||||||
|
self.fake_downloader(fixture)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
audio = self.media / 'input/audio.wav'
|
||||||
|
subprocess.run(['ffmpeg', '-hide_banner', '-loglevel', 'error', '-i',
|
||||||
|
str(fixture), '-vn', str(audio)], check=True)
|
||||||
|
outputs = {
|
||||||
|
'audio-convert': 'mia_voce.wav', 'video-convert': 'facefusion.mp4',
|
||||||
|
'merge': 'unito.mp4', 'split': 'split', 'split-stems': 'split-stems',
|
||||||
|
'convert': 'completo.mp4',
|
||||||
|
}
|
||||||
|
for preset, suffix in outputs.items():
|
||||||
|
with self.subTest(preset=preset):
|
||||||
|
extra = ['audio.wav'] if preset == 'merge' else []
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), preset,
|
||||||
|
'https://example.org/video?a=1&b=2', *extra,
|
||||||
|
job_id=preset)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(result.stdout.count('Downloading one video'), 1)
|
||||||
|
self.assertTrue((self.media / f'input/download-{preset}.mp4').is_file())
|
||||||
|
output = self.media / f'output/download-{preset}-{suffix}'
|
||||||
|
self.assertTrue(output.exists())
|
||||||
|
if preset in ('split', 'split-stems'):
|
||||||
|
self.assertEqual(self.stream_types(output / 'video.mp4'), {'video'})
|
||||||
|
self.assertEqual(self.stream_types(output / 'audio.wav'), {'audio'})
|
||||||
|
else:
|
||||||
|
self.assertEqual(self.stream_types(output), {'audio'} if
|
||||||
|
preset == 'audio-convert' else {'video', 'audio'})
|
||||||
|
download_args = json.loads(self.log.read_text())
|
||||||
|
self.assertEqual(download_args[-1], 'https://example.org/video?a=1&b=2')
|
||||||
|
for flag in ('--ignore-config', '--no-playlist', '--no-overwrites'):
|
||||||
|
self.assertIn(flag, download_args)
|
||||||
|
|
||||||
|
def test_convert_also_accepts_local_video_without_download(self):
|
||||||
|
fixture = self.create_video(audio=True)
|
||||||
|
self.fake_downloader(fixture)
|
||||||
|
for number in range(11, 19):
|
||||||
|
(self.media / f'input/source{number}.jpg').write_bytes(b'source')
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'convert', fixture.name)
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
self.assertEqual(self.stream_types(self.media / 'output/video1-completo.mp4'),
|
||||||
|
{'video', 'audio'})
|
||||||
|
|
||||||
|
def test_all_presets_reject_invalid_urls_before_dispatch(self):
|
||||||
|
for preset in ('split', 'split-stems', 'audio-convert', 'video-convert',
|
||||||
|
'merge', 'convert'):
|
||||||
|
for url in ('file:///tmp/video.mp4', 'https://localhost/video',
|
||||||
|
'http://192.168.1.1/video', 'https://user:password@example.org/video'):
|
||||||
|
with self.subTest(preset=preset, url=url):
|
||||||
|
extra = ['audio.wav'] if preset == 'merge' else []
|
||||||
|
result = self.launch('preset', preset, url, *extra)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(self.log.exists())
|
||||||
|
|
||||||
|
def test_failed_url_download_does_not_start_processing(self):
|
||||||
|
downloader = self.root / 'yt-dlp'
|
||||||
|
downloader.write_text('#!/bin/sh\nexit 1\n')
|
||||||
|
downloader.chmod(0o755)
|
||||||
|
result = self.run_preset(self.fake_media_launcher(), 'split',
|
||||||
|
'https://example.org/video')
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertFalse(list((self.media / 'output').iterdir()))
|
||||||
|
|
||||||
def test_symlinked_input_is_rejected(self):
|
def test_symlinked_input_is_rejected(self):
|
||||||
(self.media / 'input').rmdir()
|
(self.media / 'input').rmdir()
|
||||||
(self.media / 'input').symlink_to(self.root)
|
(self.media / 'input').symlink_to(self.root)
|
||||||
|
|||||||
93
ansible/roles/desktop_ai_media/tests/test_preset_rvc.py
Normal file
93
ansible/roles/desktop_ai_media/tests/test_preset_rvc.py
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import importlib.util
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
from types import ModuleType
|
||||||
|
import unittest
|
||||||
|
from unittest.mock import Mock, patch
|
||||||
|
|
||||||
|
|
||||||
|
class SeparationWorkerTest(unittest.TestCase):
|
||||||
|
def test_convert_only_applies_mia_voce_without_importing_separator(self):
|
||||||
|
spec = importlib.util.spec_from_file_location(
|
||||||
|
'preset_rvc', Path(__file__).resolve().parents[1] / 'files/preset_rvc.py')
|
||||||
|
worker = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(worker)
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
root = Path(directory)
|
||||||
|
output = root / 'output'
|
||||||
|
job = output / 'job'
|
||||||
|
job.mkdir(parents=True)
|
||||||
|
source = job / 'audio.wav'
|
||||||
|
source.write_bytes(b'audio')
|
||||||
|
weights = root / 'state/weights/mia_voce.pth'
|
||||||
|
index = root / 'state/mia_voce/added_IVF256_Flat_nprobe_1_mia_voce_v2.index'
|
||||||
|
for path in (weights, index):
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_bytes(b'model')
|
||||||
|
|
||||||
|
def mapped_path(value):
|
||||||
|
return root / str(value).removeprefix('/work/') if str(value).startswith(
|
||||||
|
'/work/') else Path(value)
|
||||||
|
|
||||||
|
config = ModuleType('configs.config')
|
||||||
|
config.Config = Mock()
|
||||||
|
vc = ModuleType('infer.vc.modules')
|
||||||
|
voice = Mock()
|
||||||
|
voice.vc_single.return_value = ('Success', (40000, [0.1, 0.2]))
|
||||||
|
vc.VC = Mock(return_value=voice)
|
||||||
|
sf = ModuleType('soundfile')
|
||||||
|
sf.write = Mock(side_effect=lambda path, data, rate: path.write_bytes(b'converted'))
|
||||||
|
modules = {'configs.config': config, 'infer.vc.modules': vc,
|
||||||
|
'soundfile': sf, 'tools.pymss_webui': None}
|
||||||
|
with patch.object(worker, 'Path', mapped_path), \
|
||||||
|
patch.object(sys, 'argv', ['preset_rvc.py', str(source), str(job),
|
||||||
|
'--convert-only']), \
|
||||||
|
patch.dict(sys.modules, modules), patch.dict(os.environ):
|
||||||
|
worker.main()
|
||||||
|
voice.get_vc.assert_called_once_with('mia_voce.pth')
|
||||||
|
self.assertEqual(voice.vc_single.call_args.args[1], str(source))
|
||||||
|
self.assertEqual(voice.vc_single.call_args.args[4], str(index))
|
||||||
|
self.assertEqual((job / 'vocals-mia_voce.wav').read_bytes(), b'converted')
|
||||||
|
self.assertFalse((job / 'vocals').exists())
|
||||||
|
self.assertFalse((job / 'instrumental').exists())
|
||||||
|
|
||||||
|
def test_separate_only_does_not_require_personal_voice_weights(self):
|
||||||
|
spec = importlib.util.spec_from_file_location(
|
||||||
|
'preset_rvc', Path(__file__).resolve().parents[1] / 'files/preset_rvc.py')
|
||||||
|
worker = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(worker)
|
||||||
|
with tempfile.TemporaryDirectory() as directory:
|
||||||
|
output = Path(directory)
|
||||||
|
job = output / 'job'
|
||||||
|
job.mkdir()
|
||||||
|
source = job / 'audio.wav'
|
||||||
|
source.write_bytes(b'fixture')
|
||||||
|
separator = ModuleType('tools.pymss_webui')
|
||||||
|
|
||||||
|
def separate(model, audio, vocals, unused, instrumental, fmt, **kwargs):
|
||||||
|
self.assertEqual(model, 'vocals-bs-roformer-368')
|
||||||
|
self.assertEqual(audio, str(source))
|
||||||
|
(Path(vocals) / 'stem.wav').write_bytes(b'vocals')
|
||||||
|
(Path(instrumental) / 'stem.wav').write_bytes(b'instrumental')
|
||||||
|
yield 'Separated'
|
||||||
|
|
||||||
|
separator.pymss_separate = separate
|
||||||
|
|
||||||
|
def mapped_path(value):
|
||||||
|
return output if str(value) == '/work/output' else Path(value)
|
||||||
|
|
||||||
|
with patch.object(worker, 'Path', mapped_path), \
|
||||||
|
patch.object(sys, 'argv', ['preset_rvc.py', str(source), str(job),
|
||||||
|
'--separate-only']), \
|
||||||
|
patch.dict(sys.modules, {'tools.pymss_webui': separator}), \
|
||||||
|
patch.dict(os.environ):
|
||||||
|
worker.main()
|
||||||
|
self.assertTrue((job / 'vocals/stem.wav').is_file())
|
||||||
|
self.assertTrue((job / 'instrumental/stem.wav').is_file())
|
||||||
|
self.assertFalse((job / 'vocals-mia_voce.wav').exists())
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
183
ansible/roles/desktop_ai_media/tests/test_storage_commands.py
Normal file
183
ansible/roles/desktop_ai_media/tests/test_storage_commands.py
Normal file
@@ -0,0 +1,183 @@
|
|||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from jinja2 import Environment
|
||||||
|
|
||||||
|
|
||||||
|
TEMPLATE = Path(__file__).resolve().parents[1] / "templates/ai-media.j2"
|
||||||
|
UUID = "6948c504-2d60-4cc8-9e7f-3ccdf28e80d7"
|
||||||
|
|
||||||
|
|
||||||
|
class StorageCommandsTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
temp = tempfile.TemporaryDirectory()
|
||||||
|
self.addCleanup(temp.cleanup)
|
||||||
|
self.root = Path(temp.name)
|
||||||
|
self.media = self.root / "media"
|
||||||
|
for directory in ("input", "output"):
|
||||||
|
(self.media / directory).mkdir(parents=True)
|
||||||
|
env = Environment()
|
||||||
|
env.filters["quote"] = shlex.quote
|
||||||
|
self.launcher = self.root / "ai-media"
|
||||||
|
self.launcher.write_text(env.from_string(TEMPLATE.read_text()).render(
|
||||||
|
desktop_ai_media_root=str(self.media),
|
||||||
|
desktop_ai_media_build_root=str(self.root),
|
||||||
|
desktop_ai_media_external_storage_enabled=True,
|
||||||
|
desktop_ai_media_external_luks_uuid=UUID,
|
||||||
|
desktop_ai_media_external_mountpoint="/run/media/test/Backup",
|
||||||
|
desktop_ai_media_external_source="/run/media/test/Backup/ai-media",
|
||||||
|
))
|
||||||
|
self.state = self.root / "state.json"
|
||||||
|
self.log = self.root / "commands.jsonl"
|
||||||
|
mock = self.root / "mock"
|
||||||
|
mock.write_text('''#!/usr/bin/env python3
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
from pathlib import Path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
cmd = Path(sys.argv[0]).name
|
||||||
|
args = sys.argv[1:]
|
||||||
|
state_file = Path(os.environ["STORAGE_TEST_STATE"])
|
||||||
|
state = json.loads(state_file.read_text())
|
||||||
|
root = os.environ["STORAGE_TEST_ROOT"]
|
||||||
|
external = "/run/media/test/Backup"
|
||||||
|
with open(os.environ["STORAGE_TEST_LOG"], "a") as log:
|
||||||
|
log.write(json.dumps([cmd, *args]) + "\\n")
|
||||||
|
if cmd == "sudo":
|
||||||
|
os.execvp(args[0], args)
|
||||||
|
elif cmd == "lsblk":
|
||||||
|
if state.get("missing"):
|
||||||
|
sys.exit(1)
|
||||||
|
print("/dev/sda1 part 8:1")
|
||||||
|
if state.get("unlocked"):
|
||||||
|
print("/dev/dm-0 crypt 252:0")
|
||||||
|
elif cmd == "findmnt":
|
||||||
|
if "--mountpoint" in args:
|
||||||
|
target = args[args.index("--mountpoint") + 1]
|
||||||
|
match = state.get("bind" if target == root else "mounted")
|
||||||
|
if not match:
|
||||||
|
sys.exit(1)
|
||||||
|
print(match)
|
||||||
|
elif "--source" in args:
|
||||||
|
assert args[args.index("--source") + 1] == "252:0"
|
||||||
|
mounts = ([external] if state.get("mounted") else []) + (
|
||||||
|
[root] if state.get("bind") else []) + state.get("other_mounts", [])
|
||||||
|
if not mounts:
|
||||||
|
sys.exit(1)
|
||||||
|
print(*mounts, sep="\\n")
|
||||||
|
else:
|
||||||
|
sys.exit(2)
|
||||||
|
elif cmd == "systemctl":
|
||||||
|
if args[0] == "--user":
|
||||||
|
if state.get("running"):
|
||||||
|
print("ai-media-preset-test.service loaded active running")
|
||||||
|
elif args[0] == "start":
|
||||||
|
state["bind"] = "252:0 /ai-media"
|
||||||
|
elif args[0] == "stop":
|
||||||
|
state.pop("bind", None)
|
||||||
|
elif cmd == "podman":
|
||||||
|
assert args[:3] == ["--remote=false", "ps", "-q"]
|
||||||
|
if state.get("container"):
|
||||||
|
print("abcdef")
|
||||||
|
elif cmd == "udisksctl":
|
||||||
|
if args[0] == "unlock":
|
||||||
|
state["unlocked"] = True
|
||||||
|
elif args[0] == "mount":
|
||||||
|
state["mounted"] = "252:0 /"
|
||||||
|
elif args[0] == "unmount":
|
||||||
|
if state.get("busy"):
|
||||||
|
sys.exit("Device is busy")
|
||||||
|
state.pop("mounted", None)
|
||||||
|
elif args[0] == "lock":
|
||||||
|
assert not state.get("mounted")
|
||||||
|
state.pop("unlocked")
|
||||||
|
state_file.write_text(json.dumps(state))
|
||||||
|
''')
|
||||||
|
mock.chmod(0o755)
|
||||||
|
for command in ("lsblk", "findmnt", "systemctl", "podman", "udisksctl", "sudo"):
|
||||||
|
(self.root / command).symlink_to(mock)
|
||||||
|
self.env = dict(os.environ, PATH=f"{self.root}:{os.environ['PATH']}",
|
||||||
|
STORAGE_TEST_STATE=str(self.state), STORAGE_TEST_LOG=str(self.log),
|
||||||
|
STORAGE_TEST_ROOT=str(self.media))
|
||||||
|
|
||||||
|
def units(self):
|
||||||
|
return [subprocess.check_output(["systemd-escape", "-p", "--suffix=" + suffix, "--", str(self.media)], text=True).strip()
|
||||||
|
for suffix in ("automount", "mount")]
|
||||||
|
|
||||||
|
def launch(self, *args, **state):
|
||||||
|
self.state.write_text(json.dumps(state))
|
||||||
|
self.log.write_text("")
|
||||||
|
result = subprocess.run(["bash", str(self.launcher), *args], env=self.env,
|
||||||
|
capture_output=True, text=True, timeout=10)
|
||||||
|
operations = [row[:2] if row[0] == "systemctl" else row
|
||||||
|
for line in self.log.read_text().splitlines()
|
||||||
|
if (row := json.loads(line))[0] in ("udisksctl", "systemctl", "sudo")]
|
||||||
|
return result, operations
|
||||||
|
|
||||||
|
def test_mount_unlocks_only_the_configured_volume_then_starts_bind(self):
|
||||||
|
result, operations = self.launch("mount")
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(operations, [
|
||||||
|
["udisksctl", "unlock", "--block-device", f"/dev/disk/by-uuid/{UUID}"],
|
||||||
|
["udisksctl", "mount", "--block-device", "/dev/dm-0"],
|
||||||
|
["sudo", "systemctl", "start", *self.units()],
|
||||||
|
["systemctl", "start"],
|
||||||
|
])
|
||||||
|
|
||||||
|
def test_mount_does_not_reopen_already_mounted_volume(self):
|
||||||
|
result, operations = self.launch("mount", unlocked=True, mounted="252:0 /")
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(operations, [["sudo", "systemctl", "start", *self.units()], ["systemctl", "start"]])
|
||||||
|
|
||||||
|
def test_umount_stops_bind_before_unmount_and_lock(self):
|
||||||
|
result, operations = self.launch("umount", unlocked=True, mounted="252:0 /",
|
||||||
|
bind="252:0 /ai-media")
|
||||||
|
self.assertEqual(result.returncode, 0, result.stderr)
|
||||||
|
self.assertEqual(operations, [
|
||||||
|
["systemctl", "--user"], ["sudo", "systemctl", "stop", "ai-media-bind-restarter.service", *self.units()], ["systemctl", "stop"],
|
||||||
|
["udisksctl", "unmount", "--block-device", "/dev/dm-0"],
|
||||||
|
["udisksctl", "lock", "--block-device", f"/dev/disk/by-uuid/{UUID}"],
|
||||||
|
])
|
||||||
|
|
||||||
|
def test_umount_refuses_running_jobs_and_containers(self):
|
||||||
|
for condition in ("running", "container"):
|
||||||
|
with self.subTest(condition=condition):
|
||||||
|
result, operations = self.launch("umount", **{condition: True})
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertIn("running ai-media jobs", result.stderr)
|
||||||
|
self.assertEqual(operations, [["systemctl", "--user"]])
|
||||||
|
|
||||||
|
def test_umount_does_not_lock_if_busy(self):
|
||||||
|
result, operations = self.launch("umount", unlocked=True, mounted="252:0 /", busy=True)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertEqual(operations[-1][:2], ["udisksctl", "unmount"])
|
||||||
|
|
||||||
|
def test_umount_does_not_touch_other_mounts(self):
|
||||||
|
result, operations = self.launch("umount", unlocked=True, mounted="252:0 /",
|
||||||
|
other_mounts=["/mnt/other"])
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertEqual(operations, [["systemctl", "--user"], ["sudo", "systemctl", "stop", "ai-media-bind-restarter.service", *self.units()], ["systemctl", "stop"]])
|
||||||
|
|
||||||
|
def test_rejects_foreign_mount_missing_device_and_extra_arguments(self):
|
||||||
|
for args, state in [
|
||||||
|
(("mount",), {"mounted": "8:2 /"}),
|
||||||
|
(("umount",), {"bind": "8:2 /ai-media"}),
|
||||||
|
(("mount",), {"missing": True}),
|
||||||
|
(("umount", "/dev/sdb"), {}),
|
||||||
|
]:
|
||||||
|
with self.subTest(args=args, state=state):
|
||||||
|
result, operations = self.launch(*args, **state)
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertEqual(operations, [])
|
||||||
|
|
||||||
|
def test_preset_refuses_local_fallback_when_bind_is_stopped(self):
|
||||||
|
result, operations = self.launch("preset", "split", "test.mp4")
|
||||||
|
self.assertNotEqual(result.returncode, 0)
|
||||||
|
self.assertIn("run ai-media mount first", result.stderr)
|
||||||
|
self.assertEqual(operations, [])
|
||||||
4
ansible/roles/devcontainer_generator/defaults/main.yml
Normal file
4
ansible/roles/devcontainer_generator/defaults/main.yml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
devcontainer_generator_go_binary: /usr/bin/go
|
||||||
|
devcontainer_generator_install_go: true
|
||||||
|
devcontainer_generator_build_dir: "{{ user_home }}/.cache/infra/devcontainer-generator"
|
||||||
64
ansible/roles/devcontainer_generator/tasks/main.yml
Normal file
64
ansible/roles/devcontainer_generator/tasks/main.yml
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
---
|
||||||
|
- name: Install Go compiler for the devcontainer generator
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: golang
|
||||||
|
state: present
|
||||||
|
when: devcontainer_generator_install_go | bool
|
||||||
|
|
||||||
|
- name: Ensure devcontainer generator directories exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
loop:
|
||||||
|
- "{{ user_home }}/.local/bin"
|
||||||
|
- "{{ devcontainer_generator_build_dir }}"
|
||||||
|
|
||||||
|
- name: Copy devcontainer generator sources
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ playbook_dir }}/../cmd/devcontainer/"
|
||||||
|
dest: "{{ devcontainer_generator_build_dir }}/src/"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: preserve
|
||||||
|
|
||||||
|
- name: Build devcontainer generator for the target host
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- "{{ devcontainer_generator_go_binary }}"
|
||||||
|
- build
|
||||||
|
- -trimpath
|
||||||
|
- -buildvcs=false
|
||||||
|
- -o
|
||||||
|
- "{{ devcontainer_generator_build_dir }}/devcontainer"
|
||||||
|
- .
|
||||||
|
chdir: "{{ devcontainer_generator_build_dir }}/src"
|
||||||
|
become_user: "{{ username }}"
|
||||||
|
environment:
|
||||||
|
GOCACHE: "{{ devcontainer_generator_build_dir }}/go-cache"
|
||||||
|
GOTOOLCHAIN: local
|
||||||
|
GOPROXY: "off"
|
||||||
|
GOSUMDB: "off"
|
||||||
|
CGO_ENABLED: "0"
|
||||||
|
# Compilation refreshes a cached artifact; copy below reports installation changes.
|
||||||
|
changed_when: false
|
||||||
|
when: not ansible_check_mode
|
||||||
|
|
||||||
|
- name: Install devcontainer generator in the user PATH
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ devcontainer_generator_build_dir }}/devcontainer"
|
||||||
|
remote_src: true
|
||||||
|
dest: "{{ user_home }}/.local/bin/devcontainer"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
when: not ansible_check_mode
|
||||||
|
|
||||||
|
- name: Explain devcontainer generator check-mode behavior
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: >-
|
||||||
|
Check mode validates package and source deployment only. Compilation and
|
||||||
|
installation of {{ user_home }}/.local/bin/devcontainer require a normal run.
|
||||||
|
when: ansible_check_mode
|
||||||
@@ -91,6 +91,20 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.dest }}"
|
label: "{{ item.dest }}"
|
||||||
|
|
||||||
|
- name: Ensure AI coding-agent dotfile parent directories exist
|
||||||
|
tags: [dotfiles, dotfiles:common, ai_agents]
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ (effective_user_home ~ '/' ~ item.dest) | dirname }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ effective_username }}"
|
||||||
|
group: "{{ effective_user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
loop: "{{ ai_agents_dotfiles | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.dest }}"
|
||||||
|
when:
|
||||||
|
- (item.agents | intersect(ai_agents_deploy_enabled_names)) | length > 0
|
||||||
|
|
||||||
- name: Deploy AI coding-agent dotfiles
|
- name: Deploy AI coding-agent dotfiles
|
||||||
tags: [dotfiles, dotfiles:common, ai_agents]
|
tags: [dotfiles, dotfiles:common, ai_agents]
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
|
|||||||
92
ansible/roles/packages_fedora/tasks/chatgpt_desktop.yml
Normal file
92
ansible/roles/packages_fedora/tasks/chatgpt_desktop.yml
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
---
|
||||||
|
# ChatGPT desktop is installed from OpenAI's signed RPM repository; removal
|
||||||
|
# must clean up the package, the managed repository and its signing key.
|
||||||
|
- name: Validate ChatGPT desktop architecture on Fedora
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ansible_facts['architecture'] in chatgpt_desktop_supported_architectures
|
||||||
|
- ansible_facts['distribution_major_version'] in chatgpt_desktop_supported_fedora_versions
|
||||||
|
fail_msg: >-
|
||||||
|
ChatGPT desktop supports Fedora {{ chatgpt_desktop_supported_fedora_versions | join(' and ') }}
|
||||||
|
on x86_64 or aarch64; detected Fedora {{ ansible_facts['distribution_major_version'] }}
|
||||||
|
on {{ ansible_facts['architecture'] }}.
|
||||||
|
when: chatgpt_desktop_install_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Install ChatGPT desktop RPM signing key
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ chatgpt_desktop_rpm_gpg_key }}"
|
||||||
|
dest: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
when: chatgpt_desktop_install_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Import ChatGPT desktop RPM signing key
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.rpm_key:
|
||||||
|
state: present
|
||||||
|
key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
||||||
|
when: chatgpt_desktop_install_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Configure ChatGPT desktop RPM repository
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.yum_repository:
|
||||||
|
name: openai-chatgpt
|
||||||
|
description: ChatGPT
|
||||||
|
baseurl: "{{ chatgpt_desktop_rpm_repository }}"
|
||||||
|
enabled: true
|
||||||
|
gpgcheck: true
|
||||||
|
repo_gpgcheck: true
|
||||||
|
gpgkey: "file:///etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
||||||
|
state: present
|
||||||
|
when: chatgpt_desktop_install_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Install ChatGPT desktop on selected Fedora hosts
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: chatgpt
|
||||||
|
state: latest
|
||||||
|
update_cache: true
|
||||||
|
when: chatgpt_desktop_install_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Check for the installed ChatGPT desktop signing key
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
||||||
|
get_checksum: false
|
||||||
|
register: chatgpt_desktop_signing_key
|
||||||
|
when: chatgpt_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Remove ChatGPT desktop from selected Fedora hosts
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: chatgpt
|
||||||
|
state: absent
|
||||||
|
when: chatgpt_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Remove ChatGPT desktop RPM repository
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.yum_repository:
|
||||||
|
name: openai-chatgpt
|
||||||
|
state: absent
|
||||||
|
when: chatgpt_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
|
||||||
|
# rpm_key reads the identifier from the key file, so only remove the key from
|
||||||
|
# the RPM database while the deployed file is still present.
|
||||||
|
- name: Remove ChatGPT desktop RPM signing key from the RPM database
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.rpm_key:
|
||||||
|
state: absent
|
||||||
|
key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
||||||
|
when:
|
||||||
|
- chatgpt_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
- chatgpt_desktop_signing_key.stat.exists | default(false)
|
||||||
|
|
||||||
|
- name: Remove ChatGPT desktop RPM signing key file
|
||||||
|
tags: [packages, chatgpt]
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
||||||
|
state: absent
|
||||||
|
when: chatgpt_desktop_uninstall_enabled | default(false) | bool
|
||||||
78
ansible/roles/packages_fedora/tasks/cline_desktop.yml
Normal file
78
ansible/roles/packages_fedora/tasks/cline_desktop.yml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
# Cline Desktop ships unsigned RPMs from its GitHub releases; only the
|
||||||
|
# checksum-verified download makes the local installation trustworthy.
|
||||||
|
- name: Validate Cline Desktop architecture on Fedora
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ansible_facts['architecture'] in cline_desktop_rpm_checksums
|
||||||
|
fail_msg: "No verified Cline Desktop RPM for {{ ansible_facts['architecture'] }}."
|
||||||
|
when: cline_desktop_install_enabled | default(false) | bool
|
||||||
|
|
||||||
|
# Runs for both flows so the register below is always valid.
|
||||||
|
- name: Check for cached Cline Desktop RPM
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ cline_desktop_rpm_path }}"
|
||||||
|
get_checksum: false
|
||||||
|
register: cline_desktop_rpm_cache
|
||||||
|
|
||||||
|
- name: Download verified Cline Desktop RPM
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "{{ cline_desktop_rpm_url }}"
|
||||||
|
dest: "{{ cline_desktop_rpm_path }}"
|
||||||
|
checksum: "{{ cline_desktop_rpm_checksums[ansible_facts['architecture']] }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
# get_url only sends HEAD in check mode and cannot populate a cold cache.
|
||||||
|
when:
|
||||||
|
- cline_desktop_install_enabled | default(false) | bool
|
||||||
|
- not ansible_check_mode
|
||||||
|
|
||||||
|
- name: Install Cline Desktop on Fedora
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: "{{ cline_desktop_rpm_path }}"
|
||||||
|
state: present
|
||||||
|
# Upstream ships an unsigned RPM. The download above verifies its pinned
|
||||||
|
# SHA-256; do not disable signature checks in system repository settings.
|
||||||
|
disable_gpg_check: true
|
||||||
|
when:
|
||||||
|
- cline_desktop_install_enabled | default(false) | bool
|
||||||
|
- not ansible_check_mode
|
||||||
|
or cline_desktop_rpm_cache.stat.exists
|
||||||
|
|
||||||
|
- name: Explain Cline Desktop cold-cache check-mode limitation
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: >-
|
||||||
|
A real run will download and SHA-256 verify Cline Desktop
|
||||||
|
{{ cline_desktop_version }} before ensuring it is installed.
|
||||||
|
The RPM is not cached, so this dry run cannot validate DNF dependencies.
|
||||||
|
when:
|
||||||
|
- cline_desktop_install_enabled | default(false) | bool
|
||||||
|
- ansible_check_mode
|
||||||
|
- not cline_desktop_rpm_cache.stat.exists
|
||||||
|
|
||||||
|
# The `cline` RPM package name is verified from the pinned release header;
|
||||||
|
# removal never touches the npm-managed cline CLI or user data.
|
||||||
|
- name: Remove Cline Desktop from Fedora
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: cline
|
||||||
|
state: absent
|
||||||
|
when: cline_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
|
||||||
|
# Clean every cached download so retirement also removes outdated pins.
|
||||||
|
- name: Find cached Cline Desktop RPM downloads
|
||||||
|
ansible.builtin.find:
|
||||||
|
paths: /var/cache
|
||||||
|
patterns: "cline-desktop-*.rpm"
|
||||||
|
file_type: file
|
||||||
|
register: cline_desktop_cached_rpms
|
||||||
|
when: cline_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Remove cached Cline Desktop RPM downloads
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ cline_desktop_cached_rpms.files | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
|
when: cline_desktop_uninstall_enabled | default(false) | bool
|
||||||
@@ -25,20 +25,6 @@
|
|||||||
- "'workstation_dev_fedora' in group_names"
|
- "'workstation_dev_fedora' in group_names"
|
||||||
- fedora_manage_docker_repo | default(false)
|
- fedora_manage_docker_repo | default(false)
|
||||||
|
|
||||||
- name: Install COPR support on Fedora WSL
|
|
||||||
tags: [packages, mise]
|
|
||||||
ansible.builtin.dnf:
|
|
||||||
name: dnf-plugins-core
|
|
||||||
state: present
|
|
||||||
when: "'workstation_dev_wsl' in group_names"
|
|
||||||
|
|
||||||
- name: Configure Mise COPR repository on Fedora WSL
|
|
||||||
tags: [packages, mise]
|
|
||||||
community.general.copr:
|
|
||||||
name: jdxcode/mise
|
|
||||||
state: enabled
|
|
||||||
when: "'workstation_dev_wsl' in group_names"
|
|
||||||
|
|
||||||
- name: Install distribution signing keys for Fedora desktop codecs
|
- name: Install distribution signing keys for Fedora desktop codecs
|
||||||
tags: [packages, heic]
|
tags: [packages, heic]
|
||||||
ansible.builtin.dnf:
|
ansible.builtin.dnf:
|
||||||
@@ -66,12 +52,16 @@
|
|||||||
ansible.builtin.dnf:
|
ansible.builtin.dnf:
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
|
||||||
- name: Install HEIC decoder on Fedora desktops
|
- name: Install HEIC decoder when RPM Fusion has a compatible build
|
||||||
tags: [packages, heic]
|
tags: [packages, heic]
|
||||||
ansible.builtin.dnf:
|
ansible.builtin.dnf:
|
||||||
name: libheif-freeworld
|
name: libheif-freeworld
|
||||||
state: present
|
state: present
|
||||||
update_cache: true
|
update_cache: true
|
||||||
|
# libheif-freeworld requires the exact libheif build. RPM Fusion can lag
|
||||||
|
# Fedora Updates, so retry on later runs instead of blocking all desktop
|
||||||
|
# package convergence while the matching build is unavailable.
|
||||||
|
skip_broken: true
|
||||||
when: "'graphical_desktop' in group_names"
|
when: "'graphical_desktop' in group_names"
|
||||||
|
|
||||||
- name: Install packages on Fedora
|
- name: Install packages on Fedora
|
||||||
@@ -140,6 +130,10 @@
|
|||||||
name: "{{ item.value.npm_package }}"
|
name: "{{ item.value.npm_package }}"
|
||||||
global: true
|
global: true
|
||||||
state: latest
|
state: latest
|
||||||
|
register: ai_agent_npm_install
|
||||||
|
retries: "{{ ai_agents_npm_install_retries }}"
|
||||||
|
delay: "{{ ai_agents_npm_install_retry_delay }}"
|
||||||
|
until: ai_agent_npm_install is succeeded
|
||||||
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
|
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
|
||||||
when:
|
when:
|
||||||
- item.value.install_enabled | bool
|
- item.value.install_enabled | bool
|
||||||
@@ -160,55 +154,29 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.key }}"
|
label: "{{ item.key }}"
|
||||||
|
|
||||||
- name: Validate ChatGPT desktop architecture on Fedora
|
- name: Manage ChatGPT desktop lifecycle on Fedora graphical hosts
|
||||||
tags: [packages, chatgpt]
|
tags: [packages, chatgpt]
|
||||||
ansible.builtin.assert:
|
ansible.builtin.import_tasks: chatgpt_desktop.yml
|
||||||
that:
|
when:
|
||||||
- ansible_facts['architecture'] in chatgpt_desktop_supported_architectures
|
- "'graphical_desktop' in group_names"
|
||||||
- ansible_facts['distribution_major_version'] in chatgpt_desktop_supported_fedora_versions
|
- chatgpt_desktop_install_enabled | default(false) | bool
|
||||||
fail_msg: >-
|
or chatgpt_desktop_uninstall_enabled | default(false) | bool
|
||||||
ChatGPT desktop supports Fedora {{ chatgpt_desktop_supported_fedora_versions | join(' and ') }}
|
|
||||||
on x86_64 or aarch64; detected Fedora {{ ansible_facts['distribution_major_version'] }}
|
|
||||||
on {{ ansible_facts['architecture'] }}.
|
|
||||||
when: chatgpt_desktop_enabled | bool
|
|
||||||
|
|
||||||
- name: Install ChatGPT desktop RPM signing key
|
- name: Manage OpenCode Desktop lifecycle on Fedora graphical hosts
|
||||||
tags: [packages, chatgpt]
|
tags: [packages, opencode_desktop]
|
||||||
ansible.builtin.copy:
|
ansible.builtin.import_tasks: opencode_desktop.yml
|
||||||
src: "{{ chatgpt_desktop_rpm_gpg_key }}"
|
when:
|
||||||
dest: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
- "'graphical_desktop' in group_names"
|
||||||
owner: root
|
- opencode_desktop_install_enabled | default(false) | bool
|
||||||
group: root
|
or opencode_desktop_uninstall_enabled | default(false) | bool
|
||||||
mode: "0644"
|
|
||||||
when: chatgpt_desktop_enabled | bool
|
|
||||||
|
|
||||||
- name: Import ChatGPT desktop RPM signing key
|
- name: Manage Cline Desktop lifecycle on Fedora graphical hosts
|
||||||
tags: [packages, chatgpt]
|
tags: [packages, cline_desktop]
|
||||||
ansible.builtin.rpm_key:
|
ansible.builtin.import_tasks: cline_desktop.yml
|
||||||
state: present
|
when:
|
||||||
key: "/etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
- "'graphical_desktop' in group_names"
|
||||||
when: chatgpt_desktop_enabled | bool
|
- cline_desktop_install_enabled | default(false) | bool
|
||||||
|
or cline_desktop_uninstall_enabled | default(false) | bool
|
||||||
- name: Configure ChatGPT desktop RPM repository
|
|
||||||
tags: [packages, chatgpt]
|
|
||||||
ansible.builtin.yum_repository:
|
|
||||||
name: openai-chatgpt
|
|
||||||
description: ChatGPT
|
|
||||||
baseurl: "{{ chatgpt_desktop_rpm_repository }}"
|
|
||||||
enabled: true
|
|
||||||
gpgcheck: true
|
|
||||||
repo_gpgcheck: true
|
|
||||||
gpgkey: "file:///etc/pki/rpm-gpg/{{ chatgpt_desktop_rpm_gpg_key }}"
|
|
||||||
state: present
|
|
||||||
when: chatgpt_desktop_enabled | bool
|
|
||||||
|
|
||||||
- name: Install ChatGPT desktop on selected Fedora hosts
|
|
||||||
tags: [packages, chatgpt]
|
|
||||||
ansible.builtin.dnf:
|
|
||||||
name: chatgpt
|
|
||||||
state: latest
|
|
||||||
update_cache: true
|
|
||||||
when: chatgpt_desktop_enabled | bool
|
|
||||||
|
|
||||||
- name: Define Fedora Flatpak applications
|
- name: Define Fedora Flatpak applications
|
||||||
tags: [packages]
|
tags: [packages]
|
||||||
|
|||||||
78
ansible/roles/packages_fedora/tasks/opencode_desktop.yml
Normal file
78
ansible/roles/packages_fedora/tasks/opencode_desktop.yml
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
---
|
||||||
|
# OpenCode Desktop ships unsigned RPMs from its GitHub releases; only the
|
||||||
|
# checksum-verified download makes the local installation trustworthy.
|
||||||
|
- name: Validate OpenCode Desktop architecture on Fedora
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- ansible_facts['architecture'] in opencode_desktop_rpm_checksums
|
||||||
|
fail_msg: "No verified OpenCode Desktop RPM for {{ ansible_facts['architecture'] }}."
|
||||||
|
when: opencode_desktop_install_enabled | default(false) | bool
|
||||||
|
|
||||||
|
# Runs for both flows so the register below is always valid.
|
||||||
|
- name: Check for cached OpenCode Desktop RPM
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ opencode_desktop_rpm_path }}"
|
||||||
|
get_checksum: false
|
||||||
|
register: opencode_desktop_rpm_cache
|
||||||
|
|
||||||
|
- name: Download verified OpenCode Desktop RPM
|
||||||
|
ansible.builtin.get_url:
|
||||||
|
url: "{{ opencode_desktop_rpm_url }}"
|
||||||
|
dest: "{{ opencode_desktop_rpm_path }}"
|
||||||
|
checksum: "{{ opencode_desktop_rpm_checksums[ansible_facts['architecture']] }}"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0644"
|
||||||
|
# get_url only sends HEAD in check mode and cannot populate a cold cache.
|
||||||
|
when:
|
||||||
|
- opencode_desktop_install_enabled | default(false) | bool
|
||||||
|
- not ansible_check_mode
|
||||||
|
|
||||||
|
- name: Install OpenCode Desktop on Fedora
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: "{{ opencode_desktop_rpm_path }}"
|
||||||
|
state: present
|
||||||
|
# Upstream ships an unsigned RPM. The download above verifies its pinned
|
||||||
|
# SHA-256; do not disable signature checks in system repository settings.
|
||||||
|
disable_gpg_check: true
|
||||||
|
when:
|
||||||
|
- opencode_desktop_install_enabled | default(false) | bool
|
||||||
|
- not ansible_check_mode
|
||||||
|
or opencode_desktop_rpm_cache.stat.exists
|
||||||
|
|
||||||
|
- name: Explain OpenCode Desktop cold-cache check-mode limitation
|
||||||
|
ansible.builtin.debug:
|
||||||
|
msg: >-
|
||||||
|
A real run will download and SHA-256 verify OpenCode Desktop
|
||||||
|
{{ opencode_desktop_version }} before ensuring it is installed.
|
||||||
|
The RPM is not cached, so this dry run cannot validate DNF dependencies.
|
||||||
|
when:
|
||||||
|
- opencode_desktop_install_enabled | default(false) | bool
|
||||||
|
- ansible_check_mode
|
||||||
|
- not opencode_desktop_rpm_cache.stat.exists
|
||||||
|
|
||||||
|
# The `opencode` RPM package name is verified from the pinned release header;
|
||||||
|
# removal never touches the npm-managed opencode-ai CLI or user data.
|
||||||
|
- name: Remove OpenCode Desktop from Fedora
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: opencode
|
||||||
|
state: absent
|
||||||
|
when: opencode_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
|
||||||
|
# Clean every cached download so retirement also removes outdated pins.
|
||||||
|
- name: Find cached OpenCode Desktop RPM downloads
|
||||||
|
ansible.builtin.find:
|
||||||
|
paths: /var/cache
|
||||||
|
patterns: "opencode-desktop-*.rpm"
|
||||||
|
file_type: file
|
||||||
|
register: opencode_desktop_cached_rpms
|
||||||
|
when: opencode_desktop_uninstall_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Remove cached OpenCode Desktop RPM downloads
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ item.path }}"
|
||||||
|
state: absent
|
||||||
|
loop: "{{ opencode_desktop_cached_rpms.files | default([]) }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.path }}"
|
||||||
|
when: opencode_desktop_uninstall_enabled | default(false) | bool
|
||||||
@@ -18,6 +18,11 @@ atlas_nextcloud_redis_image: ""
|
|||||||
atlas_onlyoffice_image: ""
|
atlas_onlyoffice_image: ""
|
||||||
atlas_nextcloud_backup_root: "{{ atlas_mount_root }}/backup/nextcloud"
|
atlas_nextcloud_backup_root: "{{ atlas_mount_root }}/backup/nextcloud"
|
||||||
atlas_nextcloud_backup_keep: 2
|
atlas_nextcloud_backup_keep: 2
|
||||||
|
# A structurally complete bundle from an earlier verified run younger than
|
||||||
|
# this many seconds is reused instead of re-preparing. Keep it below 24h so
|
||||||
|
# the nightly Borg run, spaced 24h plus its randomized delay, always refreshes
|
||||||
|
# the bundle; 0 disables reuse.
|
||||||
|
atlas_nextcloud_backup_reuse_max_seconds: 72000
|
||||||
atlas_nextcloud_admin: admin
|
atlas_nextcloud_admin: admin
|
||||||
atlas_nextcloud_users: []
|
atlas_nextcloud_users: []
|
||||||
atlas_nextcloud_apps: []
|
atlas_nextcloud_apps: []
|
||||||
|
|||||||
@@ -3,11 +3,14 @@
|
|||||||
tags: [atlas, nextcloud_backup]
|
tags: [atlas, nextcloud_backup]
|
||||||
when: atlas_manage_nextcloud | bool
|
when: atlas_manage_nextcloud | bool
|
||||||
block:
|
block:
|
||||||
- name: Validate private backup scope and local bundle retention
|
- name: Validate private backup scope, retention, and bundle reuse window
|
||||||
ansible.builtin.assert:
|
ansible.builtin.assert:
|
||||||
that:
|
that:
|
||||||
- atlas_nextcloud_backup_root == atlas_mount_root ~ '/backup/nextcloud'
|
- atlas_nextcloud_backup_root == atlas_mount_root ~ '/backup/nextcloud'
|
||||||
- atlas_nextcloud_backup_keep | int >= 2
|
- atlas_nextcloud_backup_keep | int >= 2
|
||||||
|
- atlas_nextcloud_backup_reuse_max_seconds | int >= 0
|
||||||
|
# Below 24h the nightly Borg run cannot reuse the previous bundle.
|
||||||
|
- atlas_nextcloud_backup_reuse_max_seconds | int < 86400
|
||||||
- atlas_manage_borg_backup | bool
|
- atlas_manage_borg_backup | bool
|
||||||
- atlas_manage_usb_backup | bool
|
- atlas_manage_usb_backup | bool
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ StateDirectory=atlas-nextcloud-backup
|
|||||||
StateDirectoryMode=0700
|
StateDirectoryMode=0700
|
||||||
ExecStart=/usr/local/sbin/atlas-nextcloud-backup
|
ExecStart=/usr/local/sbin/atlas-nextcloud-backup
|
||||||
ExecStopPost=/usr/local/sbin/atlas-nextcloud-backup --recover
|
ExecStopPost=/usr/local/sbin/atlas-nextcloud-backup --recover
|
||||||
|
# systemctl set-environment ATLAS_NEXTCLOUD_BACKUP_FORCE=1 makes the next run
|
||||||
|
# ignore the bundle reuse window; unset the variable afterwards.
|
||||||
|
PassEnvironment=ATLAS_NEXTCLOUD_BACKUP_FORCE
|
||||||
TimeoutStartSec=3h
|
TimeoutStartSec=3h
|
||||||
TimeoutStopSec=5min
|
TimeoutStopSec=5min
|
||||||
Nice=10
|
Nice=10
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ readonly source_root={{ atlas_nextcloud_root | quote }}
|
|||||||
readonly backup_root={{ atlas_nextcloud_backup_root | quote }}
|
readonly backup_root={{ atlas_nextcloud_backup_root | quote }}
|
||||||
readonly state=/var/lib/atlas-nextcloud-backup
|
readonly state=/var/lib/atlas-nextcloud-backup
|
||||||
readonly keep={{ atlas_nextcloud_backup_keep | int }}
|
readonly keep={{ atlas_nextcloud_backup_keep | int }}
|
||||||
|
readonly reuse_max={{ atlas_nextcloud_backup_reuse_max_seconds | int }}
|
||||||
readonly owner={{ atlas_admin_username | quote }}
|
readonly owner={{ atlas_admin_username | quote }}
|
||||||
readonly uid={{ atlas_admin_uid | int }}
|
readonly uid={{ atlas_admin_uid | int }}
|
||||||
|
|
||||||
@@ -64,6 +65,36 @@ recover() {
|
|||||||
}
|
}
|
||||||
if [[ "${1:-}" == --recover ]]; then recover; exit; fi
|
if [[ "${1:-}" == --recover ]]; then recover; exit; fi
|
||||||
recover
|
recover
|
||||||
|
# Fast path: a structurally complete bundle from an earlier verified run is
|
||||||
|
# reused while younger than the reuse window, without pausing the applications.
|
||||||
|
# ATLAS_NEXTCLOUD_BACKUP_FORCE=1 ignores the window and prepares one anyway.
|
||||||
|
if [[ "${ATLAS_NEXTCLOUD_BACKUP_FORCE:-0}" != 1 ]] && [[ "$reuse_max" -gt 0 ]]; then
|
||||||
|
target="$(readlink -f "$backup_root/latest" 2>/dev/null || true)"
|
||||||
|
if [[ -n "$target" && "$target" == "$backup_root/versions/"* ]]; then
|
||||||
|
name="${target##*/}"
|
||||||
|
if [[ "$name" =~ ^[0-9]{8}T[0-9]{6}Z-[0-9]+$ ]]; then
|
||||||
|
bundle_utc="${name:0:4}-${name:4:2}-${name:6:2} ${name:9:2}:${name:11:2}:${name:13:2} UTC"
|
||||||
|
created="$(date -u -d "$bundle_utc" +%s 2>/dev/null || true)"
|
||||||
|
if [[ -n "$created" ]]; then
|
||||||
|
now="$(date -u +%s)"
|
||||||
|
if [[ "$((now - created))" -le "$reuse_max" ]]; then
|
||||||
|
reusable=true
|
||||||
|
for component in manifest.txt SHA256SUMS database.dump \
|
||||||
|
postgres-globals.sql database-toc.txt images.txt; do
|
||||||
|
[[ -s "$target/$component" ]] || { reusable=false; break; }
|
||||||
|
done
|
||||||
|
for component in app files; do
|
||||||
|
[[ -d "$target/$component" ]] || { reusable=false; break; }
|
||||||
|
done
|
||||||
|
if [[ "$reusable" == true ]]; then
|
||||||
|
echo "Reusing verified Nextcloud bundle $name (age $((now - created))s <= ${reuse_max}s); preparation skipped"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
[[ "$(zfs get -H -o value mounted "$dataset")" == yes ]]
|
[[ "$(zfs get -H -o value mounted "$dataset")" == yes ]]
|
||||||
[[ "$(zfs get -H -o value mountpoint "$dataset")" == "$source_root" ]]
|
[[ "$(zfs get -H -o value mountpoint "$dataset")" == "$source_root" ]]
|
||||||
[[ "$(zfs get -H -o value mounted {{ (atlas_zfs_pool ~ '/backup') | quote }})" == yes ]]
|
[[ "$(zfs get -H -o value mounted {{ (atlas_zfs_pool ~ '/backup') | quote }})" == yes ]]
|
||||||
|
|||||||
@@ -562,6 +562,10 @@
|
|||||||
name: "{{ item.value.npm_package }}"
|
name: "{{ item.value.npm_package }}"
|
||||||
global: true
|
global: true
|
||||||
state: latest
|
state: latest
|
||||||
|
register: ai_agent_npm_install
|
||||||
|
retries: "{{ ai_agents_npm_install_retries }}"
|
||||||
|
delay: "{{ ai_agents_npm_install_retry_delay }}"
|
||||||
|
until: ai_agent_npm_install is succeeded
|
||||||
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
|
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
|
||||||
when:
|
when:
|
||||||
- item.value.install_enabled | bool
|
- item.value.install_enabled | bool
|
||||||
|
|||||||
144
ansible/roles/profile_desktop_gnome/files/thunderbird_profile.py
Normal file
144
ansible/roles/profile_desktop_gnome/files/thunderbird_profile.py
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Read-only discovery and registry plan; never read stored login credentials."""
|
||||||
|
|
||||||
|
import configparser
|
||||||
|
import io
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def read_ini(path):
|
||||||
|
result = configparser.RawConfigParser()
|
||||||
|
result.optionxform = str
|
||||||
|
if path.exists():
|
||||||
|
with path.open() as source:
|
||||||
|
result.read_file(source)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def preferences(path):
|
||||||
|
if not path.exists():
|
||||||
|
return {}
|
||||||
|
result = {}
|
||||||
|
for key, value in re.findall(
|
||||||
|
r'^\s*user_pref\("([^"\n]+)",\s*(.*?)\);',
|
||||||
|
path.read_text(), re.MULTILINE,
|
||||||
|
):
|
||||||
|
try:
|
||||||
|
result[key] = json.loads(value)
|
||||||
|
except ValueError:
|
||||||
|
continue
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def has_account(path):
|
||||||
|
# user.js alone is only a bootstrap, not an account used by Thunderbird.
|
||||||
|
prefs = preferences(path / 'prefs.js')
|
||||||
|
for account in str(prefs.get('mail.accountmanager.accounts', '')).split(','):
|
||||||
|
server = prefs.get('mail.account.' + account.strip() + '.server')
|
||||||
|
prefix = 'mail.server.' + str(server) + '.'
|
||||||
|
if (prefs.get(prefix + 'type') in ('imap', 'pop3', 'nntp')
|
||||||
|
and prefs.get(prefix + 'hostname')):
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def profile_path(root, registry, section):
|
||||||
|
value = registry.get(section, 'Path')
|
||||||
|
return (root / value if registry.get(section, 'IsRelative', fallback='1') == '1'
|
||||||
|
else Path(value)).resolve()
|
||||||
|
|
||||||
|
|
||||||
|
def render(registry):
|
||||||
|
output = io.StringIO()
|
||||||
|
registry.write(output, space_around_delimiters=False)
|
||||||
|
return output.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
def plan(home, profile_dir, profile_name):
|
||||||
|
home = Path(home)
|
||||||
|
# A legacy directory takes precedence over the XDG registry on this build.
|
||||||
|
roots = [home / '.thunderbird', home / '.config/thunderbird']
|
||||||
|
root = next((p for p in roots if p.exists()), roots[1])
|
||||||
|
registries = {p: read_ini(p / 'profiles.ini') for p in roots}
|
||||||
|
candidates = []
|
||||||
|
install_ids = set()
|
||||||
|
for base, registry in registries.items():
|
||||||
|
installs = read_ini(base / 'installs.ini')
|
||||||
|
defaults = {registry.get(s, 'Default', fallback='')
|
||||||
|
for s in registry.sections() if s.startswith('Install')}
|
||||||
|
defaults.update(installs.get(s, 'Default', fallback='')
|
||||||
|
for s in installs.sections())
|
||||||
|
for section in registry.sections():
|
||||||
|
if not re.fullmatch(r'Profile\d+', section):
|
||||||
|
continue
|
||||||
|
path = profile_path(base, registry, section)
|
||||||
|
if has_account(path):
|
||||||
|
candidates.append((registry.get(section, 'Path') not in defaults,
|
||||||
|
base != root, str(path), path))
|
||||||
|
# Reuse installation associations, including those in the other root.
|
||||||
|
install_ids.update(s[7:] for s in registry.sections() if s.startswith('Install'))
|
||||||
|
install_ids.update(installs.sections())
|
||||||
|
# Also find unregistered profiles, without following arbitrary subtrees.
|
||||||
|
if base.exists():
|
||||||
|
for child in sorted(base.iterdir()):
|
||||||
|
if child.is_dir() and has_account(child):
|
||||||
|
candidates.append((True, base != root, str(child.resolve()), child.resolve()))
|
||||||
|
existing = bool(candidates)
|
||||||
|
selected = min(candidates)[3] if existing else root / profile_dir
|
||||||
|
if not existing:
|
||||||
|
number = 0
|
||||||
|
while selected.exists():
|
||||||
|
bootstrap = selected / 'user.js'
|
||||||
|
if (not (selected / 'prefs.js').exists() and bootstrap.exists()
|
||||||
|
and bootstrap.read_text().startswith('// Managed by Ansible from profile_desktop_gnome')):
|
||||||
|
break
|
||||||
|
number += 1
|
||||||
|
selected = root / (profile_dir + '-' + str(number))
|
||||||
|
registry = registries[root]
|
||||||
|
section = next((s for s in registry.sections()
|
||||||
|
if re.fullmatch(r'Profile\d+', s)
|
||||||
|
and profile_path(root, registry, s) == selected), None)
|
||||||
|
if section is None:
|
||||||
|
number = 0
|
||||||
|
while registry.has_section('Profile' + str(number)):
|
||||||
|
number += 1
|
||||||
|
section = 'Profile' + str(number)
|
||||||
|
registry.add_section(section)
|
||||||
|
registry.set(section, 'Name', profile_name if not existing else selected.name)
|
||||||
|
registry.set(section, 'IsRelative', '0')
|
||||||
|
registry.set(section, 'Path', str(selected))
|
||||||
|
for other in registry.sections():
|
||||||
|
if re.fullmatch(r'Profile\d+', other):
|
||||||
|
registry.remove_option(other, 'Default')
|
||||||
|
registry.set(section, 'Default', '1')
|
||||||
|
if not registry.has_section('General'):
|
||||||
|
registry.add_section('General')
|
||||||
|
registry.set('General', 'StartWithLastProfile', '1')
|
||||||
|
registry.set('General', 'Version', '2')
|
||||||
|
value = registry.get(section, 'Path')
|
||||||
|
installs = read_ini(root / 'installs.ini')
|
||||||
|
for install in sorted(install_ids):
|
||||||
|
# Do not redirect a separate installation with another configured account.
|
||||||
|
defaults = []
|
||||||
|
for base, source in registries.items():
|
||||||
|
default = source.get('Install' + install, 'Default', fallback='')
|
||||||
|
if not default:
|
||||||
|
default = read_ini(base / 'installs.ini').get(install, 'Default', fallback='')
|
||||||
|
if default:
|
||||||
|
defaults.append((base / default).resolve())
|
||||||
|
if any(p != selected and has_account(p) for p in defaults):
|
||||||
|
continue
|
||||||
|
for target, name in ((registry, 'Install' + install), (installs, install)):
|
||||||
|
if not target.has_section(name):
|
||||||
|
target.add_section(name)
|
||||||
|
target.set(name, 'Default', value)
|
||||||
|
target.set(name, 'Locked', '1')
|
||||||
|
return dict(root=str(root), profile=str(selected), existing_account=existing,
|
||||||
|
profiles_ini=render(registry), installs_ini=render(installs))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
print(json.dumps(plan(*sys.argv[1:])))
|
||||||
56
ansible/roles/profile_desktop_gnome/tasks/cline_desktop.yml
Normal file
56
ansible/roles/profile_desktop_gnome/tasks/cline_desktop.yml
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
- name: Find the installed Cline Desktop launcher
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "/usr/share/applications/{{ cline_desktop_launcher }}"
|
||||||
|
get_checksum: false
|
||||||
|
register: cline_desktop_launcher_stat
|
||||||
|
|
||||||
|
- name: Verify Cline Desktop installed its expected launcher
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that: cline_desktop_launcher_stat.stat.isreg | default(false)
|
||||||
|
fail_msg: "Cline Desktop did not install {{ cline_desktop_launcher }}."
|
||||||
|
when: not ansible_check_mode
|
||||||
|
|
||||||
|
- name: Find the GNOME account for the Cline favorite
|
||||||
|
ansible.builtin.getent:
|
||||||
|
database: passwd
|
||||||
|
key: "{{ username }}"
|
||||||
|
when: cline_desktop_launcher_stat.stat.isreg | default(false)
|
||||||
|
|
||||||
|
- name: Update only the Cline and OpenCode entries in GNOME favorites
|
||||||
|
become_user: "{{ username }}"
|
||||||
|
environment:
|
||||||
|
HOME: "{{ user_home }}"
|
||||||
|
XDG_RUNTIME_DIR: "/run/user/{{ ansible_facts.getent_passwd[username][1] }}"
|
||||||
|
DBUS_SESSION_BUS_ADDRESS: "unix:path=/run/user/{{ ansible_facts.getent_passwd[username][1] }}/bus"
|
||||||
|
when: cline_desktop_launcher_stat.stat.isreg | default(false)
|
||||||
|
block:
|
||||||
|
- name: Read the current GNOME favorites for Cline Desktop
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: [gsettings, get, org.gnome.shell, favorite-apps]
|
||||||
|
register: cline_gnome_favorites_current
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Pin the Cline Desktop launcher without reordering other favorites
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- gsettings
|
||||||
|
- set
|
||||||
|
- org.gnome.shell
|
||||||
|
- favorite-apps
|
||||||
|
- "{{ cline_gnome_favorites_desired | to_json }}"
|
||||||
|
vars:
|
||||||
|
cline_gnome_favorites_existing: "{{ cline_gnome_favorites_current.stdout | regex_replace('^@as ', '') | from_yaml }}"
|
||||||
|
cline_gnome_favorites_desired: >-
|
||||||
|
{%- set ns = namespace(apps=[]) -%}
|
||||||
|
{%- for app in cline_gnome_favorites_existing -%}
|
||||||
|
{%- set launcher = cline_desktop_launcher
|
||||||
|
if app in ['ai.opencode.desktop.desktop', 'opencode-desktop.desktop'] else app -%}
|
||||||
|
{%- if launcher != cline_desktop_launcher or launcher not in ns.apps -%}
|
||||||
|
{%- set ns.apps = ns.apps + [launcher] -%}
|
||||||
|
{%- endif -%}
|
||||||
|
{%- endfor -%}
|
||||||
|
{{ ns.apps if cline_desktop_launcher in ns.apps else ns.apps + [cline_desktop_launcher] }}
|
||||||
|
when: cline_gnome_favorites_desired != cline_gnome_favorites_existing
|
||||||
|
changed_when: true
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
owner: "{{ username }}"
|
owner: "{{ username }}"
|
||||||
group: "{{ user_group }}"
|
group: "{{ user_group }}"
|
||||||
mode: "{{ item.mode }}"
|
mode: "{{ item.mode }}"
|
||||||
loop: "{{ desktop_common_dotfiles | default([]) }}"
|
loop: "{{ (desktop_common_dotfiles | default([])) + (desktop_gnome_dotfiles | default([])) }}"
|
||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.dest }}"
|
label: "{{ item.dest }}"
|
||||||
|
|
||||||
@@ -279,3 +279,17 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item }}"
|
label: "{{ item }}"
|
||||||
when: workstation_firewall_backend | default('firewalld') == 'firewalld'
|
when: workstation_firewall_backend | default('firewalld') == 'firewalld'
|
||||||
|
|
||||||
|
- name: Configure Thunderbird for iCloud
|
||||||
|
tags: [dotfiles, dotfiles:desktop, gnome, thunderbird]
|
||||||
|
ansible.builtin.import_tasks: thunderbird.yml
|
||||||
|
when: thunderbird_icloud_enabled | default(false) | bool
|
||||||
|
|
||||||
|
- name: Configure native VS Code
|
||||||
|
tags: [vscode]
|
||||||
|
ansible.builtin.import_tasks: vscode.yml
|
||||||
|
|
||||||
|
- name: Pin Cline Desktop in GNOME
|
||||||
|
tags: [cline_desktop]
|
||||||
|
ansible.builtin.import_tasks: cline_desktop.yml
|
||||||
|
when: cline_desktop_install_enabled | default(false) | bool
|
||||||
|
|||||||
126
ansible/roles/profile_desktop_gnome/tasks/thunderbird.yml
Normal file
126
ansible/roles/profile_desktop_gnome/tasks/thunderbird.yml
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
---
|
||||||
|
- name: Inspect existing Thunderbird profiles without changing them
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv:
|
||||||
|
- "{{ ansible_facts.python.executable }}"
|
||||||
|
- -c
|
||||||
|
- "{{ lookup('ansible.builtin.file', role_path + '/files/thunderbird_profile.py') }}"
|
||||||
|
- "{{ user_home }}"
|
||||||
|
- "{{ thunderbird_profile_dir }}"
|
||||||
|
- "{{ thunderbird_profile_name }}"
|
||||||
|
become: true
|
||||||
|
become_user: "{{ username }}"
|
||||||
|
register: thunderbird_profile_probe
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Select an existing account or plan an iCloud bootstrap
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.set_fact:
|
||||||
|
thunderbird_selected: "{{ thunderbird_profile_probe.stdout | from_json }}"
|
||||||
|
|
||||||
|
- name: Require the iCloud address only when no configured account exists
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- vault_icloud_email is defined
|
||||||
|
- vault_icloud_email | length > 0
|
||||||
|
- vault_icloud_email != 'REPLACE_ME'
|
||||||
|
- vault_icloud_email is match('^[^@\\s]+@[^@\\s]+$')
|
||||||
|
fail_msg: >-
|
||||||
|
vault_icloud_email must hold the iCloud mail address before a new
|
||||||
|
Thunderbird profile can be provisioned.
|
||||||
|
quiet: true
|
||||||
|
when: not thunderbird_selected.existing_account
|
||||||
|
|
||||||
|
- name: Check whether Thunderbird is running
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: [pgrep, -u, "{{ username }}", -x, thunderbird]
|
||||||
|
register: thunderbird_running
|
||||||
|
changed_when: false
|
||||||
|
failed_when: thunderbird_running.rc not in [0, 1]
|
||||||
|
check_mode: false
|
||||||
|
|
||||||
|
- name: Require Thunderbird to be closed before selecting its profile
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that: thunderbird_running.rc == 1
|
||||||
|
fail_msg: Close Thunderbird before running the thunderbird tag; it is never stopped automatically.
|
||||||
|
|
||||||
|
- name: Create the selected Thunderbird registry directory
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ thunderbird_selected.root }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Create a new profile only when no configured account exists
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ thunderbird_selected.profile }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
when: not thunderbird_selected.existing_account
|
||||||
|
|
||||||
|
- name: Seed iCloud defaults only in a profile without a configured account
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: thunderbird/user.js.j2
|
||||||
|
dest: "{{ thunderbird_selected.profile }}/user.js"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0600"
|
||||||
|
force: false
|
||||||
|
no_log: true
|
||||||
|
when: not thunderbird_selected.existing_account
|
||||||
|
|
||||||
|
- name: Discover the Thunderbird installation directory for first-start profile adoption
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ item }}/application.ini"
|
||||||
|
loop: [/usr/lib64/thunderbird, /usr/lib/thunderbird]
|
||||||
|
register: thunderbird_installation
|
||||||
|
when: not thunderbird_selected.existing_account
|
||||||
|
|
||||||
|
- name: Seed compatibility information so Thunderbird adopts the new default profile
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: |
|
||||||
|
[Compatibility]
|
||||||
|
LastPlatformDir={{ item.item }}
|
||||||
|
LastAppDir={{ item.item }}
|
||||||
|
dest: "{{ thunderbird_selected.profile }}/compatibility.ini"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0600"
|
||||||
|
force: false
|
||||||
|
loop: "{{ thunderbird_installation.results }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.item }}"
|
||||||
|
when:
|
||||||
|
- not thunderbird_selected.existing_account
|
||||||
|
- item.stat.exists | default(false)
|
||||||
|
|
||||||
|
- name: Select the profile while preserving other registered profiles
|
||||||
|
tags: [thunderbird]
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: "{{ item.content }}"
|
||||||
|
dest: "{{ thunderbird_selected.root }}/{{ item.name }}"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0600"
|
||||||
|
backup: true
|
||||||
|
loop:
|
||||||
|
- name: profiles.ini
|
||||||
|
content: "{{ thunderbird_selected.profiles_ini }}"
|
||||||
|
- name: installs.ini
|
||||||
|
content: "{{ thunderbird_selected.installs_ini }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.name }}"
|
||||||
|
when: item.content | length > 0
|
||||||
70
ansible/roles/profile_desktop_gnome/tasks/vscode.yml
Normal file
70
ansible/roles/profile_desktop_gnome/tasks/vscode.yml
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
---
|
||||||
|
- name: Configure Microsoft VS Code repository
|
||||||
|
ansible.builtin.yum_repository:
|
||||||
|
name: code
|
||||||
|
description: Visual Studio Code
|
||||||
|
baseurl: https://packages.microsoft.com/yumrepos/vscode
|
||||||
|
enabled: true
|
||||||
|
gpgcheck: true
|
||||||
|
gpgkey: https://packages.microsoft.com/keys/microsoft.asc
|
||||||
|
|
||||||
|
- name: Install native VS Code
|
||||||
|
ansible.builtin.dnf:
|
||||||
|
name: code
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: List installed VS Code extensions
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: [code, --list-extensions]
|
||||||
|
become: true
|
||||||
|
become_user: "{{ username }}"
|
||||||
|
environment:
|
||||||
|
HOME: "{{ user_home }}"
|
||||||
|
register: vscode_installed_extensions
|
||||||
|
changed_when: false
|
||||||
|
check_mode: false
|
||||||
|
when:
|
||||||
|
- vscode_extensions | length > 0
|
||||||
|
- not ansible_check_mode
|
||||||
|
|
||||||
|
- name: Install missing VS Code extensions
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: [code, --install-extension, "{{ item }}"]
|
||||||
|
become: true
|
||||||
|
become_user: "{{ username }}"
|
||||||
|
environment:
|
||||||
|
HOME: "{{ user_home }}"
|
||||||
|
loop: "{{ vscode_extensions }}"
|
||||||
|
when:
|
||||||
|
- not ansible_check_mode
|
||||||
|
- item | lower not in (vscode_installed_extensions.stdout_lines | default([]) | map('lower') | list)
|
||||||
|
changed_when: true
|
||||||
|
|
||||||
|
- name: Ensure VS Code user configuration directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/.config/Code/User"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
when: vscode_settings is not none or vscode_keybindings | length > 0
|
||||||
|
|
||||||
|
- name: Deploy explicitly managed VS Code settings
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: "{{ user_home }}/.config/Code/User/settings.json"
|
||||||
|
content: "{{ vscode_settings | to_nice_json }}\n"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
|
when: vscode_settings is not none
|
||||||
|
|
||||||
|
- name: Deploy managed VS Code keybindings
|
||||||
|
ansible.builtin.copy:
|
||||||
|
dest: "{{ user_home }}/.config/Code/User/keybindings.json"
|
||||||
|
content: "{{ vscode_keybindings | to_nice_json }}\n"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
|
when: vscode_keybindings | length > 0
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// Managed by Ansible from profile_desktop_gnome (tag: thunderbird).
|
||||||
|
// Thunderbird rewrites prefs.js on exit, so the declared defaults live here
|
||||||
|
// and are re-applied at every start. Seeded only when no account exists;
|
||||||
|
// Ansible does not overwrite this file or configure an existing account.
|
||||||
|
//
|
||||||
|
// The account password is intentionally absent: iCloud mail requires an
|
||||||
|
// app-specific password, which Thunderbird prompts for and stores in its own
|
||||||
|
// credential store on first use.
|
||||||
|
|
||||||
|
// Mail account
|
||||||
|
user_pref("mail.accountmanager.accounts", "account1");
|
||||||
|
user_pref("mail.accountmanager.defaultaccount", "account1");
|
||||||
|
user_pref("mail.account.account1.server", "server1");
|
||||||
|
user_pref("mail.account.account1.identities", "id1");
|
||||||
|
|
||||||
|
user_pref("mail.server.server1.type", "imap");
|
||||||
|
user_pref("mail.server.server1.hostname", "{{ thunderbird_icloud_imap_host }}");
|
||||||
|
user_pref("mail.server.server1.port", {{ thunderbird_icloud_imap_port }});
|
||||||
|
user_pref("mail.server.server1.socketType", 3);
|
||||||
|
user_pref("mail.server.server1.authMethod", 3);
|
||||||
|
user_pref("mail.server.server1.userName", "{{ thunderbird_icloud_email }}");
|
||||||
|
user_pref("mail.server.server1.name", "{{ thunderbird_icloud_account_name }}");
|
||||||
|
user_pref("mail.server.server1.directory-rel", "[ProfD]ImapMail/{{ thunderbird_icloud_imap_host }}");
|
||||||
|
user_pref("mail.server.server1.directory", "{{ thunderbird_selected.profile }}/ImapMail/{{ thunderbird_icloud_imap_host }}");
|
||||||
|
user_pref("mail.server.server1.max_cached_connections", 5);
|
||||||
|
user_pref("mail.server.server1.check_new_mail", true);
|
||||||
|
user_pref("mail.server.server1.check_time", 10);
|
||||||
|
user_pref("mail.server.server1.login_at_startup", true);
|
||||||
|
user_pref("mail.server.server1.empty_trash", false);
|
||||||
|
|
||||||
|
user_pref("mail.identity.id1.fullName", "{{ thunderbird_full_name }}");
|
||||||
|
user_pref("mail.identity.id1.useremail", "{{ thunderbird_icloud_email }}");
|
||||||
|
user_pref("mail.identity.id1.valid", true);
|
||||||
|
user_pref("mail.identity.id1.smtpServer", "smtp1");
|
||||||
|
user_pref("mail.identity.id1.compose_html", true);
|
||||||
|
user_pref("mail.identity.id1.fcc_folder", "mailbox://{{ thunderbird_icloud_email }}@{{ thunderbird_icloud_imap_host }}/Sent%20Messages");
|
||||||
|
user_pref("mail.identity.id1.draft_folder", "mailbox://{{ thunderbird_icloud_email }}@{{ thunderbird_icloud_imap_host }}/Drafts");
|
||||||
|
|
||||||
|
user_pref("mail.smtpservers", "smtp1");
|
||||||
|
user_pref("mail.smtpserver.smtp1.hostname", "{{ thunderbird_icloud_smtp_host }}");
|
||||||
|
user_pref("mail.smtpserver.smtp1.port", {{ thunderbird_icloud_smtp_port }});
|
||||||
|
user_pref("mail.smtpserver.smtp1.try_ssl", 2);
|
||||||
|
user_pref("mail.smtpserver.smtp1.authMethod", 3);
|
||||||
|
user_pref("mail.smtpserver.smtp1.username", "{{ thunderbird_icloud_email }}");
|
||||||
|
user_pref("mail.smtpserver.smtp1.description", "{{ thunderbird_icloud_account_name }} SMTP");
|
||||||
|
|
||||||
|
// Calendar (CalDAV). Calendars are discovered from the registry branch.
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.type", "caldav");
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.name", "{{ thunderbird_icloud_account_name }}");
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.uri", "{{ thunderbird_icloud_caldav_url }}");
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.username", "{{ thunderbird_icloud_email }}");
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.refreshInterval", 30);
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.readOnly", false);
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.disabled", false);
|
||||||
|
user_pref("calendar.registry.{{ thunderbird_icloud_calendar_id }}.color", "#3a87ad");
|
||||||
|
user_pref("calendar.list.sortOrder", "{{ thunderbird_icloud_calendar_id }}");
|
||||||
|
|
||||||
|
// Address book (CardDAV). dirType 102 is nsIAbManager.CARDDAV_DIRECTORY_TYPE.
|
||||||
|
user_pref("ldap_2.servers.icloud.dirType", 102);
|
||||||
|
user_pref("ldap_2.servers.icloud.uid", "{{ thunderbird_icloud_addressbook_uid }}");
|
||||||
|
user_pref("ldap_2.servers.icloud.description", "{{ thunderbird_icloud_account_name }}");
|
||||||
|
user_pref("ldap_2.servers.icloud.filename", "abook-icloud.sqlite");
|
||||||
|
user_pref("ldap_2.servers.icloud.isOffline", false);
|
||||||
|
user_pref("ldap_2.servers.icloud.position", 3);
|
||||||
|
user_pref("ldap_2.servers.icloud.carddav.url", "{{ thunderbird_icloud_carddav_url }}");
|
||||||
|
user_pref("ldap_2.servers.icloud.carddav.username", "{{ thunderbird_icloud_email }}");
|
||||||
@@ -42,6 +42,10 @@
|
|||||||
global: true
|
global: true
|
||||||
state: latest
|
state: latest
|
||||||
become: true
|
become: true
|
||||||
|
register: ai_agent_npm_install
|
||||||
|
retries: "{{ ai_agents_npm_install_retries }}"
|
||||||
|
delay: "{{ ai_agents_npm_install_retry_delay }}"
|
||||||
|
until: ai_agent_npm_install is succeeded
|
||||||
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
|
loop: "{{ ai_agents | dict2items | selectattr('value.npm_package', 'defined') | list }}"
|
||||||
when:
|
when:
|
||||||
- item.value.install_enabled | bool
|
- item.value.install_enabled | bool
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
ARG MAVEN_VERSION=3.9.16
|
||||||
|
ARG NODE_VERSION=20.18.3
|
||||||
|
FROM docker.io/library/maven:${MAVEN_VERSION}-eclipse-temurin-25 AS maven
|
||||||
|
FROM docker.io/library/node:${NODE_VERSION}-bookworm-slim AS node
|
||||||
|
# Java 25 runs both the application and the language servers.
|
||||||
|
FROM mcr.microsoft.com/devcontainers/java:25-bookworm
|
||||||
|
USER root
|
||||||
|
COPY --from=maven /usr/share/maven/ /usr/share/maven/
|
||||||
|
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
||||||
|
COPY --from=node /usr/local/lib/node_modules/npm/ /usr/local/lib/node_modules/npm/
|
||||||
|
RUN ln -s /usr/share/maven/bin/mvn /usr/local/bin/mvn \
|
||||||
|
&& ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
||||||
|
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
|
||||||
|
&& java -version \
|
||||||
|
&& mvn -v \
|
||||||
|
&& node --version \
|
||||||
|
&& npm install --global --no-audit --no-fund @anthropic-ai/claude-code@2.1.312 cline@3.0.74 \
|
||||||
|
&& npm cache clean --force
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends bash-completion ca-certificates curl fzf git git-lfs gnupg openssh-client zoxide \
|
||||||
|
&& arch="$(dpkg --print-architecture)" \
|
||||||
|
&& case "$arch" in \
|
||||||
|
amd64) sha256=ea4f0222950ee750a3d38dd80d03bce4cee07a3f63928fc47548383bcaf23093 ;; \
|
||||||
|
arm64) sha256=0edc36cf514f1bd84becac3e94ee8ae9f8818c6a1f99f7b2ee67b362afa253d3 ;; \
|
||||||
|
*) echo "Unsupported architecture for delta: $arch" >&2; exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl -fsSL --retry 3 "https://github.com/dandavison/delta/releases/download/0.19.2/git-delta_0.19.2_${arch}.deb" -o /tmp/git-delta.deb \
|
||||||
|
&& echo "$sha256 /tmp/git-delta.deb" | sha256sum -c - \
|
||||||
|
&& apt-get install -y --no-install-recommends /tmp/git-delta.deb \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/git-delta.deb
|
||||||
|
ARG KUBECTL_VERSION=1.37.1
|
||||||
|
ARG HELM_VERSION=4.2.2
|
||||||
|
RUN arch="$(dpkg --print-architecture)" \
|
||||||
|
&& case "$arch" in \
|
||||||
|
amd64) kubectl_sha=65691ff77eb6fa44c908b77a1082c9f092c3b9733b5cefabec0d1104890e21a8; helm_sha=9adafecab4d406853bba163a70e9f104f47dbbf65ce24b7653bae7e36150bcb6 ;; \
|
||||||
|
arm64) kubectl_sha=ff749f4b78d9c4f1ec87307df9b50119ed819e2094aa9810cb9acffc3286c8c7; helm_sha=78803142087a0069fa4b50d3f32a84d3ef25c14d1ee8a40fbccf86a6216d2f36 ;; \
|
||||||
|
*) echo "Unsupported architecture for kubectl/helm: $arch" >&2; exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl -fsSL --retry 3 "https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/${arch}/kubectl" -o /tmp/kubectl \
|
||||||
|
&& echo "$kubectl_sha /tmp/kubectl" | sha256sum -c - \
|
||||||
|
&& install -m 0755 /tmp/kubectl /usr/local/bin/kubectl \
|
||||||
|
&& curl -fsSL --retry 3 "https://get.helm.sh/helm-v${HELM_VERSION}-linux-${arch}.tar.gz" -o /tmp/helm.tgz \
|
||||||
|
&& echo "$helm_sha /tmp/helm.tgz" | sha256sum -c - \
|
||||||
|
&& tar -xzf /tmp/helm.tgz -C /tmp "linux-${arch}/helm" \
|
||||||
|
&& install -m 0755 "/tmp/linux-${arch}/helm" /usr/local/bin/helm \
|
||||||
|
&& rm -rf /tmp/kubectl /tmp/helm.tgz "/tmp/linux-${arch}" \
|
||||||
|
&& kubectl version --client \
|
||||||
|
&& helm version --short
|
||||||
|
ARG GLAB_VERSION=1.114.0
|
||||||
|
RUN arch="$(dpkg --print-architecture)" \
|
||||||
|
&& case "$arch" in \
|
||||||
|
amd64) sha256=6df680f88a2a45700d1dd6a08a44a74838473ef3dcc5cb1ad243f4d1fd704ad0 ;; \
|
||||||
|
arm64) sha256=c2bcb44cc10d849cccb879e687f3b9e102a3415c3d02f0cecfd9ce1442519350 ;; \
|
||||||
|
*) echo "Unsupported architecture for glab: $arch" >&2; exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl -fsSL --retry 3 "https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/glab_${GLAB_VERSION}_linux_${arch}.deb" -o /tmp/glab.deb \
|
||||||
|
&& echo "$sha256 /tmp/glab.deb" | sha256sum -c - \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends /tmp/glab.deb \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/glab.deb \
|
||||||
|
&& glab --version
|
||||||
|
COPY --chown=vscode:vscode bashrc /home/vscode/.bashrc
|
||||||
|
COPY --chown=vscode:vscode bashrc.aliases /home/vscode/.bashrc.aliases
|
||||||
|
USER vscode
|
||||||
|
# Keep this file writable so VS Code can register its Git credential helper.
|
||||||
|
RUN git config --file /home/vscode/.gitconfig include.path /run/ecaas-git/gitconfig
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
ARG MAVEN_VERSION=3.9.16
|
||||||
|
FROM docker.io/library/maven:${MAVEN_VERSION}-eclipse-temurin-11 AS maven
|
||||||
|
FROM docker.io/library/node:22.23.4-bookworm-slim AS node
|
||||||
|
# Java 21 runs the language servers only. The final image keeps Java 11 on PATH.
|
||||||
|
FROM mcr.microsoft.com/devcontainers/java:21-bookworm AS ide
|
||||||
|
FROM mcr.microsoft.com/devcontainers/java:11-bookworm
|
||||||
|
USER root
|
||||||
|
COPY --from=ide /usr/lib/jvm/msopenjdk-current/ /opt/jdk-21/
|
||||||
|
COPY --from=maven /usr/share/maven/ /usr/share/maven/
|
||||||
|
COPY --from=node /usr/local/bin/node /usr/local/bin/node
|
||||||
|
COPY --from=node /usr/local/lib/node_modules/npm/ /usr/local/lib/node_modules/npm/
|
||||||
|
RUN ln -s /usr/share/maven/bin/mvn /usr/local/bin/mvn \
|
||||||
|
&& ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
|
||||||
|
&& ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
|
||||||
|
&& java -version \
|
||||||
|
&& /opt/jdk-21/bin/java -version \
|
||||||
|
&& mvn -v \
|
||||||
|
&& npm install --global --no-audit --no-fund @anthropic-ai/claude-code@2.1.312 cline@3.0.74 \
|
||||||
|
&& npm cache clean --force
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends bash-completion ca-certificates curl fzf git git-lfs gnupg openssh-client zoxide \
|
||||||
|
&& arch="$(dpkg --print-architecture)" \
|
||||||
|
&& case "$arch" in \
|
||||||
|
amd64) sha256=ea4f0222950ee750a3d38dd80d03bce4cee07a3f63928fc47548383bcaf23093 ;; \
|
||||||
|
arm64) sha256=0edc36cf514f1bd84becac3e94ee8ae9f8818c6a1f99f7b2ee67b362afa253d3 ;; \
|
||||||
|
*) echo "Unsupported architecture for delta: $arch" >&2; exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl -fsSL --retry 3 "https://github.com/dandavison/delta/releases/download/0.19.2/git-delta_0.19.2_${arch}.deb" -o /tmp/git-delta.deb \
|
||||||
|
&& echo "$sha256 /tmp/git-delta.deb" | sha256sum -c - \
|
||||||
|
&& apt-get install -y --no-install-recommends /tmp/git-delta.deb \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/git-delta.deb
|
||||||
|
ARG GLAB_VERSION=1.114.0
|
||||||
|
RUN arch="$(dpkg --print-architecture)" \
|
||||||
|
&& case "$arch" in \
|
||||||
|
amd64) sha256=6df680f88a2a45700d1dd6a08a44a74838473ef3dcc5cb1ad243f4d1fd704ad0 ;; \
|
||||||
|
arm64) sha256=c2bcb44cc10d849cccb879e687f3b9e102a3415c3d02f0cecfd9ce1442519350 ;; \
|
||||||
|
*) echo "Unsupported architecture for glab: $arch" >&2; exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl -fsSL --retry 3 "https://gitlab.com/gitlab-org/cli/-/releases/v${GLAB_VERSION}/downloads/glab_${GLAB_VERSION}_linux_${arch}.deb" -o /tmp/glab.deb \
|
||||||
|
&& echo "$sha256 /tmp/glab.deb" | sha256sum -c - \
|
||||||
|
&& apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends /tmp/glab.deb \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/glab.deb \
|
||||||
|
&& glab --version
|
||||||
|
COPY --chown=vscode:vscode bashrc /home/vscode/.bashrc
|
||||||
|
COPY --chown=vscode:vscode bashrc.aliases /home/vscode/.bashrc.aliases
|
||||||
|
USER vscode
|
||||||
|
# Keep this file writable so VS Code can register its Git credential helper.
|
||||||
|
RUN git config --file /home/vscode/.gitconfig include.path /run/ecaas-git/gitconfig
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
---
|
||||||
|
- name: Refuse to deploy the cdp workspace outside WSL
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- "'wsl2' in (ansible_facts.kernel | default('') | lower)"
|
||||||
|
- ansible_facts.distribution | default('') == 'Fedora'
|
||||||
|
fail_msg: Run this deployment from the Fedora WSL 2 distribution on deadalus.
|
||||||
|
|
||||||
|
- name: Prepare the cdp workspace and private configuration
|
||||||
|
vars:
|
||||||
|
ecaas_agent_state: "{{ user_home }}/.local/state/ecaas-devcontainer"
|
||||||
|
ecaas_git_available_cas: >-
|
||||||
|
{{ ecaas_git_ca_probe.results | selectattr('stat.isreg', 'defined') |
|
||||||
|
selectattr('stat.isreg') | map(attribute='item') | list }}
|
||||||
|
block:
|
||||||
|
- name: Prepare the shared Git configuration
|
||||||
|
ansible.builtin.import_tasks: ecaas_git.yml
|
||||||
|
|
||||||
|
- name: Ensure the cdp dev container directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ workstation_cdp_workspace }}/.devcontainer"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Ensure the local Maven directory mounted into the container exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/.m2"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Ensure the local Kubernetes directory mounted into the container exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/.kube"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Ensure the persistent Bash history directory mounted into the container exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/.local/state/devcontainer-bash-history/cdp"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Ensure the private ecaas Git state directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ ecaas_agent_state }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Ensure the local agent configuration directories mounted into the container exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/{{ item.path }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "{{ item.mode }}"
|
||||||
|
loop:
|
||||||
|
- { path: .claude, mode: "0700" }
|
||||||
|
- { path: .cline, mode: "0700" }
|
||||||
|
- { path: .agents, mode: "0755" }
|
||||||
|
- { path: .config/ai, mode: "0755" }
|
||||||
|
- { path: .config/glab-cli, mode: "0700" }
|
||||||
|
|
||||||
|
- name: Deploy the cdp dev container configuration
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: cdp-devcontainer.json.j2
|
||||||
|
dest: "{{ workstation_cdp_workspace }}/.devcontainer/devcontainer.json"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
|
|
||||||
|
- name: Deploy the cdp dev container build files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ workstation_cdp_workspace }}/.devcontainer/{{ item.dest }}"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
|
loop:
|
||||||
|
- src: cdp-devcontainer.Dockerfile
|
||||||
|
dest: Dockerfile
|
||||||
|
- src: "{{ playbook_dir }}/../dotfiles/common/.bashrc"
|
||||||
|
dest: bashrc
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.dest }}"
|
||||||
|
|
||||||
|
- name: Deploy the shared Bash aliases without the production tunnel
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: >-
|
||||||
|
{{ lookup('ansible.builtin.file', playbook_dir ~ '/../dotfiles/common/.bashrc.aliases')
|
||||||
|
| regex_replace('(?m)^(#[^\n]*Nginx Proxy Manager[^\n]*\n)?alias npm-tunnel=[^\n]*\n?', '') }}
|
||||||
|
dest: "{{ workstation_cdp_workspace }}/.devcontainer/bashrc.aliases"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
@@ -0,0 +1,130 @@
|
|||||||
|
---
|
||||||
|
- name: Refuse to deploy the ecaas workspace outside WSL
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- "'wsl2' in (ansible_facts.kernel | default('') | lower)"
|
||||||
|
- ansible_facts.distribution | default('') == 'Fedora'
|
||||||
|
fail_msg: Run this deployment from the Fedora WSL 2 distribution on deadalus.
|
||||||
|
|
||||||
|
- name: Prepare the ecaas workspace and private configuration
|
||||||
|
vars:
|
||||||
|
ecaas_agent_state: "{{ user_home }}/.local/state/ecaas-devcontainer"
|
||||||
|
ecaas_git_available_cas: >-
|
||||||
|
{{ ecaas_git_ca_probe.results | selectattr('stat.isreg', 'defined') |
|
||||||
|
selectattr('stat.isreg') | map(attribute='item') | list }}
|
||||||
|
block:
|
||||||
|
- name: Prepare the ecaas Git configuration
|
||||||
|
ansible.builtin.import_tasks: ecaas_git.yml
|
||||||
|
|
||||||
|
- name: Ensure the ecaas dev container directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ workstation_ecaas_workspace }}/.devcontainer"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Ensure the local Maven directory mounted into the container exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/.m2"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Ensure the persistent Bash history directory mounted into the container exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/.local/state/devcontainer-bash-history/ecaas"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Ensure the private ecaas Git state directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ ecaas_agent_state }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Ensure the local agent configuration directories mounted into the container exist
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ user_home }}/{{ item.path }}"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "{{ item.mode }}"
|
||||||
|
loop:
|
||||||
|
- { path: .claude, mode: "0700" }
|
||||||
|
- { path: .cline, mode: "0700" }
|
||||||
|
- { path: .agents, mode: "0755" }
|
||||||
|
- { path: .config/ai, mode: "0755" }
|
||||||
|
- { path: .config/glab-cli, mode: "0700" }
|
||||||
|
|
||||||
|
- name: Read the WSL Claude account state
|
||||||
|
ansible.builtin.slurp:
|
||||||
|
src: "{{ user_home }}/.claude.json"
|
||||||
|
register: ecaas_claude_account_state
|
||||||
|
failed_when: false
|
||||||
|
no_log: true
|
||||||
|
|
||||||
|
- name: Read the Claude state used when CLAUDE_CONFIG_DIR is set
|
||||||
|
ansible.builtin.slurp:
|
||||||
|
src: "{{ user_home }}/.claude/.claude.json"
|
||||||
|
register: ecaas_claude_dir_state
|
||||||
|
failed_when: false
|
||||||
|
no_log: true
|
||||||
|
|
||||||
|
- name: Seed missing Claude account and onboarding state for the container
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: >-
|
||||||
|
{{ (ecaas_claude_account_state.content | b64decode | from_json
|
||||||
|
| dict2items
|
||||||
|
| selectattr('key', 'in', ['oauthAccount', 'hasCompletedOnboarding', 'userID'])
|
||||||
|
| items2dict)
|
||||||
|
| combine(ecaas_claude_dir_state.content | default('e30=' | b64encode) | b64decode | from_json)
|
||||||
|
| to_nice_json }}
|
||||||
|
dest: "{{ user_home }}/.claude/.claude.json"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0600"
|
||||||
|
when: ecaas_claude_account_state.content is defined
|
||||||
|
no_log: true
|
||||||
|
diff: false
|
||||||
|
|
||||||
|
- name: Deploy the ecaas dev container configuration
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: ecaas-devcontainer.json.j2
|
||||||
|
dest: "{{ workstation_ecaas_workspace }}/.devcontainer/devcontainer.json"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
|
|
||||||
|
- name: Deploy the ecaas dev container build files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ item.src }}"
|
||||||
|
dest: "{{ workstation_ecaas_workspace }}/.devcontainer/{{ item.dest }}"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
|
loop:
|
||||||
|
- src: ecaas-devcontainer.Dockerfile
|
||||||
|
dest: Dockerfile
|
||||||
|
- src: "{{ playbook_dir }}/../dotfiles/common/.bashrc"
|
||||||
|
dest: bashrc
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.dest }}"
|
||||||
|
|
||||||
|
- name: Deploy the shared Bash aliases without the production tunnel
|
||||||
|
ansible.builtin.copy:
|
||||||
|
content: >-
|
||||||
|
{{ lookup('ansible.builtin.file', playbook_dir ~ '/../dotfiles/common/.bashrc.aliases')
|
||||||
|
| regex_replace('(?m)^(#[^\n]*Nginx Proxy Manager[^\n]*\n)?alias npm-tunnel=[^\n]*\n?', '') }}
|
||||||
|
dest: "{{ workstation_ecaas_workspace }}/.devcontainer/bashrc.aliases"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
backup: true
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
---
|
||||||
|
- name: Locate the Git CA files configured for the workstation
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ user_home }}/.local/share/certs/{{ item.certificate }}"
|
||||||
|
follow: true
|
||||||
|
get_checksum: false
|
||||||
|
get_mime: false
|
||||||
|
loop: "{{ workstation_git_https_cas }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.certificate }}"
|
||||||
|
register: ecaas_git_ca_probe
|
||||||
|
|
||||||
|
- name: Require the ecaas Git CA before deploying the dev container
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- workstation_ecaas_git_required_ca in (ecaas_git_available_cas | map(attribute='certificate') | list)
|
||||||
|
fail_msg: "Install the existing workstation CA at {{ user_home }}/.local/share/certs/{{ workstation_ecaas_git_required_ca }} first."
|
||||||
|
|
||||||
|
- name: Verify the available Git CA files are public PEM certificates
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
if grep -q -- 'PRIVATE KEY-----' "$ECAAS_GIT_CA"; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
openssl x509 -in "$ECAAS_GIT_CA" -noout
|
||||||
|
environment:
|
||||||
|
ECAAS_GIT_CA: "{{ user_home }}/.local/share/certs/{{ item.item.certificate }}"
|
||||||
|
become_user: "{{ username }}"
|
||||||
|
check_mode: false
|
||||||
|
changed_when: false
|
||||||
|
when: item.stat.isreg | default(false)
|
||||||
|
loop: "{{ ecaas_git_ca_probe.results }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.item.certificate }}"
|
||||||
|
|
||||||
|
- name: Ensure the private ecaas Git configuration directory exists
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ ecaas_agent_state }}/git"
|
||||||
|
state: directory
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0700"
|
||||||
|
|
||||||
|
- name: Render the workstation Git configuration for the ecaas container
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: "{{ playbook_dir }}/templates/workstation/.gitconfig.j2"
|
||||||
|
dest: "{{ ecaas_agent_state }}/git/gitconfig"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0600"
|
||||||
|
vars:
|
||||||
|
workstation_git_in_devcontainer: true
|
||||||
|
workstation_git_container_cas: "{{ ecaas_git_available_cas }}"
|
||||||
|
no_log: true
|
||||||
|
diff: false
|
||||||
|
|
||||||
|
- name: Deploy the workstation Git ignore and delta theme files
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "{{ playbook_dir }}/../dotfiles/workstation/{{ item }}"
|
||||||
|
dest: "{{ ecaas_agent_state }}/git/{{ item }}"
|
||||||
|
owner: "{{ username }}"
|
||||||
|
group: "{{ user_group }}"
|
||||||
|
mode: "0644"
|
||||||
|
loop:
|
||||||
|
- .gitignore_global
|
||||||
|
- .themes.gitignore
|
||||||
@@ -1,4 +1,14 @@
|
|||||||
---
|
---
|
||||||
|
- name: Deploy the ecaas Java 11 dev container
|
||||||
|
ansible.builtin.import_tasks: ecaas_devcontainer.yml
|
||||||
|
when: workstation_ecaas_workspace is defined
|
||||||
|
tags: [ecaas_devcontainer]
|
||||||
|
|
||||||
|
- name: Deploy the cdp Java 25 dev container
|
||||||
|
ansible.builtin.import_tasks: cdp_devcontainer.yml
|
||||||
|
when: workstation_cdp_workspace is defined
|
||||||
|
tags: [cdp_devcontainer]
|
||||||
|
|
||||||
- name: Ensure Windows Emacs authoring directories exist
|
- name: Ensure Windows Emacs authoring directories exist
|
||||||
tags: [dotfiles, dotfiles:workstation, emacs, wsl]
|
tags: [dotfiles, dotfiles:workstation, emacs, wsl]
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
@@ -55,51 +65,6 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.dest }}"
|
label: "{{ item.dest }}"
|
||||||
|
|
||||||
- name: Check whether the pinned Java version is installed with Mise
|
|
||||||
tags: [packages, mise, java, wsl]
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "mise where java@{{ workstation_mise_java_version }}"
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
environment:
|
|
||||||
HOME: "{{ user_home }}"
|
|
||||||
register: workstation_mise_java_where
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Check whether the pinned Java 25 version is installed with Mise
|
|
||||||
tags: [packages, mise, java, wsl]
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "mise where java@{{ workstation_mise_java_25_version }}"
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
environment:
|
|
||||||
HOME: "{{ user_home }}"
|
|
||||||
register: workstation_mise_java_25_where
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Check whether the pinned Maven version is installed with Mise
|
|
||||||
tags: [packages, mise, maven, wsl]
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: "mise where maven@{{ workstation_mise_maven_version }}"
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
environment:
|
|
||||||
HOME: "{{ user_home }}"
|
|
||||||
register: workstation_mise_maven_where
|
|
||||||
changed_when: false
|
|
||||||
failed_when: false
|
|
||||||
|
|
||||||
- name: Install the pinned Mise tools
|
|
||||||
tags: [packages, mise, java, maven, wsl]
|
|
||||||
ansible.builtin.command:
|
|
||||||
cmd: mise install
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
environment:
|
|
||||||
HOME: "{{ user_home }}"
|
|
||||||
when: >-
|
|
||||||
workstation_mise_java_where.rc != 0 or
|
|
||||||
workstation_mise_java_25_where.rc != 0 or
|
|
||||||
workstation_mise_maven_where.rc != 0
|
|
||||||
|
|
||||||
- name: Ensure WSL boot configuration file exists
|
- name: Ensure WSL boot configuration file exists
|
||||||
tags: [packages, services]
|
tags: [packages, services]
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"name": "cdp — Java 25 / Node 20",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"args": {
|
||||||
|
"MAVEN_VERSION": {{ workstation_maven_version | to_json }},
|
||||||
|
"NODE_VERSION": {{ workstation_cdp_node_version | to_json }}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"updateRemoteUserUID": true,
|
||||||
|
"containerEnv": {
|
||||||
|
"CLAUDE_CONFIG_DIR": "/home/vscode/.claude",
|
||||||
|
"HISTFILE": "/home/vscode/.bash_history.d/history"
|
||||||
|
},
|
||||||
|
"remoteEnv": {
|
||||||
|
"ANTHROPIC_AUTH_TOKEN": "${localEnv:ANTHROPIC_AUTH_TOKEN}"
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
|
||||||
|
"moby": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mounts": [
|
||||||
|
{{ ('type=bind,source=' ~ ecaas_agent_state ~ '/git,target=/run/ecaas-git,readonly') | to_json }},
|
||||||
|
{% for ca in ecaas_git_available_cas %}
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.local/share/certs/' ~ ca.certificate ~ ',target=/run/ecaas-git-ca/' ~ ca.certificate ~ ',readonly') | to_json }},
|
||||||
|
{% endfor %}
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.config/ai,target=/home/vscode/.config/ai,readonly') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.local/state/devcontainer-bash-history/cdp,target=/home/vscode/.bash_history.d') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.claude,target=/home/vscode/.claude') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.cline,target=/home/vscode/.cline') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.agents,target=/home/vscode/.agents,readonly') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.m2,target=/home/vscode/.m2') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.config/glab-cli,target=/home/vscode/.config/glab-cli') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.kube,target=/home/vscode/.kube') | to_json }}
|
||||||
|
],
|
||||||
|
"forwardPorts": [4200, 4201, 4202, 4210, 8083, 8084],
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"vscjava.vscode-java-pack",
|
||||||
|
"vmware.vscode-boot-dev-pack",
|
||||||
|
"redhat.vscode-xml",
|
||||||
|
"redhat.vscode-yaml",
|
||||||
|
"ms-kubernetes-tools.vscode-kubernetes-tools",
|
||||||
|
"angular.ng-template",
|
||||||
|
"dbaeumer.vscode-eslint",
|
||||||
|
"saoudrizwan.claude-dev",
|
||||||
|
"emmanuelbeziat.vscode-great-icons"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"workbench.iconTheme": "vscode-great-icons",
|
||||||
|
"java.configuration.runtimes": [
|
||||||
|
{
|
||||||
|
"name": "JavaSE-25",
|
||||||
|
"path": "/usr/lib/jvm/msopenjdk-current",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
{
|
||||||
|
"name": "ecaas — Java 11",
|
||||||
|
"build": {
|
||||||
|
"dockerfile": "Dockerfile",
|
||||||
|
"args": {
|
||||||
|
"MAVEN_VERSION": {{ workstation_maven_version | to_json }}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"remoteUser": "vscode",
|
||||||
|
"updateRemoteUserUID": true,
|
||||||
|
"containerEnv": {
|
||||||
|
"CLAUDE_CONFIG_DIR": "/home/vscode/.claude",
|
||||||
|
"HISTFILE": "/home/vscode/.bash_history.d/history"
|
||||||
|
},
|
||||||
|
"remoteEnv": {
|
||||||
|
"ANTHROPIC_AUTH_TOKEN": "${localEnv:ANTHROPIC_AUTH_TOKEN}"
|
||||||
|
},
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {
|
||||||
|
"moby": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"mounts": [
|
||||||
|
{{ ('type=bind,source=' ~ ecaas_agent_state ~ '/git,target=/run/ecaas-git,readonly') | to_json }},
|
||||||
|
{% for ca in ecaas_git_available_cas %}
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.local/share/certs/' ~ ca.certificate ~ ',target=/run/ecaas-git-ca/' ~ ca.certificate ~ ',readonly') | to_json }},
|
||||||
|
{% endfor %}
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.config/ai,target=/home/vscode/.config/ai,readonly') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.local/state/devcontainer-bash-history/ecaas,target=/home/vscode/.bash_history.d') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.claude,target=/home/vscode/.claude') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.cline,target=/home/vscode/.cline') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.agents,target=/home/vscode/.agents,readonly') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.m2,target=/home/vscode/.m2') | to_json }},
|
||||||
|
{{ ('type=bind,source=' ~ user_home ~ '/.config/glab-cli,target=/home/vscode/.config/glab-cli') | to_json }}
|
||||||
|
],
|
||||||
|
"forwardPorts": [8080],
|
||||||
|
"customizations": {
|
||||||
|
"vscode": {
|
||||||
|
"extensions": [
|
||||||
|
"vscjava.vscode-java-pack",
|
||||||
|
"vmware.vscode-boot-dev-pack",
|
||||||
|
"redhat.vscode-xml",
|
||||||
|
"redhat.vscode-yaml",
|
||||||
|
"saoudrizwan.claude-dev",
|
||||||
|
"emmanuelbeziat.vscode-great-icons"
|
||||||
|
],
|
||||||
|
"settings": {
|
||||||
|
"workbench.iconTheme": "vscode-great-icons",
|
||||||
|
"java.jdt.ls.java.home": "/opt/jdk-21",
|
||||||
|
"spring-boot.ls.java.home": "/opt/jdk-21",
|
||||||
|
"java.configuration.runtimes": [
|
||||||
|
{
|
||||||
|
"name": "JavaSE-11",
|
||||||
|
"path": "/usr/lib/jvm/msopenjdk-current",
|
||||||
|
"default": true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,6 +33,19 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
label: "{{ item.key }}"
|
label: "{{ item.key }}"
|
||||||
|
|
||||||
|
- name: Reject conflicting AI desktop-app lifecycle flags
|
||||||
|
tags: [always, ai_desktop_apps]
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- not (item.value.install_enabled | default(false)
|
||||||
|
and item.value.uninstall_enabled | default(false) | bool)
|
||||||
|
fail_msg: >-
|
||||||
|
{{ item.key }} has both install_enabled and uninstall_enabled set to true.
|
||||||
|
Choose either installation or removal before running the playbook.
|
||||||
|
loop: "{{ ai_desktop_apps | default({}) | dict2items }}"
|
||||||
|
loop_control:
|
||||||
|
label: "{{ item.key }}"
|
||||||
|
|
||||||
roles:
|
roles:
|
||||||
- role: dotfiles_common
|
- role: dotfiles_common
|
||||||
when:
|
when:
|
||||||
@@ -139,3 +152,12 @@
|
|||||||
|
|
||||||
roles:
|
roles:
|
||||||
- profile_workstation_dev_wsl
|
- profile_workstation_dev_wsl
|
||||||
|
|
||||||
|
- name: Deploy project devcontainer generator
|
||||||
|
hosts: platform_fedora
|
||||||
|
become: true
|
||||||
|
tags: [devcontainer_generator]
|
||||||
|
|
||||||
|
roles:
|
||||||
|
- role: devcontainer_generator
|
||||||
|
when: "'graphical_desktop' in group_names or 'workstation_dev_fedora' in group_names"
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
|
{% set in_container = workstation_git_in_devcontainer | default(false) %}
|
||||||
|
{% set git_support_dir = '/run/ecaas-git' if in_container else '~' %}
|
||||||
[init]
|
[init]
|
||||||
defaultBranch = main
|
defaultBranch = main
|
||||||
|
|
||||||
[core]
|
[core]
|
||||||
excludesfile = ~/.gitignore_global
|
excludesfile = {{ git_support_dir }}/.gitignore_global
|
||||||
pager = delta
|
pager = delta
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
@@ -24,11 +26,21 @@
|
|||||||
|
|
||||||
[merge]
|
[merge]
|
||||||
conflictstyle = diff3
|
conflictstyle = diff3
|
||||||
tool = bobide
|
tool = {{ 'vscode' if in_container else 'bobide' }}
|
||||||
|
|
||||||
[mergetool]
|
[mergetool]
|
||||||
prompt = false
|
prompt = false
|
||||||
|
|
||||||
|
{% if in_container %}
|
||||||
|
[mergetool "vscode"]
|
||||||
|
cmd = code --wait --merge \"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$MERGED\"
|
||||||
|
|
||||||
|
[diff]
|
||||||
|
tool = vscode
|
||||||
|
|
||||||
|
[difftool "vscode"]
|
||||||
|
cmd = code --wait --diff \"$LOCAL\" \"$REMOTE\"
|
||||||
|
{% else %}
|
||||||
[mergetool "bobide"]
|
[mergetool "bobide"]
|
||||||
cmd = bobide --reuse-window --wait $MERGED
|
cmd = bobide --reuse-window --wait $MERGED
|
||||||
|
|
||||||
@@ -37,6 +49,7 @@
|
|||||||
|
|
||||||
[difftool "bobide"]
|
[difftool "bobide"]
|
||||||
cmd = bobide --reuse-window --wait --diff $LOCAL $REMOTE
|
cmd = bobide --reuse-window --wait --diff $LOCAL $REMOTE
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
[color]
|
[color]
|
||||||
ui = always
|
ui = always
|
||||||
@@ -79,7 +92,7 @@
|
|||||||
gcunreachablenow = gc --prune=now
|
gcunreachablenow = gc --prune=now
|
||||||
|
|
||||||
[include]
|
[include]
|
||||||
path = ~/.themes.gitignore
|
path = {{ git_support_dir }}/.themes.gitignore
|
||||||
|
|
||||||
[delta]
|
[delta]
|
||||||
features = catppuccin-mocha navigate
|
features = catppuccin-mocha navigate
|
||||||
@@ -88,14 +101,16 @@
|
|||||||
tabs = 4
|
tabs = 4
|
||||||
side-by-side = true
|
side-by-side = true
|
||||||
|
|
||||||
[http "https://gitlab.ecaas.datacenter.comune.roma"]
|
{% for ca in workstation_git_container_cas | default(workstation_git_https_cas) %}
|
||||||
|
[http "{{ ca.url }}"]
|
||||||
|
{% if not in_container %}
|
||||||
sslBackend = openssl
|
sslBackend = openssl
|
||||||
sslCAInfo = ~/.local/share/certs/ecaas.datacenter.comune.roma.crt
|
{% endif %}
|
||||||
|
sslCAInfo = {{ '/run/ecaas-git-ca' if in_container else '~/.local/share/certs' }}/{{ ca.certificate }}
|
||||||
[http "https://gitlab.datacenter.comune.roma"]
|
|
||||||
sslBackend = openssl
|
|
||||||
sslCAInfo = ~/.local/share/certs/datacenter.comune.roma.crt
|
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
{% if not in_container %}
|
||||||
[credential]
|
[credential]
|
||||||
helper = store
|
helper = store
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|||||||
11
cmd/devcontainer/delta.Dockerfile
Normal file
11
cmd/devcontainer/delta.Dockerfile
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
RUN apt-get update \
|
||||||
|
&& arch="$(dpkg --print-architecture)" \
|
||||||
|
&& case "$arch" in \
|
||||||
|
amd64) sha256=ea4f0222950ee750a3d38dd80d03bce4cee07a3f63928fc47548383bcaf23093 ;; \
|
||||||
|
arm64) sha256=0edc36cf514f1bd84becac3e94ee8ae9f8818c6a1f99f7b2ee67b362afa253d3 ;; \
|
||||||
|
*) echo "Unsupported architecture for delta: $arch" >&2; exit 1 ;; \
|
||||||
|
esac \
|
||||||
|
&& curl -fsSL --retry 3 "https://github.com/dandavison/delta/releases/download/0.19.2/git-delta_0.19.2_${arch}.deb" -o /tmp/git-delta.deb \
|
||||||
|
&& echo "$sha256 /tmp/git-delta.deb" | sha256sum -c - \
|
||||||
|
&& apt-get install -y --no-install-recommends /tmp/git-delta.deb \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* /tmp/git-delta.deb
|
||||||
3
cmd/devcontainer/go.mod
Normal file
3
cmd/devcontainer/go.mod
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
module github.com/fscotto/infra/cmd/devcontainer
|
||||||
|
|
||||||
|
go 1.22
|
||||||
351
cmd/devcontainer/main.go
Normal file
351
cmd/devcontainer/main.go
Normal file
@@ -0,0 +1,351 @@
|
|||||||
|
// Command devcontainer generates project configurations sharing host Git and agent state.
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
_ "embed"
|
||||||
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"io"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
|
"sort"
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
|
//go:embed delta.Dockerfile
|
||||||
|
var deltaDockerfile string
|
||||||
|
|
||||||
|
type profile struct {
|
||||||
|
Image, Packages string
|
||||||
|
Extensions []string
|
||||||
|
}
|
||||||
|
type agent struct {
|
||||||
|
Package string
|
||||||
|
Extension string
|
||||||
|
Paths []string
|
||||||
|
}
|
||||||
|
type mount struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
Source string `json:"source"`
|
||||||
|
Target string `json:"target"`
|
||||||
|
ReadOnly bool `json:"readOnly"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func exists(path string) bool { _, err := os.Stat(path); return err == nil }
|
||||||
|
func isDir(path string) bool { info, err := os.Stat(path); return err == nil && info.IsDir() }
|
||||||
|
func quote(s string) string { return "'" + strings.ReplaceAll(s, "'", "'\"'\"'") + "'" }
|
||||||
|
func symlink(path string) bool {
|
||||||
|
info, err := os.Lstat(path)
|
||||||
|
return err == nil && info.Mode()&os.ModeSymlink != 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func selectAgents(selection, home string) ([]string, error) {
|
||||||
|
result := []string{}
|
||||||
|
candidates := strings.Split(selection, ",")
|
||||||
|
if selection == "none" {
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
if selection == "auto" {
|
||||||
|
candidates = nil
|
||||||
|
for name := range agents {
|
||||||
|
candidates = append(candidates, name)
|
||||||
|
}
|
||||||
|
sort.Strings(candidates)
|
||||||
|
}
|
||||||
|
seen := map[string]bool{}
|
||||||
|
for _, name := range candidates {
|
||||||
|
name = strings.TrimSpace(name)
|
||||||
|
a, ok := agents[name]
|
||||||
|
if !ok {
|
||||||
|
return nil, fmt.Errorf("unknown agent %q", name)
|
||||||
|
}
|
||||||
|
available := true
|
||||||
|
for _, path := range a.Paths {
|
||||||
|
if !isDir(filepath.Join(home, path)) {
|
||||||
|
available = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if selection == "auto" && !available {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if !seen[name] {
|
||||||
|
result = append(result, name)
|
||||||
|
seen[name] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func generate(project, language, home string, selected []string, local []string, force bool) (string, error) {
|
||||||
|
p, ok := profiles[language]
|
||||||
|
if !ok {
|
||||||
|
return "", fmt.Errorf("unknown language %q", language)
|
||||||
|
}
|
||||||
|
project, err := filepath.Abs(project)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
project, err = filepath.EvalSymlinks(project)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
home, err = filepath.Abs(home)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
home, err = filepath.EvalSymlinks(home)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
if !isDir(project) {
|
||||||
|
return "", fmt.Errorf("project directory does not exist: %s", project)
|
||||||
|
}
|
||||||
|
if home == "/" || strings.ContainsAny(home, "\n\r$,\\\"") {
|
||||||
|
return "", errors.New("unsupported host home path")
|
||||||
|
}
|
||||||
|
target := filepath.Join(project, ".devcontainer")
|
||||||
|
if symlink(target) {
|
||||||
|
return "", errors.New("refusing a symlinked .devcontainer directory")
|
||||||
|
}
|
||||||
|
if exists(target) && !force {
|
||||||
|
return "", errors.New(".devcontainer already exists; use --force to replace generated files")
|
||||||
|
}
|
||||||
|
paths := []struct {
|
||||||
|
path string
|
||||||
|
readonly bool
|
||||||
|
}{{".gitconfig", true}, {".config/git", true}, {".gitignore_global", true}, {".config/ai", true}}
|
||||||
|
claude := false
|
||||||
|
for _, name := range selected {
|
||||||
|
a, ok := agents[name]
|
||||||
|
if !ok {
|
||||||
|
return "", fmt.Errorf("unknown agent %q", name)
|
||||||
|
}
|
||||||
|
for _, path := range a.Paths {
|
||||||
|
if !isDir(filepath.Join(home, path)) {
|
||||||
|
return "", fmt.Errorf("missing host directory for %s: %s", name, filepath.Join(home, path))
|
||||||
|
}
|
||||||
|
paths = append(paths, struct {
|
||||||
|
path string
|
||||||
|
readonly bool
|
||||||
|
}{path, false})
|
||||||
|
}
|
||||||
|
if name == "claude" {
|
||||||
|
claude = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if claude {
|
||||||
|
paths = append(paths, struct {
|
||||||
|
path string
|
||||||
|
readonly bool
|
||||||
|
}{".claude.json", false})
|
||||||
|
}
|
||||||
|
mounts := []mount{}
|
||||||
|
for _, item := range paths {
|
||||||
|
if exists(filepath.Join(home, item.path)) {
|
||||||
|
destination := filepath.Join(home, item.path)
|
||||||
|
if item.path == ".gitconfig" {
|
||||||
|
destination = "/run/host-gitconfig"
|
||||||
|
}
|
||||||
|
mounts = append(mounts, mount{"bind", "${localEnv:HOME}/" + item.path, destination, item.readonly})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// The devcontainers node feature ships an nvm-based Node outside sudo's
|
||||||
|
// secure_path, which broke the postCreateCommand npm install. Copy the
|
||||||
|
// official Node image binaries into /usr/local instead, exactly like the
|
||||||
|
// ecaas and cdp devcontainers, so sudo npm works in every profile.
|
||||||
|
needsNode := len(selected) > 0
|
||||||
|
dockerfile := ""
|
||||||
|
if needsNode {
|
||||||
|
dockerfile += "FROM docker.io/library/node:22-bookworm-slim AS node\n"
|
||||||
|
}
|
||||||
|
dockerfile += fmt.Sprintf("FROM %s\nUSER root\nRUN apt-get update && apt-get install -y --no-install-recommends \\\n bash-completion ca-certificates curl fzf git git-lfs gnupg openssh-client ripgrep zoxide %s \\\n && rm -rf /var/lib/apt/lists/*\n", p.Image, p.Packages)
|
||||||
|
if needsNode {
|
||||||
|
dockerfile += "COPY --from=node /usr/local/bin/node /usr/local/bin/node\n"
|
||||||
|
dockerfile += "COPY --from=node /usr/local/lib/node_modules/npm/ /usr/local/lib/node_modules/npm/\n"
|
||||||
|
dockerfile += "RUN ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \\\n && ln -s ../lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \\\n && node --version && npm --version\n"
|
||||||
|
}
|
||||||
|
dockerfile += deltaDockerfile
|
||||||
|
if home != "/home/vscode" {
|
||||||
|
dockerfile += "RUN usermod --home " + quote(home) + " --move-home vscode\n"
|
||||||
|
}
|
||||||
|
// Docker ENV uses its own quoting syntax, rather than shell quoting.
|
||||||
|
envHome, _ := json.Marshal(home)
|
||||||
|
dockerfile += "ENV HOME=" + string(envHome) + "\n"
|
||||||
|
if language == "python" {
|
||||||
|
dockerfile += "RUN python -m pip install --no-cache-dir uv ruff ty\n"
|
||||||
|
}
|
||||||
|
if language == "infra" {
|
||||||
|
dockerfile += "RUN python -m pip install --no-cache-dir ansible-core ansible-lint yamllint\n"
|
||||||
|
}
|
||||||
|
// The container installs the profile extensions, the VS Code extension of
|
||||||
|
// every selected agent and the extensions currently installed in the local
|
||||||
|
// VS Code, captured at generation time. Regenerate to refresh the local set.
|
||||||
|
extensions := append([]string{}, p.Extensions...)
|
||||||
|
addExtension := func(id string) {
|
||||||
|
if !slices.ContainsFunc(extensions, func(e string) bool { return strings.EqualFold(e, id) }) {
|
||||||
|
extensions = append(extensions, id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, name := range selected {
|
||||||
|
if id := agents[name].Extension; id != "" {
|
||||||
|
addExtension(id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, id := range local {
|
||||||
|
addExtension(strings.TrimSpace(id))
|
||||||
|
}
|
||||||
|
slices.Sort(extensions)
|
||||||
|
config := map[string]any{
|
||||||
|
"name": filepath.Base(project) + " — " + language,
|
||||||
|
"build": map[string]string{"dockerfile": "Dockerfile"},
|
||||||
|
"remoteUser": "vscode", "updateRemoteUserUID": true,
|
||||||
|
"containerEnv": map[string]string{"HOME": home}, "mounts": mounts,
|
||||||
|
"customizations": map[string]any{"vscode": map[string]any{"extensions": extensions}},
|
||||||
|
}
|
||||||
|
if len(selected) > 0 {
|
||||||
|
packages := []string{}
|
||||||
|
for _, name := range selected {
|
||||||
|
packages = append(packages, quote(agents[name].Package))
|
||||||
|
}
|
||||||
|
config["postCreateCommand"] = "sudo npm install --global --no-audit --no-fund " + strings.Join(packages, " ")
|
||||||
|
}
|
||||||
|
if claude {
|
||||||
|
config["remoteEnv"] = map[string]string{"ANTHROPIC_AUTH_TOKEN": "${localEnv:ANTHROPIC_AUTH_TOKEN}"}
|
||||||
|
}
|
||||||
|
dockerfile += "USER vscode\n"
|
||||||
|
if exists(filepath.Join(home, ".gitconfig")) {
|
||||||
|
dockerfile += "RUN git config --global include.path /run/host-gitconfig\n"
|
||||||
|
}
|
||||||
|
var data bytes.Buffer
|
||||||
|
encoder := json.NewEncoder(&data)
|
||||||
|
encoder.SetEscapeHTML(false)
|
||||||
|
encoder.SetIndent("", " ")
|
||||||
|
if err := encoder.Encode(config); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
files := []struct{ name, content string }{{"Dockerfile", dockerfile}, {"devcontainer.json", data.String()}}
|
||||||
|
// Validate every output before replacing any file.
|
||||||
|
for _, file := range files {
|
||||||
|
path := filepath.Join(target, file.name)
|
||||||
|
if info, err := os.Lstat(path); err == nil {
|
||||||
|
if !info.Mode().IsRegular() {
|
||||||
|
return "", fmt.Errorf("refusing non-regular output: %s", path)
|
||||||
|
}
|
||||||
|
} else if !os.IsNotExist(err) {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := os.MkdirAll(target, 0755); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
for _, file := range files {
|
||||||
|
if err := writeAtomic(filepath.Join(target, file.name), file.content); err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return target, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func writeAtomic(path, content string) error {
|
||||||
|
file, err := os.CreateTemp(filepath.Dir(path), ".devcontainer-*")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer os.Remove(file.Name())
|
||||||
|
if _, err = io.WriteString(file, content); err != nil {
|
||||||
|
file.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err = file.Chmod(0644); err != nil {
|
||||||
|
file.Close()
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err = file.Close(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return os.Rename(file.Name(), path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// discoverLocalExtensions lists the extensions installed in the local VS Code.
|
||||||
|
// A missing or failing code binary is not fatal: the generated container then
|
||||||
|
// only carries the profile and agent extensions.
|
||||||
|
func discoverLocalExtensions(stderr io.Writer) []string {
|
||||||
|
path, err := exec.LookPath("code")
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(stderr, "note: no local VS Code found; skipping locally installed extensions")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
out, err := exec.Command(path, "--list-extensions").Output()
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintf(stderr, "warning: could not list local VS Code extensions: %v\n", err)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
extensions := []string{}
|
||||||
|
for _, line := range strings.Split(string(out), "\n") {
|
||||||
|
if id := strings.TrimSpace(line); id != "" {
|
||||||
|
extensions = append(extensions, id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return extensions
|
||||||
|
}
|
||||||
|
|
||||||
|
func run(args []string, home string, out, stderr io.Writer) error {
|
||||||
|
flags := flag.NewFlagSet("devcontainer", flag.ContinueOnError)
|
||||||
|
flags.SetOutput(stderr)
|
||||||
|
language := flags.String("language", "", "c-cpp, go, rust, python, node, java, infra (required)")
|
||||||
|
selection := flags.String("agents", "auto", "auto, none, or comma-separated codex,cline,opencode,claude,gemini")
|
||||||
|
force := flags.Bool("force", false, "Replace the two generated files")
|
||||||
|
flags.Usage = func() {
|
||||||
|
fmt.Fprintln(stderr, "Usage: devcontainer PROJECT --language LANGUAGE [--agents AGENTS] [--force]")
|
||||||
|
flags.PrintDefaults()
|
||||||
|
}
|
||||||
|
// Accept the project's original position before the flags as well as flags first.
|
||||||
|
if len(args) > 0 && !strings.HasPrefix(args[0], "-") {
|
||||||
|
args = append(append([]string{}, args[1:]...), args[0])
|
||||||
|
}
|
||||||
|
if err := flags.Parse(args); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if flags.NArg() != 1 || *language == "" {
|
||||||
|
flags.Usage()
|
||||||
|
return errors.New("one project and --language are required")
|
||||||
|
}
|
||||||
|
selected, err := selectAgents(*selection, home)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
local := discoverLocalExtensions(stderr)
|
||||||
|
target, err := generate(flags.Arg(0), *language, home, selected, local, *force)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
names := strings.Join(selected, ", ")
|
||||||
|
if names == "" {
|
||||||
|
names = "none"
|
||||||
|
}
|
||||||
|
fmt.Fprintf(out, "Created %s; agents: %s\n", target, names)
|
||||||
|
if len(local) > 0 {
|
||||||
|
fmt.Fprintf(out, "Included %d local VS Code extensions.\n", len(local))
|
||||||
|
}
|
||||||
|
fmt.Fprintln(out, "Open the project in VS Code and choose Dev Containers: Reopen in Container.")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
home, err := os.UserHomeDir()
|
||||||
|
if err == nil {
|
||||||
|
err = run(os.Args[1:], home, os.Stdout, os.Stderr)
|
||||||
|
}
|
||||||
|
if errors.Is(err, flag.ErrHelp) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
fmt.Fprintln(os.Stderr, err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
281
cmd/devcontainer/main_test.go
Normal file
281
cmd/devcontainer/main_test.go
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func setup(t *testing.T) (string, string) {
|
||||||
|
t.Helper()
|
||||||
|
root := t.TempDir()
|
||||||
|
home, project := filepath.Join(root, "host home"), filepath.Join(root, "project with spaces")
|
||||||
|
for _, path := range []string{home, project} {
|
||||||
|
if err := os.MkdirAll(path, 0755); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return home, project
|
||||||
|
}
|
||||||
|
func read(t *testing.T, path string) string {
|
||||||
|
t.Helper()
|
||||||
|
b, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return string(b)
|
||||||
|
}
|
||||||
|
func put(t *testing.T, path, content string) {
|
||||||
|
t.Helper()
|
||||||
|
if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if err := os.WriteFile(path, []byte(content), 0600); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type vscodeCustomizations struct {
|
||||||
|
Customizations struct {
|
||||||
|
Vscode struct {
|
||||||
|
Extensions []string `json:"extensions"`
|
||||||
|
} `json:"vscode"`
|
||||||
|
} `json:"customizations"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func extensionsOf(t *testing.T, target string) []string {
|
||||||
|
t.Helper()
|
||||||
|
var config vscodeCustomizations
|
||||||
|
if err := json.Unmarshal([]byte(read(t, filepath.Join(target, "devcontainer.json"))), &config); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return config.Customizations.Vscode.Extensions
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProfiles(t *testing.T) {
|
||||||
|
for name := range profiles {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
home, project := setup(t)
|
||||||
|
target, err := generate(project, name, home, nil, nil, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var config map[string]any
|
||||||
|
if err := json.Unmarshal([]byte(read(t, filepath.Join(target, "devcontainer.json"))), &config); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if config["containerEnv"].(map[string]any)["HOME"] != home {
|
||||||
|
t.Fatal("wrong home")
|
||||||
|
}
|
||||||
|
if _, ok := config["postCreateCommand"]; ok {
|
||||||
|
t.Fatal("unexpected agent install")
|
||||||
|
}
|
||||||
|
want := append([]string{}, profiles[name].Extensions...)
|
||||||
|
slices.Sort(want)
|
||||||
|
if got := extensionsOf(t, target); !slices.Equal(got, want) {
|
||||||
|
t.Fatalf("wrong extensions: %v", got)
|
||||||
|
}
|
||||||
|
dockerfile := read(t, filepath.Join(target, "Dockerfile"))
|
||||||
|
if !strings.HasPrefix(dockerfile, "FROM "+profiles[name].Image+"\n") || !strings.HasSuffix(dockerfile, "USER vscode\n") {
|
||||||
|
t.Fatal("wrong Dockerfile")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestSharedConfig(t *testing.T) {
|
||||||
|
home, project := setup(t)
|
||||||
|
put(t, filepath.Join(home, ".codex/auth.json"), "secret-value")
|
||||||
|
put(t, filepath.Join(home, ".gitconfig"), "[user]\nname = Test\n")
|
||||||
|
target, err := generate(project, "python", home, []string{"codex"}, nil, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
configText := read(t, filepath.Join(target, "devcontainer.json"))
|
||||||
|
dockerfile := read(t, filepath.Join(target, "Dockerfile"))
|
||||||
|
if strings.Contains(configText+dockerfile, "secret-value") {
|
||||||
|
t.Fatal("credential leaked")
|
||||||
|
}
|
||||||
|
var config struct {
|
||||||
|
Mounts []mount
|
||||||
|
PostCreateCommand string
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal([]byte(configText), &config); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
foundGit, foundAgent := false, false
|
||||||
|
for _, m := range config.Mounts {
|
||||||
|
if m.Target == "/run/host-gitconfig" {
|
||||||
|
foundGit = m.ReadOnly
|
||||||
|
}
|
||||||
|
if m.Target == filepath.Join(home, ".codex") {
|
||||||
|
foundAgent = !m.ReadOnly
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if !foundGit || !foundAgent || !strings.Contains(dockerfile, "include.path /run/host-gitconfig") {
|
||||||
|
t.Fatal("incorrect sharing")
|
||||||
|
}
|
||||||
|
if !strings.Contains(config.PostCreateCommand, "@openai/codex") || !strings.Contains(dockerfile, "COPY --from=node /usr/local/bin/node") {
|
||||||
|
t.Fatal("missing CLI install or embedded Node")
|
||||||
|
}
|
||||||
|
if !slices.Contains(extensionsOf(t, target), "openai.chatgpt") {
|
||||||
|
t.Fatal("agent VS Code extension missing")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestAgentAndLocalExtensions(t *testing.T) {
|
||||||
|
home, project := setup(t)
|
||||||
|
put(t, filepath.Join(home, ".cline/state/config"), "")
|
||||||
|
put(t, filepath.Join(home, ".agents/AGENTS.md"), "")
|
||||||
|
local := []string{"github.remotehub", "SAOUDRIZWAN.claude-dev", "ms-vscode.cpptools"}
|
||||||
|
target, err := generate(project, "python", home, []string{"cline"}, local, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
want := []string{"ms-python.python", "charliermarsh.ruff", "saoudrizwan.claude-dev", "github.remotehub", "ms-vscode.cpptools"}
|
||||||
|
slices.Sort(want)
|
||||||
|
if got := extensionsOf(t, target); !slices.Equal(got, want) {
|
||||||
|
t.Fatalf("extensions mismatch: %v", got)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestAgentsShipNpmInsideSudoPath(t *testing.T) {
|
||||||
|
for name := range profiles {
|
||||||
|
t.Run(name, func(t *testing.T) {
|
||||||
|
home, project := setup(t)
|
||||||
|
put(t, filepath.Join(home, ".cline/state/config"), "")
|
||||||
|
put(t, filepath.Join(home, ".agents/AGENTS.md"), "")
|
||||||
|
target, err := generate(project, name, home, []string{"cline"}, nil, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var config map[string]any
|
||||||
|
if err := json.Unmarshal([]byte(read(t, filepath.Join(target, "devcontainer.json"))), &config); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, hasFeature := config["features"]; hasFeature {
|
||||||
|
t.Fatal("the nvm-based node feature breaks the sudo npm postCreateCommand")
|
||||||
|
}
|
||||||
|
post, _ := config["postCreateCommand"].(string)
|
||||||
|
if !strings.Contains(post, "sudo npm install") {
|
||||||
|
t.Fatalf("missing npm agent install: %q", post)
|
||||||
|
}
|
||||||
|
dockerfile := read(t, filepath.Join(target, "Dockerfile"))
|
||||||
|
if !strings.HasPrefix(dockerfile, "FROM docker.io/library/node:22-bookworm-slim AS node\n") ||
|
||||||
|
!strings.Contains(dockerfile, "COPY --from=node /usr/local/bin/node /usr/local/bin/node") ||
|
||||||
|
!strings.Contains(dockerfile, "ln -s ../lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm") {
|
||||||
|
t.Fatal("npm must be reachable inside sudo's secure_path")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestOverwriteAndSymlinks(t *testing.T) {
|
||||||
|
home, project := setup(t)
|
||||||
|
target, err := generate(project, "go", home, nil, nil, false)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
before := read(t, filepath.Join(target, "Dockerfile"))
|
||||||
|
if _, err := generate(project, "rust", home, nil, nil, false); err == nil {
|
||||||
|
t.Fatal("overwrote existing configuration")
|
||||||
|
}
|
||||||
|
path := filepath.Join(target, "devcontainer.json")
|
||||||
|
if err := os.Remove(path); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
victim := filepath.Join(home, "victim")
|
||||||
|
put(t, victim, "keep")
|
||||||
|
if err := os.Symlink(victim, path); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if _, err := generate(project, "rust", home, nil, nil, true); err == nil {
|
||||||
|
t.Fatal("accepted symlink")
|
||||||
|
}
|
||||||
|
if read(t, victim) != "keep" || read(t, filepath.Join(target, "Dockerfile")) != before {
|
||||||
|
t.Fatal("changed files before rejecting symlink")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestInvalidInputs(t *testing.T) {
|
||||||
|
for _, kind := range []string{"agent", "language", "missing-directory", "home", "target-symlink"} {
|
||||||
|
t.Run(kind, func(t *testing.T) {
|
||||||
|
home, project := setup(t)
|
||||||
|
language := "go"
|
||||||
|
var selected []string
|
||||||
|
switch kind {
|
||||||
|
case "agent":
|
||||||
|
selected = []string{"codex"}
|
||||||
|
case "language":
|
||||||
|
language = "unknown"
|
||||||
|
case "missing-directory":
|
||||||
|
project = filepath.Join(project, "missing")
|
||||||
|
case "home":
|
||||||
|
home = "/"
|
||||||
|
case "target-symlink":
|
||||||
|
if err := os.Symlink(home, filepath.Join(project, ".devcontainer")); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if _, err := generate(project, language, home, selected, nil, true); err == nil {
|
||||||
|
t.Fatal("invalid input accepted")
|
||||||
|
}
|
||||||
|
if exists(filepath.Join(project, ".devcontainer/Dockerfile")) {
|
||||||
|
t.Fatal("wrote invalid configuration")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestAgentSelection(t *testing.T) {
|
||||||
|
home, _ := setup(t)
|
||||||
|
put(t, filepath.Join(home, ".codex/config.toml"), "")
|
||||||
|
got, err := selectAgents("auto", home)
|
||||||
|
if err != nil || strings.Join(got, ",") != "codex" {
|
||||||
|
t.Fatalf("auto: %v %v", got, err)
|
||||||
|
}
|
||||||
|
got, err = selectAgents("codex,codex", home)
|
||||||
|
if err != nil || len(got) != 1 {
|
||||||
|
t.Fatal("duplicate agents")
|
||||||
|
}
|
||||||
|
if _, err := selectAgents("invalid", home); err == nil {
|
||||||
|
t.Fatal("unknown agent accepted")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestCLI(t *testing.T) {
|
||||||
|
for _, first := range []bool{true, false} {
|
||||||
|
t.Run(map[bool]string{true: "project-first", false: "flags-first"}[first], func(t *testing.T) {
|
||||||
|
home, project := setup(t)
|
||||||
|
args := []string{"--language", "go", "--agents", "none", project}
|
||||||
|
if first {
|
||||||
|
args = []string{project, "--language", "go", "--agents", "none"}
|
||||||
|
}
|
||||||
|
var out bytes.Buffer
|
||||||
|
if err := run(args, home, &out, &out); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if !strings.Contains(out.String(), "agents: none") {
|
||||||
|
t.Fatal("missing output")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func TestLocalExtensionDiscovery(t *testing.T) {
|
||||||
|
bin := t.TempDir()
|
||||||
|
script := filepath.Join(bin, "code")
|
||||||
|
if err := os.WriteFile(script, []byte("#!/bin/sh\necho a.b\necho c.d\n"), 0755); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
t.Setenv("PATH", bin+string(os.PathListSeparator)+os.Getenv("PATH"))
|
||||||
|
home, project := setup(t)
|
||||||
|
var out bytes.Buffer
|
||||||
|
if err := run([]string{project, "--language", "go", "--agents", "none"}, home, &out, &out); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
want := []string{"a.b", "c.d", "golang.go"}
|
||||||
|
slices.Sort(want)
|
||||||
|
if got := extensionsOf(t, filepath.Join(project, ".devcontainer")); !slices.Equal(got, want) {
|
||||||
|
t.Fatalf("extensions mismatch: %v", got)
|
||||||
|
}
|
||||||
|
if !strings.Contains(out.String(), "Included 2 local VS Code extensions.") {
|
||||||
|
t.Fatal("missing local extensions summary")
|
||||||
|
}
|
||||||
|
}
|
||||||
18
cmd/devcontainer/profiles.go
Normal file
18
cmd/devcontainer/profiles.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
var profiles = map[string]profile{
|
||||||
|
"c-cpp": {Image: "mcr.microsoft.com/devcontainers/base:bookworm", Packages: "build-essential clang clangd cmake gdb valgrind universal-ctags cscope", Extensions: []string{"ms-vscode.cpptools", "ms-vscode.cmake-tools"}},
|
||||||
|
"go": {Image: "mcr.microsoft.com/devcontainers/go:1.25-bookworm", Packages: "", Extensions: []string{"golang.go"}},
|
||||||
|
"rust": {Image: "mcr.microsoft.com/devcontainers/rust:1-bookworm", Packages: "", Extensions: []string{"rust-lang.rust-analyzer"}},
|
||||||
|
"python": {Image: "mcr.microsoft.com/devcontainers/python:3.13-bookworm", Packages: "", Extensions: []string{"ms-python.python", "charliermarsh.ruff"}},
|
||||||
|
"node": {Image: "mcr.microsoft.com/devcontainers/javascript-node:22-bookworm", Packages: "", Extensions: []string{"esbenp.prettier-vscode"}},
|
||||||
|
"java": {Image: "mcr.microsoft.com/devcontainers/java:21-bookworm", Packages: "maven", Extensions: []string{"vscjava.vscode-java-pack"}},
|
||||||
|
"infra": {Image: "mcr.microsoft.com/devcontainers/python:3.13-bookworm", Packages: "shellcheck shfmt", Extensions: []string{"redhat.ansible", "redhat.vscode-yaml"}},
|
||||||
|
}
|
||||||
|
var agents = map[string]agent{
|
||||||
|
"codex": {Package: "@openai/codex", Extension: "openai.chatgpt", Paths: []string{".codex"}},
|
||||||
|
"cline": {Package: "cline", Extension: "saoudrizwan.claude-dev", Paths: []string{".cline", ".agents"}},
|
||||||
|
"opencode": {Package: "opencode-ai", Extension: "sst-dev.opencode", Paths: []string{".config/opencode", ".local/share/opencode", ".local/state/opencode"}},
|
||||||
|
"claude": {Package: "@anthropic-ai/claude-code@2.1.312", Extension: "anthropic.claude-code", Paths: []string{".claude"}},
|
||||||
|
"gemini": {Package: "@google/gemini-cli", Extension: "Google.geminicodeassist", Paths: []string{".gemini"}},
|
||||||
|
}
|
||||||
159
docs/ai-media-presets.md
Normal file
159
docs/ai-media-presets.md
Normal file
@@ -0,0 +1,159 @@
|
|||||||
|
# Preset offline `ai-media`
|
||||||
|
|
||||||
|
## Volume cifrato Backup (Ikaros)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media mount # sblocca Backup e rende disponibili i file di ai-media
|
||||||
|
ai-media umount # smonta prima il bind, poi Backup, e richiude LUKS
|
||||||
|
```
|
||||||
|
|
||||||
|
Eseguire i comandi come utente desktop, da un terminale: UDisks chiede la
|
||||||
|
passphrase LUKS se il volume è chiuso e systemd può chiedere l'autenticazione
|
||||||
|
amministrativa. La passphrase non viene salvata dal launcher. Prima di
|
||||||
|
`umount`, chiudere FaceFusion/RVC, attendere i job dei preset e chiudere file
|
||||||
|
e terminali aperti sul disco. Il comando riguarda **tutto il volume Backup**,
|
||||||
|
non solo la directory di ai-media, e non forza lo smontaggio. Non scollegare
|
||||||
|
il disco se il comando segnala un errore.
|
||||||
|
|
||||||
|
## Preset disponibili
|
||||||
|
|
||||||
|
Tutti i preset video accettano un nome MP4 locale oppure un URL HTTP(S).
|
||||||
|
I file locali vanno in `~/.local/share/ai-media/input/`. I preset avviano un servizio
|
||||||
|
`systemd --user` e tornano subito; FaceFusion e RVC restano nei container
|
||||||
|
offline. Il terminale stampa il nome del job e il comando per seguirne i log.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. Estrae l'audio, separa voce/strumentale, converte tutta la traccia
|
||||||
|
# vocale con mia_voce e restituisce solo l'audio finale mixato.
|
||||||
|
ai-media preset audio-convert video1.mp4
|
||||||
|
|
||||||
|
# 2. Applica source11.jpg ... source18.jpg al video: conserva l'audio
|
||||||
|
# originale se presente, altrimenti produce un video senza audio.
|
||||||
|
ai-media preset video-convert video1.mp4
|
||||||
|
|
||||||
|
# 3. Unisce un video in input/ con un audio presente in input/ oppure output/.
|
||||||
|
ai-media preset merge video1.mp4 audio.wav
|
||||||
|
|
||||||
|
# 4. Esegue voce e volti, poi unisce il video modificato con l'audio convertito.
|
||||||
|
# Se l'input è un URL, scarica prima un singolo video con yt-dlp.
|
||||||
|
ai-media preset convert 'https://esempio.org/video'
|
||||||
|
|
||||||
|
# 5. Separa il video (senza ricodificarlo) dalla prima traccia audio.
|
||||||
|
ai-media preset split video1.mp4
|
||||||
|
|
||||||
|
# 6. Come split, poi separa l'audio in voce e strumentale, senza convertirne la voce.
|
||||||
|
ai-media preset split-stems video1.mp4
|
||||||
|
|
||||||
|
# 7. Sovrappone voce e strumentale in un unico audio (non concatena le tracce).
|
||||||
|
ai-media preset mix vocals.wav instrumental.wav
|
||||||
|
|
||||||
|
# 8. Applica mia_voce direttamente a un audio, senza separazione né remix.
|
||||||
|
ai-media preset voice-convert voce.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
## Applicare mia_voce a un audio
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset voice-convert voce.wav
|
||||||
|
ai-media preset voice-convert video1-split-stems/vocals.wav --output video1-mia_voce.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
`voice-convert` legge un audio locale in `input/` oppure `output/`, anche in
|
||||||
|
una sottocartella, e produce `output/<nome-audio>-mia_voce.wav`. `--output`
|
||||||
|
permette di scegliere un altro nome WAV. Converte prima la traccia in WAV e
|
||||||
|
applica direttamente il modello RVC `mia_voce` con il relativo indice e RMVPE,
|
||||||
|
senza BS Roformer e senza aggiungere lo strumentale. Usare preferibilmente
|
||||||
|
una voce isolata: il preset non rimuove musica né separa parlanti.
|
||||||
|
Accetta i formati audio decodificabili dal FFmpeg installato. Richiede il
|
||||||
|
modello e l'indice personali già presenti nello stato RVC, funziona offline
|
||||||
|
in background, conserva l'originale e rifiuta risultati già esistenti.
|
||||||
|
Gli intermedi restano nella sottocartella nascosta del job in `output/`.
|
||||||
|
|
||||||
|
Per rimettere lo strumentale dopo la conversione:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset mix video1-mia_voce.wav video1-split-stems/instrumental.wav --output video1-mix.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
## Unire voce e strumentale
|
||||||
|
|
||||||
|
`mix` usa due audio locali in `input/` o `output/`, anche nelle sottocartelle
|
||||||
|
create da `split-stems`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset mix video1-split-stems/vocals.wav video1-split-stems/instrumental.wav --output video1-mix.wav
|
||||||
|
```
|
||||||
|
|
||||||
|
Il risultato è `output/video1-mix.wav`, PCM WAV a 16 bit. Senza `--output`,
|
||||||
|
il nome è `<nome-vocale>-mix.wav` (per esempio `vocals-mix.wav`). Le tracce
|
||||||
|
partono insieme da zero e vengono sommate a volume originale, senza
|
||||||
|
normalizzazione; la durata è quella della traccia più lunga. Livelli troppo
|
||||||
|
alti possono causare clipping. Il preset non esegue separazione o conversione
|
||||||
|
vocale, non modifica gli originali e non sovrascrive file esistenti. Parte in
|
||||||
|
background come gli altri preset e usa solo FFmpeg nel container offline.
|
||||||
|
Gli audio devono essere univoci tra `input/` e `output/`; percorsi assoluti,
|
||||||
|
`..`, link simbolici e URL audio non sono accettati.
|
||||||
|
|
||||||
|
## Video da URL
|
||||||
|
|
||||||
|
Per ogni preset video si può sostituire il nome del video con un URL tra virgolette:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ai-media preset split 'https://esempio.org/video'
|
||||||
|
ai-media preset split-stems 'https://esempio.org/video'
|
||||||
|
ai-media preset audio-convert 'https://esempio.org/video'
|
||||||
|
ai-media preset video-convert 'https://esempio.org/video'
|
||||||
|
ai-media preset merge 'https://esempio.org/video' audio.wav
|
||||||
|
ai-media preset convert 'https://esempio.org/video'
|
||||||
|
# Anche convert accetta un file locale, senza download:
|
||||||
|
ai-media preset convert video1.mp4
|
||||||
|
```
|
||||||
|
|
||||||
|
Il download con `yt-dlp` avviene una sola volta nello stesso job in background,
|
||||||
|
prima dell'elaborazione. Il video scaricato resta in `input/download-<ID>.mp4`;
|
||||||
|
i risultati usano lo stesso prefisso `download-<ID>` al posto di `video1`.
|
||||||
|
Serve `yt-dlp` sull'host solo per gli URL. L'audio di `merge` rimane un file
|
||||||
|
locale in `input/` oppure `output/`. URL locali/privati o contenenti credenziali
|
||||||
|
non vengono accettati. Se il download fallisce, l'elaborazione non parte.
|
||||||
|
|
||||||
|
`split` produce `output/video1-split/video.mp4` (muto) e `audio.wav`.
|
||||||
|
`split-stems` produce `output/video1-split-stems/` con `video.mp4`, `audio.wav`,
|
||||||
|
`vocals.wav` e `instrumental.wav`. L'audio estratto è PCM WAV a 16 bit;
|
||||||
|
la separazione usa BS Roformer offline nel container RVC e non richiede
|
||||||
|
il modello personale `mia_voce`. Entrambi richiedono un video con audio,
|
||||||
|
non modificano l'originale e rifiutano una cartella risultato già esistente.
|
||||||
|
Mantengono gli intermedi nella sottocartella nascosta del job in `output/`;
|
||||||
|
i risultati pubblicati sono hard link e non duplicano lo spazio dei file.
|
||||||
|
|
||||||
|
`video-convert` e il passaggio video di `convert` usano lo stesso profilo
|
||||||
|
FaceFusion: HyperSwap 1a 256 (pixel boost 256x256, peso 0.5), rilevatore
|
||||||
|
`yolo_face` 640x640 agli angoli 0/90/180/270, selezione `one` per volto
|
||||||
|
grande, filtri `female` e `white`, maschere `occlusion region area box` con
|
||||||
|
`xseg_1` e `bisenet_resnet_34` (blur 0.3), H.264 `libx264` veryfast, qualità
|
||||||
|
80 e 30 fps. L'audio originale viene ripristinato separatamente quando esiste.
|
||||||
|
|
||||||
|
Risultati: `output/video1-mia_voce.wav`, `output/video1-facefusion.mp4` e
|
||||||
|
`output/video1-unito.mp4`. Il preset `convert` crea
|
||||||
|
`output/video1-completo.mp4` (o `output/download-<ID>-completo.mp4` da URL),
|
||||||
|
mantenendo anche l'audio e il video intermedi. Richiede `source11.jpg`–`source18.jpg`
|
||||||
|
in `input/` e un video che contenga audio. **Solo il download** tramite
|
||||||
|
`yt-dlp` usa la rete; non usa la configurazione o i cookie personali di
|
||||||
|
`yt-dlp` e non scarica playlist. I file esistenti non vengono sovrascritti. Il
|
||||||
|
primo e il secondo preset conservano i passaggi intermedi in una sottocartella
|
||||||
|
`.video1-...` di `output/`, utile per diagnosi e recupero; non viene rimossa
|
||||||
|
automaticamente.
|
||||||
|
|
||||||
|
Per controllare un job, usare il nome stampato dal comando:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
journalctl --user -fu ai-media-preset-YYYYMMDD-HHMMSS-ID
|
||||||
|
systemctl --user status ai-media-preset-YYYYMMDD-HHMMSS-ID
|
||||||
|
```
|
||||||
|
|
||||||
|
Il preset `audio-convert` converte l'intero stem vocale: non distingue automaticamente
|
||||||
|
voci maschili e femminili e non separa parlanti sovrapposti. L'elaborazione è
|
||||||
|
in background, **non** più rapida della capacità della CPU. I nomi dei video locali
|
||||||
|
devono essere semplici, senza percorsi; gli audio possono indicare sottocartelle
|
||||||
|
relative a `input/` o `output/`. Se lo stesso audio
|
||||||
|
è in `input/` e `output/`, il comando rifiuta l'ambiguità. Tutti i video di
|
||||||
|
input dei preset devono essere MP4 con un nome diverso dal risultato atteso.
|
||||||
42
docs/atlas-gitea-registry.md
Normal file
42
docs/atlas-gitea-registry.md
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
# Atlas Gitea container registry
|
||||||
|
|
||||||
|
The existing Gitea instance provides an OCI container registry at
|
||||||
|
`git.fscotto.co`. Gitea 1.25.2 enables packages by default; no separate
|
||||||
|
container, port, DNS record, or registry service is required. The existing
|
||||||
|
Gitea HTTPS proxy route is used. The setting applies to Gitea's package
|
||||||
|
registry generally, not only container images.
|
||||||
|
|
||||||
|
On 2026-10-25, both the Atlas HTTP endpoint and the public HTTPS `/v2/`
|
||||||
|
endpoint returned the expected `401` bearer authentication challenge. NPM's
|
||||||
|
effective `client_max_body_size` was `2000m`; larger individual requests may
|
||||||
|
be rejected. Authentication and an actual image push and pull have not yet
|
||||||
|
been tested. Do not interpret the unauthenticated challenge as a complete test.
|
||||||
|
|
||||||
|
## Use with Podman
|
||||||
|
|
||||||
|
Replace `OWNER`, `IMAGE`, and `TAG` with your Gitea user or organization and
|
||||||
|
image details. Log in interactively; use a personal access token when using
|
||||||
|
two-factor authentication. Do not put credentials in commands or shell history.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
podman login git.fscotto.co
|
||||||
|
podman tag LOCAL_IMAGE:TAG git.fscotto.co/OWNER/IMAGE:TAG
|
||||||
|
podman push git.fscotto.co/OWNER/IMAGE:TAG
|
||||||
|
podman pull git.fscotto.co/OWNER/IMAGE:TAG
|
||||||
|
```
|
||||||
|
|
||||||
|
Choose the package's visibility and access deliberately in Gitea. Check the
|
||||||
|
package page and verify the pulled image digest when testing. No automatic
|
||||||
|
cleanup policy is configured by this document.
|
||||||
|
|
||||||
|
## Data and recovery
|
||||||
|
|
||||||
|
The observed package storage directory is
|
||||||
|
`/zpool/services/data/gitea/data/gitea/packages`, inside the existing Gitea
|
||||||
|
dataset. Package metadata also depends on the Gitea database and configuration.
|
||||||
|
Existing recursive ZFS and backup coverage must include both, but a successful
|
||||||
|
registry-specific backup and restore has not been tested. Review backup capacity
|
||||||
|
and consistency as image storage grows; a snapshot alone is not proof of an
|
||||||
|
application-consistent restore.
|
||||||
|
|
||||||
|
Reference: https://docs.gitea.com/1.25/usage/packages/container/
|
||||||
@@ -141,11 +141,22 @@ See `atlas-nextcloud-recovery-test.md` for scope, retained artifact and limitati
|
|||||||
|
|
||||||
## Recurring consistent bundles
|
## Recurring consistent bundles
|
||||||
|
|
||||||
`atlas-nextcloud-backup.service` is now an ordered requirement of both
|
`atlas-nextcloud-backup.service` is an ordered requirement of both
|
||||||
`atlas-borg-backup.service` and the operator-started `atlas-usb-backup.service`.
|
`atlas-borg-backup.service` and the operator-started `atlas-usb-backup.service`.
|
||||||
No additional backup timer is needed: the existing Borg schedule prepares a fresh
|
No additional backup timer is needed: the existing Borg schedule prepares a fresh
|
||||||
bundle before its pool snapshot, and a manual USB run does the same. Preparation
|
bundle before its pool snapshot. A structurally complete bundle from an earlier
|
||||||
failure blocks the dependent job rather than silently using an old dump.
|
verified run is reused instead while younger than
|
||||||
|
`atlas_nextcloud_backup_reuse_max_seconds` (20 h): a manual USB run then skips
|
||||||
|
the application pause, reaches its LUKS prompt within seconds and captures the
|
||||||
|
latest Borg-prepared bundle, while the remaining pool snapshot reflects the
|
||||||
|
moment of the run. Reuse does not re-hash the bundle; it was checksum-verified
|
||||||
|
at publication. The window is asserted below 24 h so the nightly Borg run,
|
||||||
|
spaced 24 h plus its randomized delay, never reuses the previous night's bundle.
|
||||||
|
Preparation failure still blocks the dependent job rather than silently using an
|
||||||
|
old dump; only a verified, bounded-age bundle may be reused. Set
|
||||||
|
`ATLAS_NEXTCLOUD_BACKUP_FORCE=1` with `systemctl set-environment` (the unit
|
||||||
|
passes it through) to ignore the window once and prepare a fresh bundle; unset
|
||||||
|
the variable afterwards.
|
||||||
|
|
||||||
The helper checks the mounted datasets and healthy active application state,
|
The helper checks the mounted datasets and healthy active application state,
|
||||||
serializes preparations and briefly pauses cron, Nextcloud and ONLYOFFICE. It
|
serializes preparations and briefly pauses cron, Nextcloud and ONLYOFFICE. It
|
||||||
@@ -171,10 +182,12 @@ sudo systemctl start atlas-nextcloud-backup.service
|
|||||||
sudo systemctl show atlas-nextcloud-backup.service -p Result -p ExecMainExitTimestamp
|
sudo systemctl show atlas-nextcloud-backup.service -p Result -p ExecMainExitTimestamp
|
||||||
```
|
```
|
||||||
|
|
||||||
The second command briefly interrupts the applications and is an explicit manual
|
A manual start briefly interrupts the applications only when it prepares a fresh
|
||||||
run of the recurring job, not a normal deployment side effect. The preparation
|
bundle; inside the reuse window it logs `Reusing verified ...` and finishes in
|
||||||
unit is not enabled as a boot backup; only interrupted-job recovery is enabled.
|
seconds without touching them. It remains an explicit manual run of the
|
||||||
Do not stop a Borg/USB job, break its lock or unmount its source snapshot to run a test.
|
recurring job, not a normal deployment side effect. The preparation unit is not
|
||||||
|
enabled as a boot backup; only interrupted-job recovery is enabled. Do not stop a
|
||||||
|
Borg/USB job, break its lock or unmount its source snapshot to run a test.
|
||||||
|
|
||||||
On 2026-10-04, both a new encrypted Borg archive and USB version
|
On 2026-10-04, both a new encrypted Borg archive and USB version
|
||||||
`20261004T101101Z-3420114` were independently extracted and their consistent
|
`20261004T101101Z-3420114` were independently extracted and their consistent
|
||||||
|
|||||||
43
docs/deadalus-cdp-devcontainer.md
Normal file
43
docs/deadalus-cdp-devcontainer.md
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
# cdp Java 25 / Node 20 dev container on deadalus
|
||||||
|
|
||||||
|
Same toolset and mounts as the [ecaas container](deadalus-ecaas-devcontainer.md)
|
||||||
|
(Git configuration and GitLab CAs, Bash configuration, `~/.m2`, `~/.claude`,
|
||||||
|
`~/.cline`, `~/.agents`, `~/.config/ai`, Docker outside of Docker, Claude Code,
|
||||||
|
Cline, delta, Great Icons), with these differences:
|
||||||
|
|
||||||
|
- Java 25 (`mcr.microsoft.com/devcontainers/java:25-bookworm`) is the default JDK
|
||||||
|
and also runs the Java and Spring language servers; there is no second JDK.
|
||||||
|
- Maven is `workstation_maven_version`; Node is
|
||||||
|
`workstation_cdp_node_version` (20.18.3) from the official Node image, used by
|
||||||
|
the Angular Module Federation front ends and the Claude/Cline CLIs.
|
||||||
|
- Angular Language Service and ESLint are added; forwarded ports are 4200, 4201,
|
||||||
|
4202, 4210 (front ends) and 8083, 8084 (`mediation-ansc`, `ansc-allegati`).
|
||||||
|
- `kubectl` 1.37.1 and Helm 4.2.2 are installed from the official releases with
|
||||||
|
pinned SHA-256 checksums (amd64 and arm64), and the Kubernetes VS Code
|
||||||
|
extension is added. The WSL `~/.kube` is bind-mounted read-write at
|
||||||
|
`/home/vscode/.kube`, so contexts, tokens and cached data are shared with the
|
||||||
|
host; the current `config` embeds the Rancher CA and credentials, which are
|
||||||
|
therefore readable by anything in the container. The Rancher endpoint must be
|
||||||
|
reachable from the container (VPN). `KUBECONFIG` on the host is not forwarded.
|
||||||
|
- `glab` 1.114.0 (pinned checksum) is installed and `~/.config/glab-cli` is
|
||||||
|
mounted read-write, as described in the ecaas document (tokens included).
|
||||||
|
|
||||||
|
Legacy `serv_roma-capitale-*` modules target Java 21 / Spring Boot 3.3.4 and
|
||||||
|
are not covered by this image's JDK.
|
||||||
|
|
||||||
|
The workspace is multi-repo and not a Git repository itself; open
|
||||||
|
`~/Work/sipo/cdp` from Fedora WSL. Maven needs the internal Nexus (VPN) and
|
||||||
|
`-s settings.xml`, as described in the workspace `AGENTS.md`.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ansible-playbook ansible/site.yml --limit deadalus --tags cdp_devcontainer -K
|
||||||
|
```
|
||||||
|
|
||||||
|
The deploy writes `~/Work/sipo/cdp/.devcontainer/` (`devcontainer.json`,
|
||||||
|
`Dockerfile`, `bashrc`, `bashrc.aliases`), backing up changed files. It shares
|
||||||
|
the rendered Git configuration in `~/.local/state/ecaas-devcontainer/git` with
|
||||||
|
the ecaas container and therefore also requires the ecaas GitLab CA. Then run
|
||||||
|
**Dev Containers: Reopen in Container**. The `ANTHROPIC_AUTH_TOKEN` forwarding
|
||||||
|
and credential caveats are the same as for ecaas.
|
||||||
|
|
||||||
|
Verify inside: `java -version`, `mvn -v`, `node -v` (v20.18.3), `docker info`.
|
||||||
125
docs/deadalus-ecaas-devcontainer.md
Normal file
125
docs/deadalus-ecaas-devcontainer.md
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
# ecaas Java 11 dev container on deadalus
|
||||||
|
|
||||||
|
From the AnsiblePlaybook checkout **in Fedora WSL 2 on deadalus**:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ansible-playbook ansible/site.yml --limit deadalus --tags ecaas_devcontainer -K
|
||||||
|
```
|
||||||
|
|
||||||
|
This creates `~/Work/sipo/ecaas/.devcontainer/` and deploys `devcontainer.json`,
|
||||||
|
`Dockerfile` and `bashrc`, backing up previous versions if they change. It does
|
||||||
|
not clone or modify application sources, change VS Code's Windows settings, or
|
||||||
|
start Docker containers. The Docker context selection remains in the local
|
||||||
|
WSL/VS Code setup.
|
||||||
|
|
||||||
|
Confirm that `docker context show` is `default` and `docker info` shows the local
|
||||||
|
Fedora engine. Open `~/Work/ecaas` using `code .` from Fedora and select
|
||||||
|
**Dev Containers: Reopen in Container** (or **Rebuild Container** if already open).
|
||||||
|
Do not use the production context to build or open the workspace.
|
||||||
|
|
||||||
|
The container uses Java 11 for the application and Maven, and Java 21 only for
|
||||||
|
the Java and Spring language servers. VS Code installs the Java and Spring Boot
|
||||||
|
extension packs, XML, YAML, the Cline extension and the VSCode Great Icons theme
|
||||||
|
(selected as the file icon theme) inside the container. The Java
|
||||||
|
pack includes Maven, the Java debugger and test integration. Prefer the project's
|
||||||
|
Maven wrapper where present. Node is provided for the Claude and Cline CLIs.
|
||||||
|
|
||||||
|
Git is installed in the container. The image uses the repository's portable Bash
|
||||||
|
configuration: prompt with Git status, aliases, history search, completion,
|
||||||
|
`fzf` and `zoxide`. The shared `.bashrc.aliases` is copied minus the
|
||||||
|
production `npm-tunnel` alias. The image
|
||||||
|
does not load the WSL host's production aliases or Bash history.
|
||||||
|
Run the deploy and rebuild the container to pick up changes to the shared Bash
|
||||||
|
configuration.
|
||||||
|
|
||||||
|
## Git, HTTPS, and SSH
|
||||||
|
|
||||||
|
The image provides Git, Git LFS, delta, OpenSSH and GnuPG. It includes the
|
||||||
|
managed workstation Git configuration from a read-only mount at runtime,
|
||||||
|
with VS Code rather than Bob as the diff and merge tool. Git identity and
|
||||||
|
signing configuration stay outside the workspace and image layers.
|
||||||
|
|
||||||
|
Before deploying, ensure the existing WSL certificate
|
||||||
|
`~/.local/share/certs/ecaas.datacenter.comune.roma.crt` is available. The
|
||||||
|
playbook checks and mounts that file read-only. It also mounts
|
||||||
|
`datacenter.comune.roma.crt` from the same directory if present. These files
|
||||||
|
are scoped to their GitLab URLs in Git; the image does not disable TLS
|
||||||
|
verification or add the internal certificates to its global trust store.
|
||||||
|
Recreate the container after replacing a certificate on the host.
|
||||||
|
|
||||||
|
Open the project from Fedora WSL so VS Code Dev Containers can reuse WSL's
|
||||||
|
HTTPS credential helper (including an existing `.git-credentials` used by
|
||||||
|
`credential.helper=store`) and forward the SSH agent if configured. GPG
|
||||||
|
signing remains enabled and needs the work key available through the GPG
|
||||||
|
agent. The WSL `~/.m2` (repository cache and `settings*.xml`, which may hold Maven
|
||||||
|
server credentials) is bind-mounted read-write at `/home/vscode/.m2`. No other
|
||||||
|
credential file, SSH private key, or GPG private key is copied or mounted by
|
||||||
|
the playbook. Do not forward a production SSH identity to this
|
||||||
|
development workspace.
|
||||||
|
|
||||||
|
To verify GitLab access from the container without changing the repo, run
|
||||||
|
`git ls-remote origin HEAD` after checking that `origin` is the expected
|
||||||
|
GitLab repository.
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
The `docker-outside-of-docker` Dev Container feature installs the Docker CLI
|
||||||
|
and Compose plugin and shares the local Fedora WSL engine's socket
|
||||||
|
(`/var/run/docker.sock`) with the container. Containers started from inside are
|
||||||
|
siblings on the WSL engine, and bind-mount sources resolve on the WSL host.
|
||||||
|
The socket grants root-equivalent control of that engine, and the container
|
||||||
|
never sees the host's Docker contexts, so the production context is
|
||||||
|
unreachable. Verify with `docker info` and `docker compose version`.
|
||||||
|
|
||||||
|
## GitLab CLI
|
||||||
|
|
||||||
|
`glab` 1.114.0 is installed from the official `.deb` with a pinned SHA-256
|
||||||
|
checksum (amd64 and arm64). The WSL `~/.config/glab-cli` is bind-mounted
|
||||||
|
read-write at `/home/vscode/.config/glab-cli`, so hosts, API tokens and
|
||||||
|
`skip_tls_verify` settings are shared with the host and readable by anything in
|
||||||
|
the container; changes made by `glab` inside affect the WSL configuration.
|
||||||
|
`GITLAB_TOKEN` and similar variables from the host are not forwarded.
|
||||||
|
|
||||||
|
## Agent configuration and smoke test
|
||||||
|
|
||||||
|
Claude and Cline use the WSL configuration directly: `~/.claude` and `~/.cline`
|
||||||
|
are bind-mounted read-write at `/home/vscode/.claude` and `/home/vscode/.cline`,
|
||||||
|
the cross-tool `~/.agents` read-only at `/home/vscode/.agents`, and
|
||||||
|
`~/.config/ai` read-only at `/home/vscode/.config/ai`, so rules, the AGENTS
|
||||||
|
pointer and the shared AI context follow the WSL host. The playbook keeps
|
||||||
|
Cline's managed configuration deployed on the host (`cline_deploy_enabled:
|
||||||
|
true`) even though the cline CLI npm package is not installed there; the CLI
|
||||||
|
ships inside the image and the VS Code Cline extension is installed through
|
||||||
|
the devcontainer customizations. Settings, rules,
|
||||||
|
skills, MCP configuration, sessions and **credential stores** are therefore
|
||||||
|
shared with, and visible to, the container, and changes made inside it affect
|
||||||
|
the WSL home. Host paths and tools referenced by rules or skills may need
|
||||||
|
adaptation. The WSL login is the `ANTHROPIC_AUTH_TOKEN` exported by
|
||||||
|
`~/.bashrc.d/60-claude-code.sh`, not the OAuth file. `remoteEnv` forwards it with
|
||||||
|
`${localEnv:ANTHROPIC_AUTH_TOKEN}`: the value is never written to the repository
|
||||||
|
or the image, but it is visible to processes in the container. VS Code must
|
||||||
|
therefore be started from a WSL shell that exports it (`code .` after opening a
|
||||||
|
new terminal; fully close any running VS Code server first). The endpoint and
|
||||||
|
model come from the mounted `settings.json`. With `CLAUDE_CONFIG_DIR` set, Claude reads its account state from
|
||||||
|
`~/.claude/.claude.json` instead of `~/.claude.json`, so the playbook seeds the
|
||||||
|
missing `oauthAccount`, `hasCompletedOnboarding` and `userID` keys there from
|
||||||
|
the WSL file without overwriting existing keys (`~/.claude.json` itself is not
|
||||||
|
mounted); VS Code global storage is not shared
|
||||||
|
either, so legacy Cline settings kept only there are not migrated. The full
|
||||||
|
host home is not mounted. `~/.local/state/ecaas-devcontainer/` now holds only
|
||||||
|
the rendered Git configuration.
|
||||||
|
|
||||||
|
|
||||||
|
From the integrated terminal inside the Dev Container, verify:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
java -version
|
||||||
|
mvn -v
|
||||||
|
git --version
|
||||||
|
delta --version
|
||||||
|
claude --version
|
||||||
|
cline --version
|
||||||
|
```
|
||||||
|
|
||||||
|
Both Java and Maven should report Java 11. Run the project's Maven tests and
|
||||||
|
check that the Spring Boot Dashboard, Java debugger and both AI panels open.
|
||||||
138
docs/project-devcontainers.md
Normal file
138
docs/project-devcontainers.md
Normal file
@@ -0,0 +1,138 @@
|
|||||||
|
# Reusable project devcontainers
|
||||||
|
|
||||||
|
`cmd/devcontainer/` is a Go CLI using only the standard library. Build it with
|
||||||
|
Go 1.22 or newer, from an `infra` checkout:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go -C cmd/devcontainer build -o "$HOME/.local/bin/devcontainer" .
|
||||||
|
```
|
||||||
|
|
||||||
|
Create `~/.local/bin` first if needed and keep it on `PATH`. The resulting binary
|
||||||
|
has no Python dependency. Run it on **the development host**, against an existing
|
||||||
|
project:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
devcontainer ~/src/my-project --language go
|
||||||
|
devcontainer ~/src/my-project --language python --agents codex,cline
|
||||||
|
devcontainer ~/src/my-project --language c-cpp --agents none
|
||||||
|
```
|
||||||
|
|
||||||
|
## Ansible deployment
|
||||||
|
|
||||||
|
On ikaros, nymph or deadalus, from the local `infra` checkout:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator -K
|
||||||
|
```
|
||||||
|
|
||||||
|
Replace the limit with `nymph` or `deadalus` as appropriate. The task installs
|
||||||
|
Fedora's Go compiler, copies the sources into the user's build cache, compiles
|
||||||
|
natively without downloading Go modules, and installs `~/.local/bin/devcontainer`
|
||||||
|
with mode `0755`. Subsequent runs update the executable only when its contents
|
||||||
|
change. Rebuilds use the Go cache. The role targets Fedora graphical desktops
|
||||||
|
and Fedora development workstations; it does not start any containers.
|
||||||
|
|
||||||
|
Check mode validates packages and source deployment but skips compilation and
|
||||||
|
binary installation, and reports that limitation explicitly:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ansible-playbook ansible/site.yml --limit ikaros --tags devcontainer_generator --check --diff
|
||||||
|
```
|
||||||
|
|
||||||
|
Profiles: `c-cpp`, `go`, `rust`, `python`, `node`, `java`, `infra`. They generate
|
||||||
|
`.devcontainer/devcontainer.json` and `Dockerfile`. The generated
|
||||||
|
`customizations.vscode.extensions` list combines the profile extensions, the VS
|
||||||
|
Code extension of each selected agent (`cline` → `saoudrizwan.claude-dev`,
|
||||||
|
`claude` → `anthropic.claude-code`, `codex` → `openai.chatgpt`, `gemini` →
|
||||||
|
`Google.geminicodeassist`, `opencode` → `sst-dev.opencode`) and every extension
|
||||||
|
installed in the local VS Code, captured through `code --list-extensions` at
|
||||||
|
generation time; regenerate after installing or removing extensions on the
|
||||||
|
host. Without a local VS Code on PATH only the profile and agent extensions are
|
||||||
|
included. Open the project in local VS
|
||||||
|
Code (in Fedora WSL on deadalus) and choose **Reopen in Container**. The generator
|
||||||
|
never builds or starts a container, selects a Docker context, modifies application
|
||||||
|
sources, or removes host packages. Existing `.devcontainer` directories are refused;
|
||||||
|
`--force` replaces only the two generated files, so commit or back up edits first.
|
||||||
|
|
||||||
|
The definitions live centrally in the generator; generated files are standalone.
|
||||||
|
Regenerate explicitly to take updates. Profile images select a language version
|
||||||
|
or release family, not immutable digests; npm agents other than Claude currently
|
||||||
|
resolve the latest release at container creation, matching the host lifecycle.
|
||||||
|
Agent containers copy Node from the official `docker.io/library/node` image into
|
||||||
|
`/usr/local` instead of using the nvm-based node feature, so the
|
||||||
|
`sudo npm install` postCreateCommand works in every profile.
|
||||||
|
Rebuilds are therefore not bit-for-bit reproducible. Pin image digests and agent
|
||||||
|
versions in generated project files when a project requires that guarantee.
|
||||||
|
Project-specific dependencies, ports, services and build commands belong in the
|
||||||
|
project configuration. The `infra` profile provides Ansible and linters; install
|
||||||
|
that project's collection requirements inside it separately.
|
||||||
|
|
||||||
|
## Shared Git and agents
|
||||||
|
|
||||||
|
Like the ecaas/cdp model, executables run inside the container and personal
|
||||||
|
configuration stays on the host. The generator detects existing configuration
|
||||||
|
paths without reading credentials. With `--agents auto` (the default), it selects
|
||||||
|
agents whose configuration directories already exist. Explicit agent selection
|
||||||
|
fails if required directories are missing. Supported agents: `codex`, `cline`,
|
||||||
|
`opencode`, `claude`, `gemini`. IBM Bob and desktop applications are not included.
|
||||||
|
|
||||||
|
Host `~/.gitconfig` is mounted read-only at `/run/host-gitconfig` and included from
|
||||||
|
a writable container Git config, allowing VS Code to register its credential
|
||||||
|
helper. Existing `~/.config/git` and `~/.gitignore_global` are mounted read-only.
|
||||||
|
Git, Git LFS, delta, OpenSSH and GnuPG are installed. VS Code Dev Containers handles
|
||||||
|
SSH-agent and HTTPS credential-helper forwarding; start VS Code from the host
|
||||||
|
session with its working agent. No SSH/GPG private-key directories are mounted.
|
||||||
|
GPG signing needs a functioning agent-forwarding setup and a test with your key;
|
||||||
|
the generator does not provision it. Host-specific helpers, `pinentry`, external
|
||||||
|
Git includes, conditional includes and CA paths still need container-compatible
|
||||||
|
configuration or additional narrowly scoped mounts. Recreate the container after
|
||||||
|
replacing a bind-mounted configuration file atomically on the host.
|
||||||
|
|
||||||
|
`~/.config/ai` is mounted read-only when present. Selected agents mount their host
|
||||||
|
configuration/state directories read-write, including credentials, sessions and
|
||||||
|
rules; changes inside the container affect the host. OpenCode also shares its
|
||||||
|
XDG data/state directories. The container user remains `vscode`, with its home set
|
||||||
|
to the **same absolute path as the generating host**, so Codex's absolute
|
||||||
|
`model_instructions_file` keeps working. This does not mount the full home.
|
||||||
|
For a different host home path, regenerate there. Host-only programs referenced
|
||||||
|
by agent settings are not made available automatically.
|
||||||
|
|
||||||
|
Claude also mounts `~/.claude.json` when present and forwards
|
||||||
|
`ANTHROPIC_AUTH_TOKEN` using `${localEnv:ANTHROPIC_AUTH_TOKEN}` as on deadalus.
|
||||||
|
Start VS Code from a shell that exports it; no token value is generated. Host
|
||||||
|
keyring-backed logins require separate integration; sharing a directory does not
|
||||||
|
forward the desktop keyring. VS Code extension storage is not shared.
|
||||||
|
|
||||||
|
Only existing paths are mounted. Regenerate after configuring an additional
|
||||||
|
agent. Generated files use `${localEnv:HOME}` for mount sources and contain no
|
||||||
|
credential contents, but do contain the host's absolute home path.
|
||||||
|
|
||||||
|
## Runtime and validation
|
||||||
|
|
||||||
|
Use a local development container engine. Docker CE is currently provisioned on
|
||||||
|
deadalus; ikaros explicitly has Podman, while nymph's runtime needs verification.
|
||||||
|
Podman (5+) works through VS Code's `dev.containers.dockerPath: podman` per the
|
||||||
|
official Dev Containers documentation: the extension drives the container CLI
|
||||||
|
and needs neither the `podman-docker` shim nor a daemon socket or `DOCKER_HOST`.
|
||||||
|
Never install `podman-docker` where docker-ce provides the real Docker CLI
|
||||||
|
(deadalus). Generation alone does not configure the engine; the `desktop_gnome`
|
||||||
|
profile deploys `dev.containers.dockerPath: podman` with its managed VS Code
|
||||||
|
settings, while compatible
|
||||||
|
rootless/UID configuration and SELinux bind-mount access must be validated on the
|
||||||
|
Fedora target host. Do not recursively relabel the personal home.
|
||||||
|
No engine socket is mounted inside these containers by default; add access only
|
||||||
|
for projects that need to launch sibling containers.
|
||||||
|
|
||||||
|
Host-side regression checks:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go -C cmd/devcontainer test ./...
|
||||||
|
go -C cmd/devcontainer vet ./...
|
||||||
|
```
|
||||||
|
|
||||||
|
On the target host, build/open a generated project, check the language toolchain,
|
||||||
|
`git config --show-origin --get user.email`, `git ls-remote origin HEAD` against
|
||||||
|
the expected development remote, and each selected agent's version/login.
|
||||||
|
Run project tests and verify signing if enabled. These runtime checks require the
|
||||||
|
real host and are separate from generator tests. Existing ecaas/cdp Ansible
|
||||||
|
provisioning is unchanged.
|
||||||
6
dotfiles/common/.agents/AGENTS.md
Normal file
6
dotfiles/common/.agents/AGENTS.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Cline Global Context
|
||||||
|
|
||||||
|
Load and follow the shared coding-agent context stored under `~/.config/ai/`:
|
||||||
|
|
||||||
|
- Operating context: read `~/.config/ai/bootstrap.md`
|
||||||
|
- Task-specific knowledge, rules, patterns, and ChatGPT memory loading: read `~/.config/ai/AGENTS.md`
|
||||||
@@ -3,3 +3,7 @@
|
|||||||
Import the shared coding agent bootstrap context:
|
Import the shared coding agent bootstrap context:
|
||||||
|
|
||||||
@~/.config/ai/bootstrap.md
|
@~/.config/ai/bootstrap.md
|
||||||
|
|
||||||
|
Import the shared task-specific file dispatcher (knowledge, rules, and ChatGPT memory):
|
||||||
|
|
||||||
|
@~/.config/ai/AGENTS.md
|
||||||
|
|||||||
23
dotfiles/common/.cline/rules/ai-context.md
Normal file
23
dotfiles/common/.cline/rules/ai-context.md
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Deployed global AI context
|
||||||
|
|
||||||
|
The standing AI context for this user is deployed by the Ansible-managed
|
||||||
|
dotfiles under `~/.config/ai/` and is maintained in the infrastructure
|
||||||
|
repository. Cline binds to it automatically in every project through this
|
||||||
|
global rule.
|
||||||
|
|
||||||
|
- Operating context: read `~/.config/ai/bootstrap.md` first. It carries the
|
||||||
|
persistent mental model: core principles, system and infrastructure models,
|
||||||
|
and agent behavior.
|
||||||
|
- Safety directives: apply `~/.config/ai/rules/safety.md`.
|
||||||
|
- Task-specific loading: follow the dispatcher `~/.config/ai/AGENTS.md` and
|
||||||
|
read only the files relevant to the current task from `knowledge/`, `rules/`,
|
||||||
|
and `patterns/`. Do not preemptively load all task-specific files.
|
||||||
|
- Distilled knowledge: for prior decisions, history, and stable preferences,
|
||||||
|
start from `~/.config/ai/memory/chatgpt/INDEX.md` and read the matching
|
||||||
|
topic file under `~/.config/ai/memory/chatgpt/knowledge/`. When that is not
|
||||||
|
enough, search the full transcripts with
|
||||||
|
`rg -i "<keyword>" ~/.config/ai/memory/chatgpt/transcripts/`.
|
||||||
|
|
||||||
|
These deployed files are managed state: never record session-specific notes in
|
||||||
|
them. Update them in the source infrastructure repository instead, so the next
|
||||||
|
playbook run converges the change everywhere.
|
||||||
7
dotfiles/common/.codex/AGENTS.md
Normal file
7
dotfiles/common/.codex/AGENTS.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# Codex Global Context
|
||||||
|
|
||||||
|
Import the shared coding agent bootstrap context:
|
||||||
|
|
||||||
|
@~/.config/ai/bootstrap.md
|
||||||
|
|
||||||
|
Follow the task-specific file loading described in `~/.config/ai/AGENTS.md` (knowledge, rules, and ChatGPT memory).
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
model = "gpt-5.6-terra"
|
|
||||||
model_reasoning_effort = "medium"
|
model_reasoning_effort = "medium"
|
||||||
|
|
||||||
model_instructions_file = "{{ effective_user_home }}/.config/ai/bootstrap.md"
|
model_instructions_file = "{{ effective_user_home }}/.config/ai/bootstrap.md"
|
||||||
|
|||||||
@@ -1,15 +1,19 @@
|
|||||||
# AGENTS.md — Global Context
|
# AGENTS.md — Global Context (dispatcher)
|
||||||
|
|
||||||
Always follow:
|
Always follow:
|
||||||
- minimal, targeted edits
|
- minimal, targeted edits
|
||||||
- preserve layering
|
- preserve layering
|
||||||
- avoid duplication
|
- avoid duplication
|
||||||
- validate before applying changes
|
- validate before applying changes
|
||||||
|
- safety directives: always apply `~/.config/ai/rules/safety.md`
|
||||||
|
|
||||||
Task-specific file loading:
|
Task-specific file loading:
|
||||||
- For infra or Ansible work, read `~/.config/opencode/knowledge/infra.md` and `~/.config/opencode/rules/ansible.md`
|
- For general background on the user, the environment, and stable preferences, read `~/.config/ai/memory/chatgpt/knowledge/00-profilo.md`
|
||||||
- For desktop work, read `~/.config/opencode/knowledge/desktop.md`
|
- For infra or Ansible work, read `~/.config/ai/knowledge/infra.md` and `~/.config/ai/rules/ansible.md`
|
||||||
- For dotfiles work, read `~/.config/opencode/knowledge/dotfiles.md` and `~/.config/opencode/patterns/dotfiles_layering.md`
|
- For desktop work, read `~/.config/ai/knowledge/desktop.md`
|
||||||
- For system programming work, read `~/.config/opencode/knowledge/system_programming.md`
|
- For dotfiles work, read `~/.config/ai/knowledge/dotfiles.md` and `~/.config/ai/patterns/dotfiles_layering.md`
|
||||||
|
- For system programming work, read `~/.config/ai/knowledge/system_programming.md`
|
||||||
|
- For prior ChatGPT discussion context (past decisions, history, preferences, projects), start from `~/.config/ai/memory/chatgpt/INDEX.md`, then read the matching topic file under `~/.config/ai/memory/chatgpt/knowledge/`; search the full transcripts with `rg -i "<keyword>" ~/.config/ai/memory/chatgpt/transcripts/`
|
||||||
|
|
||||||
Do not preemptively load all task-specific files. Load only the files relevant to the current task.
|
Do not preemptively load all task-specific files. Load only the files relevant to the current task.
|
||||||
|
|
||||||
|
|||||||
522
dotfiles/common/.config/ai/memory/chatgpt/.meta.json
Normal file
522
dotfiles/common/.config/ai/memory/chatgpt/.meta.json
Normal file
@@ -0,0 +1,522 @@
|
|||||||
|
{
|
||||||
|
"685167c3-b12c-800c-81d5-f6bdc8a74562": {
|
||||||
|
"file": "2025-06-17-programmazione-di-sistema.md",
|
||||||
|
"title": "Programmazione di Sistema",
|
||||||
|
"created": 1750165443.881027,
|
||||||
|
"update_time": 1780433040.853008,
|
||||||
|
"messages": 236,
|
||||||
|
"chars": 257690
|
||||||
|
},
|
||||||
|
"6866c486-7300-800c-be99-ac3501bf5b77": {
|
||||||
|
"file": "2025-07-03-linux-kernel-development.md",
|
||||||
|
"title": "Linux Kernel Development",
|
||||||
|
"created": 1751565446.622864,
|
||||||
|
"update_time": 1778923109.243077,
|
||||||
|
"messages": 8,
|
||||||
|
"chars": 13550
|
||||||
|
},
|
||||||
|
"686d38ec-32c4-800c-a985-c33dd4b44161": {
|
||||||
|
"file": "2025-07-08-elevazione-privilegi-con-script.md",
|
||||||
|
"title": "Elevazione privilegi con script",
|
||||||
|
"created": 1751988460.421606,
|
||||||
|
"update_time": 1752003606.28604,
|
||||||
|
"messages": 10,
|
||||||
|
"chars": 14403
|
||||||
|
},
|
||||||
|
"686d7d88-4460-800c-aa07-6c8f911f8c49": {
|
||||||
|
"file": "2025-07-08-setup-sviluppo-kernel-linux.md",
|
||||||
|
"title": "Setup sviluppo kernel Linux",
|
||||||
|
"created": 1752006024.448284,
|
||||||
|
"update_time": 1757349193.843844,
|
||||||
|
"messages": 22,
|
||||||
|
"chars": 30007
|
||||||
|
},
|
||||||
|
"686d81d8-69a4-800c-b1ba-530150987032": {
|
||||||
|
"file": "2025-07-08-tiling-wm-vs-de.md",
|
||||||
|
"title": "Tiling WM vs DE",
|
||||||
|
"created": 1752007128.639016,
|
||||||
|
"update_time": 1752651719.565563,
|
||||||
|
"messages": 112,
|
||||||
|
"chars": 144738
|
||||||
|
},
|
||||||
|
"686ff063-7428-800c-9016-e5aa61caea8e": {
|
||||||
|
"file": "2025-07-10-linguaggi-scripting-sistema.md",
|
||||||
|
"title": "Linguaggi scripting sistema",
|
||||||
|
"created": 1752166499.757389,
|
||||||
|
"update_time": 1780433158.417545,
|
||||||
|
"messages": 90,
|
||||||
|
"chars": 151683
|
||||||
|
},
|
||||||
|
"6874a63d-d6a0-800c-992f-cfc19f80454b": {
|
||||||
|
"file": "2025-07-14-distribuzioni-linux-piu-unix.md",
|
||||||
|
"title": "Distribuzioni Linux più UNIX",
|
||||||
|
"created": 1752475197.986237,
|
||||||
|
"update_time": 1752651704.598057,
|
||||||
|
"messages": 48,
|
||||||
|
"chars": 76857
|
||||||
|
},
|
||||||
|
"687bc9a4-1854-800c-ae29-716738d317e1": {
|
||||||
|
"file": "2025-07-19-workflow-sviluppo-unix.md",
|
||||||
|
"title": "Workflow sviluppo UNIX",
|
||||||
|
"created": 1752943012.277641,
|
||||||
|
"update_time": 1778923094.265412,
|
||||||
|
"messages": 104,
|
||||||
|
"chars": 122812
|
||||||
|
},
|
||||||
|
"68923cad-2cd4-832d-a105-614b03ca137e": {
|
||||||
|
"file": "2025-08-05-vantaggi-di-neomutt.md",
|
||||||
|
"title": "Vantaggi di NeoMutt",
|
||||||
|
"created": 1754414255.683661,
|
||||||
|
"update_time": 1755117969.032211,
|
||||||
|
"messages": 42,
|
||||||
|
"chars": 63147
|
||||||
|
},
|
||||||
|
"68bafb5a-d928-832a-8823-c593678fdf77": {
|
||||||
|
"file": "2025-09-05-task-emacs-coverage.md",
|
||||||
|
"title": "Task Emacs coverage",
|
||||||
|
"created": 1757084540.381688,
|
||||||
|
"update_time": 1757349203.215213,
|
||||||
|
"messages": 6,
|
||||||
|
"chars": 11719
|
||||||
|
},
|
||||||
|
"68bb674f-9908-8333-9173-93b9f68dc596": {
|
||||||
|
"file": "2025-09-06-emacs-per-sviluppo-kernel.md",
|
||||||
|
"title": "Emacs per sviluppo kernel",
|
||||||
|
"created": 1757112147.537248,
|
||||||
|
"update_time": 1765579118.250868,
|
||||||
|
"messages": 6,
|
||||||
|
"chars": 8762
|
||||||
|
},
|
||||||
|
"68cad26e-dd94-8324-8582-035e3ce3fc27": {
|
||||||
|
"file": "2025-09-17-sistema-operativo.md",
|
||||||
|
"title": "Sistema operativo",
|
||||||
|
"created": 1758122688.268689,
|
||||||
|
"update_time": 1772616989.003913,
|
||||||
|
"messages": 304,
|
||||||
|
"chars": 391155
|
||||||
|
},
|
||||||
|
"68cbae4c-c880-8330-b670-1ae2b72ecf3a": {
|
||||||
|
"file": "2025-09-18-rendere-email-piu-formale.md",
|
||||||
|
"title": "Rendere email più formale",
|
||||||
|
"created": 1758178908.385121,
|
||||||
|
"update_time": 1758179016.783481,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 1476
|
||||||
|
},
|
||||||
|
"6932aed3-5008-8325-b969-08dc6f35d7eb": {
|
||||||
|
"file": "2025-12-05-convertire-vmdk-in-qcow2.md",
|
||||||
|
"title": "Convertire VMDK in QCOW2",
|
||||||
|
"created": 1764929385.941481,
|
||||||
|
"update_time": 1764947756.940428,
|
||||||
|
"messages": 12,
|
||||||
|
"chars": 32301
|
||||||
|
},
|
||||||
|
"6932dbf4-7a64-832d-a7f7-5005245cf511": {
|
||||||
|
"file": "2025-12-05-come-posso-ottimizzare-la-risoluzione-di-una-macchina-virtua.md",
|
||||||
|
"title": "Come posso ottimizzare la risoluzione di una macchina virtuale su KVM/...",
|
||||||
|
"created": 1764940791.061897,
|
||||||
|
"update_time": 1764940820.249017,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 3973
|
||||||
|
},
|
||||||
|
"693c9a44-0b58-8328-afe4-c100001d0b74": {
|
||||||
|
"file": "2025-12-12-ottimizzazione-configurazione-emacs.md",
|
||||||
|
"title": "Ottimizzazione configurazione Emacs",
|
||||||
|
"created": 1765579333.840026,
|
||||||
|
"update_time": 1768033876.668465,
|
||||||
|
"messages": 124,
|
||||||
|
"chars": 443924
|
||||||
|
},
|
||||||
|
"69402abc-8e94-8330-8fbb-dd89e8500455": {
|
||||||
|
"file": "2025-12-15-configurazione-lsp-bash.md",
|
||||||
|
"title": "Configurazione LSP Bash",
|
||||||
|
"created": 1765812926.224716,
|
||||||
|
"update_time": 1765827941.712685,
|
||||||
|
"messages": 4,
|
||||||
|
"chars": 5448
|
||||||
|
},
|
||||||
|
"6941cf18-6f08-8329-b85e-fe8452eca316": {
|
||||||
|
"file": "2025-12-16-configurazione-go-incompleta.md",
|
||||||
|
"title": "Configurazione Go incompleta",
|
||||||
|
"created": 1765920538.129839,
|
||||||
|
"update_time": 1766521390.157466,
|
||||||
|
"messages": 74,
|
||||||
|
"chars": 238971
|
||||||
|
},
|
||||||
|
"6943c84b-4700-8326-b849-3f04db1095f0": {
|
||||||
|
"file": "2025-12-18-audio-remoto-con-rdp.md",
|
||||||
|
"title": "Audio remoto con RDP",
|
||||||
|
"created": 1766049983.358997,
|
||||||
|
"update_time": 1766056415.975342,
|
||||||
|
"messages": 18,
|
||||||
|
"chars": 22755
|
||||||
|
},
|
||||||
|
"6949436f-8188-8332-825a-5a1c110f979b": {
|
||||||
|
"file": "2025-12-22-modularizzare-configurazione-emacs.md",
|
||||||
|
"title": "Modularizzare configurazione Emacs",
|
||||||
|
"created": 1766409121.795851,
|
||||||
|
"update_time": 1766481588.378852,
|
||||||
|
"messages": 10,
|
||||||
|
"chars": 21994
|
||||||
|
},
|
||||||
|
"694a6621-433c-8332-bc9e-e30a7c1c58ff": {
|
||||||
|
"file": "2025-12-23-load-moduli-dichiarativo-emacs.md",
|
||||||
|
"title": "Load moduli dichiarativo Emacs",
|
||||||
|
"created": 1766483570.221675,
|
||||||
|
"update_time": 1766501505.279918,
|
||||||
|
"messages": 24,
|
||||||
|
"chars": 80230
|
||||||
|
},
|
||||||
|
"694fe73f-0098-8328-9f6c-5b741ff646f7": {
|
||||||
|
"file": "2025-12-27-dashboard-stile-doom.md",
|
||||||
|
"title": "Dashboard stile Doom",
|
||||||
|
"created": 1766844233.678888,
|
||||||
|
"update_time": 1766844282.338716,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 2899
|
||||||
|
},
|
||||||
|
"696a9898-b0f0-832d-9a3d-8fa63b04faae": {
|
||||||
|
"file": "2026-01-16-sistemi-bsd-per-laptop.md",
|
||||||
|
"title": "Sistemi BSD per laptop",
|
||||||
|
"created": 1768593690.929326,
|
||||||
|
"update_time": 1769535774.84958,
|
||||||
|
"messages": 48,
|
||||||
|
"chars": 82703
|
||||||
|
},
|
||||||
|
"69763d15-3e24-832c-9930-82efa6e25328": {
|
||||||
|
"file": "2026-01-25-shell-piu-usate-bsd.md",
|
||||||
|
"title": "Shell più usate BSD",
|
||||||
|
"created": 1769356579.54035,
|
||||||
|
"update_time": 1769535772.281699,
|
||||||
|
"messages": 4,
|
||||||
|
"chars": 5484
|
||||||
|
},
|
||||||
|
"6977b78a-f834-8331-82b9-4e2d54d812bf": {
|
||||||
|
"file": "2026-01-26-font-unix-simili-nerd.md",
|
||||||
|
"title": "Font UNIX simili Nerd",
|
||||||
|
"created": 1769453481.113524,
|
||||||
|
"update_time": 1769634405.491939,
|
||||||
|
"messages": 44,
|
||||||
|
"chars": 45673
|
||||||
|
},
|
||||||
|
"6978f931-c360-8330-bdca-e834d697e573": {
|
||||||
|
"file": "2026-01-27-suggerimenti-per-un-goal.md",
|
||||||
|
"title": "Suggerimenti per un goal",
|
||||||
|
"created": 1769535817.086813,
|
||||||
|
"update_time": 1770155923.725881,
|
||||||
|
"messages": 28,
|
||||||
|
"chars": 52098
|
||||||
|
},
|
||||||
|
"6979389b-b960-8325-96e3-7b001e50ce7a": {
|
||||||
|
"file": "2026-01-27-review-configurazione-terminale-st.md",
|
||||||
|
"title": "Review configurazione terminale st",
|
||||||
|
"created": 1769552156.508548,
|
||||||
|
"update_time": 1769588061.881458,
|
||||||
|
"messages": 18,
|
||||||
|
"chars": 23940
|
||||||
|
},
|
||||||
|
"6979c732-61d0-832d-bd30-b315fe48a404": {
|
||||||
|
"file": "2026-01-28-separazione-core-system-user.md",
|
||||||
|
"title": "Separazione core system user",
|
||||||
|
"created": 1769588543.151558,
|
||||||
|
"update_time": 1769589281.670914,
|
||||||
|
"messages": 4,
|
||||||
|
"chars": 5779
|
||||||
|
},
|
||||||
|
"6979d453-6280-8394-b226-f474e9f6396d": {
|
||||||
|
"file": "2026-01-28-review-configurazione-dmenu.md",
|
||||||
|
"title": "Review configurazione dmenu",
|
||||||
|
"created": 1769592007.552216,
|
||||||
|
"update_time": 1769592026.220427,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 1935
|
||||||
|
},
|
||||||
|
"6979d80a-94ec-8332-b457-8f9e0565fd50": {
|
||||||
|
"file": "2026-01-28-configurazione-ssh-e-gpg.md",
|
||||||
|
"title": "Configurazione SSH e GPG",
|
||||||
|
"created": 1769592846.117937,
|
||||||
|
"update_time": 1769594005.602308,
|
||||||
|
"messages": 4,
|
||||||
|
"chars": 4382
|
||||||
|
},
|
||||||
|
"697a3192-f26c-8332-84a0-efabc00bd9ca": {
|
||||||
|
"file": "2026-01-28-patch-consigliate-dwm.md",
|
||||||
|
"title": "Patch consigliate DWM",
|
||||||
|
"created": 1769615863.846342,
|
||||||
|
"update_time": 1769638385.348066,
|
||||||
|
"messages": 38,
|
||||||
|
"chars": 64134
|
||||||
|
},
|
||||||
|
"697a8a96-c698-8331-a69e-89e369ccf7af": {
|
||||||
|
"file": "2026-01-28-sistema-di-notifiche-linux.md",
|
||||||
|
"title": "Sistema di notifiche Linux",
|
||||||
|
"created": 1769638553.219296,
|
||||||
|
"update_time": 1769638664.930514,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 1656
|
||||||
|
},
|
||||||
|
"697a8d2b-4860-832d-b27a-afe1bc57a374": {
|
||||||
|
"file": "2026-01-28-configurazione-dwmblocks.md",
|
||||||
|
"title": "Configurazione dwmblocks",
|
||||||
|
"created": 1769639256.846482,
|
||||||
|
"update_time": 1769763606.585632,
|
||||||
|
"messages": 34,
|
||||||
|
"chars": 37666
|
||||||
|
},
|
||||||
|
"697b93aa-5540-8326-af88-8f1f7d3ec3dd": {
|
||||||
|
"file": "2026-01-29-troubleshooting-freebsd-firewall.md",
|
||||||
|
"title": "Troubleshooting FreeBSD Firewall",
|
||||||
|
"created": 1769706540.748549,
|
||||||
|
"update_time": 1769707710.068735,
|
||||||
|
"messages": 8,
|
||||||
|
"chars": 13624
|
||||||
|
},
|
||||||
|
"697b9bfb-517c-8329-84c7-b7e31f6064eb": {
|
||||||
|
"file": "2026-01-29-configurare-clipboard-con-dmenu.md",
|
||||||
|
"title": "Configurare clipboard con dmenu",
|
||||||
|
"created": 1769708566.139626,
|
||||||
|
"update_time": 1769710121.720131,
|
||||||
|
"messages": 10,
|
||||||
|
"chars": 12571
|
||||||
|
},
|
||||||
|
"697c8177-058c-832f-aa73-5d596937b859": {
|
||||||
|
"file": "2026-01-30-errore-compilazione-slstatus.md",
|
||||||
|
"title": "Errore compilazione slstatus",
|
||||||
|
"created": 1769767317.532827,
|
||||||
|
"update_time": 1769768704.260967,
|
||||||
|
"messages": 6,
|
||||||
|
"chars": 6210
|
||||||
|
},
|
||||||
|
"697cd843-9ebc-8330-8f76-8be9a5fc5b19": {
|
||||||
|
"file": "2026-01-30-migrazione-x11-a-xlibre.md",
|
||||||
|
"title": "Migrazione X11 a XLibre",
|
||||||
|
"created": 1769789535.046261,
|
||||||
|
"update_time": 1769789728.874143,
|
||||||
|
"messages": 4,
|
||||||
|
"chars": 6087
|
||||||
|
},
|
||||||
|
"69a7607d-5e54-8394-ac56-e8fed40dcbcf": {
|
||||||
|
"file": "2026-03-03-configurazione-nixos-da-fedora.md",
|
||||||
|
"title": "Configurazione NixOS da Fedora",
|
||||||
|
"created": 1772576934.83193,
|
||||||
|
"update_time": 1772577121.688374,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 13065
|
||||||
|
},
|
||||||
|
"69a8777f-9f50-8392-9cee-b97f215b50ce": {
|
||||||
|
"file": "2026-03-04-void-linux-install-script.md",
|
||||||
|
"title": "Void Linux install script",
|
||||||
|
"created": 1772648424.497395,
|
||||||
|
"update_time": 1773143444.063749,
|
||||||
|
"messages": 22,
|
||||||
|
"chars": 29459
|
||||||
|
},
|
||||||
|
"69a98a38-a190-8388-ad12-872cb1b5af6b": {
|
||||||
|
"file": "2026-03-05-differenze-tra-vi-e-vim.md",
|
||||||
|
"title": "Differenze tra vi e vim",
|
||||||
|
"created": 1772718693.477165,
|
||||||
|
"update_time": 1773143441.163061,
|
||||||
|
"messages": 42,
|
||||||
|
"chars": 130448
|
||||||
|
},
|
||||||
|
"69a9c38b-afe0-8385-b4d7-fedba0df178c": {
|
||||||
|
"file": "2026-03-05-configurazione-hyprland-all-black.md",
|
||||||
|
"title": "Configurazione Hyprland All-Black",
|
||||||
|
"created": 1772733451.019131,
|
||||||
|
"update_time": 1773143437.941349,
|
||||||
|
"messages": 32,
|
||||||
|
"chars": 71004
|
||||||
|
},
|
||||||
|
"69ab3ef4-39f4-8394-b777-d4f9b49ff0da": {
|
||||||
|
"file": "2026-03-06-configurazione-i3.md",
|
||||||
|
"title": "Configurazione i3",
|
||||||
|
"created": 1772830664.04396,
|
||||||
|
"update_time": 1773784658.530316,
|
||||||
|
"messages": 248,
|
||||||
|
"chars": 394245
|
||||||
|
},
|
||||||
|
"69b5da0f-d374-8389-9991-89a66fa1e673": {
|
||||||
|
"file": "2026-03-14-flatpak-con-i3.md",
|
||||||
|
"title": "Flatpak con i3",
|
||||||
|
"created": 1773525609.613291,
|
||||||
|
"update_time": 1773580920.053333,
|
||||||
|
"messages": 14,
|
||||||
|
"chars": 19985
|
||||||
|
},
|
||||||
|
"69b5dd63-7898-838a-94ee-b9743f50156b": {
|
||||||
|
"file": "2026-03-14-prompt-bash-personalizzato.md",
|
||||||
|
"title": "Prompt bash personalizzato",
|
||||||
|
"created": 1773526416.505007,
|
||||||
|
"update_time": 1773528489.873979,
|
||||||
|
"messages": 34,
|
||||||
|
"chars": 84255
|
||||||
|
},
|
||||||
|
"69cbefbd-4bb4-8384-a220-62384afef291": {
|
||||||
|
"file": "2026-03-31-progetti-sviluppati-insieme.md",
|
||||||
|
"title": "Progetti sviluppati insieme",
|
||||||
|
"created": 1774972909.115714,
|
||||||
|
"update_time": 1775227965.945387,
|
||||||
|
"messages": 36,
|
||||||
|
"chars": 89212
|
||||||
|
},
|
||||||
|
"69ff7592-2710-83eb-ae64-e5053372daef": {
|
||||||
|
"file": "2026-05-09-sviluppo-kernel-linux.md",
|
||||||
|
"title": "Sviluppo Kernel Linux",
|
||||||
|
"created": 1778349459.103319,
|
||||||
|
"update_time": 1778532066.320462,
|
||||||
|
"messages": 50,
|
||||||
|
"chars": 79051
|
||||||
|
},
|
||||||
|
"6a13661f-f078-83eb-8ee5-0c297c98db1e": {
|
||||||
|
"file": "2026-05-24-vim-vs-emacs.md",
|
||||||
|
"title": "Vim vs Emacs",
|
||||||
|
"created": 1779656226.660004,
|
||||||
|
"update_time": 1779656241.674157,
|
||||||
|
"messages": 4,
|
||||||
|
"chars": 1150
|
||||||
|
},
|
||||||
|
"6a1e6bf8-1b8c-8390-9833-994f3db7d912": {
|
||||||
|
"file": "2026-06-02-blocco-scrittura-dischi-esterni.md",
|
||||||
|
"title": "Blocco scrittura dischi esterni",
|
||||||
|
"created": 1780378678.612272,
|
||||||
|
"update_time": 1780378748.191027,
|
||||||
|
"messages": 4,
|
||||||
|
"chars": 4556
|
||||||
|
},
|
||||||
|
"6a1f410f-f820-8390-8a34-b6c737026d88": {
|
||||||
|
"file": "2026-06-02-studiare-xv6-con-apue.md",
|
||||||
|
"title": "Studiare xv6 con APUE",
|
||||||
|
"created": 1780433246.71313,
|
||||||
|
"update_time": 1780433260.971354,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 3033
|
||||||
|
},
|
||||||
|
"6a342e8f-c59c-83eb-9d0f-82d5dc067a98": {
|
||||||
|
"file": "2026-06-18-dual-boot-con-bitlocker.md",
|
||||||
|
"title": "Dual boot con BitLocker",
|
||||||
|
"created": 1781804806.225544,
|
||||||
|
"update_time": 1781805156.370825,
|
||||||
|
"messages": 8,
|
||||||
|
"chars": 9936
|
||||||
|
},
|
||||||
|
"6a380356-7dac-83eb-9098-1e5296fdb9d1": {
|
||||||
|
"file": "2026-06-21-skill-system-programmer.md",
|
||||||
|
"title": "Skill system programmer",
|
||||||
|
"created": 1782055831.553992,
|
||||||
|
"update_time": 1782059738.123604,
|
||||||
|
"messages": 18,
|
||||||
|
"chars": 42154
|
||||||
|
},
|
||||||
|
"6a3819f6-e77c-83eb-98dc-ac4b805343c3": {
|
||||||
|
"file": "2026-06-21-scelta-distro-linux-filosofia.md",
|
||||||
|
"title": "Scelta distro Linux filosofia",
|
||||||
|
"created": 1782061595.701426,
|
||||||
|
"update_time": 1782065360.547886,
|
||||||
|
"messages": 18,
|
||||||
|
"chars": 41421
|
||||||
|
},
|
||||||
|
"6a398d5f-7f94-83eb-b0ed-be540993bce5": {
|
||||||
|
"file": "2026-06-22-emacs-vs-terminal-workflow.md",
|
||||||
|
"title": "Emacs vs Terminal Workflow",
|
||||||
|
"created": 1782156772.747083,
|
||||||
|
"update_time": 1782160202.582969,
|
||||||
|
"messages": 16,
|
||||||
|
"chars": 29945
|
||||||
|
},
|
||||||
|
"6a39a298-6e90-83eb-9c95-f1e0399209f3": {
|
||||||
|
"file": "2026-06-22-stereotipi-vim-vs-emacs.md",
|
||||||
|
"title": "Stereotipi Vim vs Emacs",
|
||||||
|
"created": 1782162124.902723,
|
||||||
|
"update_time": 1787390859.164463,
|
||||||
|
"messages": 218,
|
||||||
|
"chars": 355733
|
||||||
|
},
|
||||||
|
"6a57b10f-61fc-83eb-aac9-c6f611262fac": {
|
||||||
|
"file": "2026-07-15-vim-vs-neovim.md",
|
||||||
|
"title": "Vim vs Neovim",
|
||||||
|
"created": 1784131859.552585,
|
||||||
|
"update_time": 1784667453.737104,
|
||||||
|
"messages": 52,
|
||||||
|
"chars": 82374
|
||||||
|
},
|
||||||
|
"6a5d3c43-0cb0-83eb-bba1-40fa22ac9294": {
|
||||||
|
"file": "2026-07-19-notifications-summary.md",
|
||||||
|
"title": "Notifications Summary",
|
||||||
|
"created": 1784495173.040645,
|
||||||
|
"update_time": 1784495180.502421,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 1177
|
||||||
|
},
|
||||||
|
"6a6c961b-c828-83eb-8b57-2bf590ca385e": {
|
||||||
|
"file": "2026-07-31-progetto-fsnap-per-apue.md",
|
||||||
|
"title": "Progetto fsnap per APUE",
|
||||||
|
"created": 1785501311.13758,
|
||||||
|
"update_time": 1786801580.813567,
|
||||||
|
"messages": 26,
|
||||||
|
"chars": 55637
|
||||||
|
},
|
||||||
|
"6a973c10-e46c-83eb-8628-6372ff91856d": {
|
||||||
|
"file": "2026-09-01-esportare-progetti-e-chat.md",
|
||||||
|
"title": "Esportare Progetti E Chat",
|
||||||
|
"created": 1788296240.486135,
|
||||||
|
"update_time": 1788296248.558538,
|
||||||
|
"messages": 2,
|
||||||
|
"chars": 1949
|
||||||
|
},
|
||||||
|
"6a9c77bc-3fe0-83ed-906d-19a089a7ac24": {
|
||||||
|
"file": "2026-09-05-risoluzione-nomi-locali-adguard.md",
|
||||||
|
"title": "Risoluzione Nomi Locali AdGuard",
|
||||||
|
"created": 1788639165.667587,
|
||||||
|
"update_time": 1788640495.337073,
|
||||||
|
"messages": 6,
|
||||||
|
"chars": 6731
|
||||||
|
},
|
||||||
|
"6aacdebe-cc08-83eb-a8bc-02affda0f2ca": {
|
||||||
|
"file": "2026-09-18-spiegare-passphrase-borg.md",
|
||||||
|
"title": "Spiegare passphrase Borg",
|
||||||
|
"created": 1789714111.294105,
|
||||||
|
"update_time": 1789715077.072826,
|
||||||
|
"messages": 7,
|
||||||
|
"chars": 11373
|
||||||
|
},
|
||||||
|
"6aad9e99-aa80-83eb-9f9d-9e0656b7fb2e": {
|
||||||
|
"file": "2026-09-18-monitoraggio-protezione-dati.md",
|
||||||
|
"title": "Monitoraggio protezione dati",
|
||||||
|
"created": 1789763226.739528,
|
||||||
|
"update_time": 1789763243.229647,
|
||||||
|
"messages": 1,
|
||||||
|
"chars": 4844
|
||||||
|
},
|
||||||
|
"6aad9ff4-f1bc-83eb-8ccb-561c5b870ce8": {
|
||||||
|
"file": "2026-09-18-test-di-ripristino-indipendenti.md",
|
||||||
|
"title": "Test di ripristino indipendenti",
|
||||||
|
"created": 1789763573.381085,
|
||||||
|
"update_time": 1789763585.105883,
|
||||||
|
"messages": 1,
|
||||||
|
"chars": 3134
|
||||||
|
},
|
||||||
|
"6ab1837e-8044-83ed-a832-40ea3c795642": {
|
||||||
|
"file": "2026-09-21-valutare-backup-borg.md",
|
||||||
|
"title": "Valutare backup Borg",
|
||||||
|
"created": 1790018431.185298,
|
||||||
|
"update_time": 1790019328.545161,
|
||||||
|
"messages": 11,
|
||||||
|
"chars": 13949
|
||||||
|
},
|
||||||
|
"6ab3fa9e-ed44-83eb-a8dc-156cf0aa4f67": {
|
||||||
|
"file": "2026-09-23-backup-usb-offline.md",
|
||||||
|
"title": "Backup USB offline",
|
||||||
|
"created": 1790179999.537027,
|
||||||
|
"update_time": 1790180017.108555,
|
||||||
|
"messages": 1,
|
||||||
|
"chars": 4627
|
||||||
|
},
|
||||||
|
"6ab4cb86-1dc0-83eb-b898-af3adde685bc": {
|
||||||
|
"file": "2026-09-24-monitoraggio-e-alert-atlas.md",
|
||||||
|
"title": "Monitoraggio E Alert Atlas",
|
||||||
|
"created": 1790233478.874482,
|
||||||
|
"update_time": 1790234352.43415,
|
||||||
|
"messages": 5,
|
||||||
|
"chars": 8976
|
||||||
|
}
|
||||||
|
}
|
||||||
76
dotfiles/common/.config/ai/memory/chatgpt/INDEX.md
Normal file
76
dotfiles/common/.config/ai/memory/chatgpt/INDEX.md
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
# ChatGPT Memory — Index
|
||||||
|
|
||||||
|
65 conversations imported from the official ChatGPT data export.
|
||||||
|
Structure: `transcripts/` (full active-branch transcripts), `knowledge/`
|
||||||
|
(distilled topic files), `assets/` (textual attachments only).
|
||||||
|
Search with ripgrep, e.g.:
|
||||||
|
|
||||||
|
rg -i "<keyword>" ~/.config/ai/memory/chatgpt/transcripts/
|
||||||
|
|
||||||
|
| Updated | Title | Topic | Messages | Chars | Transcript |
|
||||||
|
| --- | --- | --- | ---: | ---: | --- |
|
||||||
|
| 2026-09-24 | Monitoraggio E Alert Atlas | [tools-infra](knowledge/tools-infra.md) | 5 | 8976 | [transcript](transcripts/2026-09-24-monitoraggio-e-alert-atlas.md) |
|
||||||
|
| 2026-09-23 | Backup USB offline | [tools-infra](knowledge/tools-infra.md) | 1 | 4627 | [transcript](transcripts/2026-09-23-backup-usb-offline.md) |
|
||||||
|
| 2026-09-21 | Valutare backup Borg | [tools-infra](knowledge/tools-infra.md) | 11 | 13949 | [transcript](transcripts/2026-09-21-valutare-backup-borg.md) |
|
||||||
|
| 2026-09-18 | Test di ripristino indipendenti | [tools-infra](knowledge/tools-infra.md) | 1 | 3134 | [transcript](transcripts/2026-09-18-test-di-ripristino-indipendenti.md) |
|
||||||
|
| 2026-09-18 | Monitoraggio protezione dati | [tools-infra](knowledge/tools-infra.md) | 1 | 4844 | [transcript](transcripts/2026-09-18-monitoraggio-protezione-dati.md) |
|
||||||
|
| 2026-09-18 | Spiegare passphrase Borg | [tools-infra](knowledge/tools-infra.md) | 7 | 11373 | [transcript](transcripts/2026-09-18-spiegare-passphrase-borg.md) |
|
||||||
|
| 2026-09-05 | Risoluzione Nomi Locali AdGuard | [tools-infra](knowledge/tools-infra.md) | 6 | 6731 | [transcript](transcripts/2026-09-05-risoluzione-nomi-locali-adguard.md) |
|
||||||
|
| 2026-09-01 | Esportare Progetti E Chat | [workflow-progetti](knowledge/workflow-progetti.md) | 2 | 1949 | [transcript](transcripts/2026-09-01-esportare-progetti-e-chat.md) |
|
||||||
|
| 2026-08-15 | Progetto fsnap per APUE | [system-programming](knowledge/system-programming.md) | 26 | 55637 | [transcript](transcripts/2026-07-31-progetto-fsnap-per-apue.md) |
|
||||||
|
| 2026-07-19 | Notifications Summary | [dotfiles-wm](knowledge/dotfiles-wm.md) | 2 | 1177 | [transcript](transcripts/2026-07-19-notifications-summary.md) |
|
||||||
|
| 2026-07-21 | Vim vs Neovim | [editors](knowledge/editors.md) | 52 | 82374 | [transcript](transcripts/2026-07-15-vim-vs-neovim.md) |
|
||||||
|
| 2026-08-22 | Stereotipi Vim vs Emacs | [editors](knowledge/editors.md) | 218 | 355733 | [transcript](transcripts/2026-06-22-stereotipi-vim-vs-emacs.md) |
|
||||||
|
| 2026-06-22 | Emacs vs Terminal Workflow | [editors](knowledge/editors.md) | 16 | 29945 | [transcript](transcripts/2026-06-22-emacs-vs-terminal-workflow.md) |
|
||||||
|
| 2026-06-21 | Scelta distro Linux filosofia | [os-unix](knowledge/os-unix.md) | 18 | 41421 | [transcript](transcripts/2026-06-21-scelta-distro-linux-filosofia.md) |
|
||||||
|
| 2026-06-21 | Skill system programmer | [system-programming](knowledge/system-programming.md) | 18 | 42154 | [transcript](transcripts/2026-06-21-skill-system-programmer.md) |
|
||||||
|
| 2026-06-18 | Dual boot con BitLocker | [tools-infra](knowledge/tools-infra.md) | 8 | 9936 | [transcript](transcripts/2026-06-18-dual-boot-con-bitlocker.md) |
|
||||||
|
| 2026-06-02 | Studiare xv6 con APUE | [system-programming](knowledge/system-programming.md) | 2 | 3033 | [transcript](transcripts/2026-06-02-studiare-xv6-con-apue.md) |
|
||||||
|
| 2026-06-02 | Blocco scrittura dischi esterni | [tools-infra](knowledge/tools-infra.md) | 4 | 4556 | [transcript](transcripts/2026-06-02-blocco-scrittura-dischi-esterni.md) |
|
||||||
|
| 2026-05-24 | Vim vs Emacs | [editors](knowledge/editors.md) | 4 | 1150 | [transcript](transcripts/2026-05-24-vim-vs-emacs.md) |
|
||||||
|
| 2026-05-11 | Sviluppo Kernel Linux | [kernel-linux](knowledge/kernel-linux.md) | 50 | 79051 | [transcript](transcripts/2026-05-09-sviluppo-kernel-linux.md) |
|
||||||
|
| 2026-04-03 | Progetti sviluppati insieme | [workflow-progetti](knowledge/workflow-progetti.md) | 36 | 89212 | [transcript](transcripts/2026-03-31-progetti-sviluppati-insieme.md) |
|
||||||
|
| 2026-03-14 | Prompt bash personalizzato | [dotfiles-wm](knowledge/dotfiles-wm.md) | 34 | 84255 | [transcript](transcripts/2026-03-14-prompt-bash-personalizzato.md) |
|
||||||
|
| 2026-03-15 | Flatpak con i3 | [dotfiles-wm](knowledge/dotfiles-wm.md) | 14 | 19985 | [transcript](transcripts/2026-03-14-flatpak-con-i3.md) |
|
||||||
|
| 2026-03-17 | Configurazione i3 | [dotfiles-wm](knowledge/dotfiles-wm.md) | 248 | 394245 | [transcript](transcripts/2026-03-06-configurazione-i3.md) |
|
||||||
|
| 2026-03-10 | Configurazione Hyprland All-Black | [dotfiles-wm](knowledge/dotfiles-wm.md) | 32 | 71004 | [transcript](transcripts/2026-03-05-configurazione-hyprland-all-black.md) |
|
||||||
|
| 2026-03-10 | Differenze tra vi e vim | [editors](knowledge/editors.md) | 42 | 130448 | [transcript](transcripts/2026-03-05-differenze-tra-vi-e-vim.md) |
|
||||||
|
| 2026-03-10 | Void Linux install script | [os-unix](knowledge/os-unix.md) | 22 | 29459 | [transcript](transcripts/2026-03-04-void-linux-install-script.md) |
|
||||||
|
| 2026-03-03 | Configurazione NixOS da Fedora | [os-unix](knowledge/os-unix.md) | 2 | 13065 | [transcript](transcripts/2026-03-03-configurazione-nixos-da-fedora.md) |
|
||||||
|
| 2026-01-30 | Migrazione X11 a XLibre | [dotfiles-wm](knowledge/dotfiles-wm.md) | 4 | 6087 | [transcript](transcripts/2026-01-30-migrazione-x11-a-xlibre.md) |
|
||||||
|
| 2026-01-30 | Errore compilazione slstatus | [dotfiles-wm](knowledge/dotfiles-wm.md) | 6 | 6210 | [transcript](transcripts/2026-01-30-errore-compilazione-slstatus.md) |
|
||||||
|
| 2026-01-29 | Configurare clipboard con dmenu | [dotfiles-wm](knowledge/dotfiles-wm.md) | 10 | 12571 | [transcript](transcripts/2026-01-29-configurare-clipboard-con-dmenu.md) |
|
||||||
|
| 2026-01-29 | Troubleshooting FreeBSD Firewall | [os-unix](knowledge/os-unix.md) | 8 | 13624 | [transcript](transcripts/2026-01-29-troubleshooting-freebsd-firewall.md) |
|
||||||
|
| 2026-01-30 | Configurazione dwmblocks | [dotfiles-wm](knowledge/dotfiles-wm.md) | 34 | 37666 | [transcript](transcripts/2026-01-28-configurazione-dwmblocks.md) |
|
||||||
|
| 2026-01-28 | Sistema di notifiche Linux | [dotfiles-wm](knowledge/dotfiles-wm.md) | 2 | 1656 | [transcript](transcripts/2026-01-28-sistema-di-notifiche-linux.md) |
|
||||||
|
| 2026-01-28 | Patch consigliate DWM | [dotfiles-wm](knowledge/dotfiles-wm.md) | 38 | 64134 | [transcript](transcripts/2026-01-28-patch-consigliate-dwm.md) |
|
||||||
|
| 2026-01-28 | Configurazione SSH e GPG | [tools-infra](knowledge/tools-infra.md) | 4 | 4382 | [transcript](transcripts/2026-01-28-configurazione-ssh-e-gpg.md) |
|
||||||
|
| 2026-01-28 | Review configurazione dmenu | [dotfiles-wm](knowledge/dotfiles-wm.md) | 2 | 1935 | [transcript](transcripts/2026-01-28-review-configurazione-dmenu.md) |
|
||||||
|
| 2026-01-28 | Separazione core system user | [os-unix](knowledge/os-unix.md) | 4 | 5779 | [transcript](transcripts/2026-01-28-separazione-core-system-user.md) |
|
||||||
|
| 2026-01-28 | Review configurazione terminale st | [dotfiles-wm](knowledge/dotfiles-wm.md) | 18 | 23940 | [transcript](transcripts/2026-01-27-review-configurazione-terminale-st.md) |
|
||||||
|
| 2026-02-03 | Suggerimenti per un goal | [workflow-progetti](knowledge/workflow-progetti.md) | 28 | 52098 | [transcript](transcripts/2026-01-27-suggerimenti-per-un-goal.md) |
|
||||||
|
| 2026-01-28 | Font UNIX simili Nerd | [os-unix](knowledge/os-unix.md) | 44 | 45673 | [transcript](transcripts/2026-01-26-font-unix-simili-nerd.md) |
|
||||||
|
| 2026-01-27 | Shell più usate BSD | [os-unix](knowledge/os-unix.md) | 4 | 5484 | [transcript](transcripts/2026-01-25-shell-piu-usate-bsd.md) |
|
||||||
|
| 2026-01-27 | Sistemi BSD per laptop | [os-unix](knowledge/os-unix.md) | 48 | 82703 | [transcript](transcripts/2026-01-16-sistemi-bsd-per-laptop.md) |
|
||||||
|
| 2025-12-27 | Dashboard stile Doom | [emacs](knowledge/emacs.md) | 2 | 2899 | [transcript](transcripts/2025-12-27-dashboard-stile-doom.md) |
|
||||||
|
| 2025-12-23 | Load moduli dichiarativo Emacs | [emacs](knowledge/emacs.md) | 24 | 80230 | [transcript](transcripts/2025-12-23-load-moduli-dichiarativo-emacs.md) |
|
||||||
|
| 2025-12-23 | Modularizzare configurazione Emacs | [emacs](knowledge/emacs.md) | 10 | 21994 | [transcript](transcripts/2025-12-22-modularizzare-configurazione-emacs.md) |
|
||||||
|
| 2025-12-18 | Audio remoto con RDP | [tools-infra](knowledge/tools-infra.md) | 18 | 22755 | [transcript](transcripts/2025-12-18-audio-remoto-con-rdp.md) |
|
||||||
|
| 2025-12-23 | Configurazione Go incompleta | [languages](knowledge/languages.md) | 74 | 238971 | [transcript](transcripts/2025-12-16-configurazione-go-incompleta.md) |
|
||||||
|
| 2025-12-15 | Configurazione LSP Bash | [emacs](knowledge/emacs.md) | 4 | 5448 | [transcript](transcripts/2025-12-15-configurazione-lsp-bash.md) |
|
||||||
|
| 2026-01-10 | Ottimizzazione configurazione Emacs | [emacs](knowledge/emacs.md) | 124 | 443924 | [transcript](transcripts/2025-12-12-ottimizzazione-configurazione-emacs.md) |
|
||||||
|
| 2025-12-05 | Come posso ottimizzare la risoluzione di una macchina virtuale su KVM/... | [tools-infra](knowledge/tools-infra.md) | 2 | 3973 | [transcript](transcripts/2025-12-05-come-posso-ottimizzare-la-risoluzione-di-una-macchina-virtua.md) |
|
||||||
|
| 2025-12-05 | Convertire VMDK in QCOW2 | [tools-infra](knowledge/tools-infra.md) | 12 | 32301 | [transcript](transcripts/2025-12-05-convertire-vmdk-in-qcow2.md) |
|
||||||
|
| 2025-09-18 | Rendere email più formale | [workflow-progetti](knowledge/workflow-progetti.md) | 2 | 1476 | [transcript](transcripts/2025-09-18-rendere-email-piu-formale.md) |
|
||||||
|
| 2026-03-04 | Sistema operativo | [os-unix](knowledge/os-unix.md) | 304 | 391155 | [transcript](transcripts/2025-09-17-sistema-operativo.md) |
|
||||||
|
| 2025-12-12 | Emacs per sviluppo kernel | [emacs](knowledge/emacs.md) | 6 | 8762 | [transcript](transcripts/2025-09-06-emacs-per-sviluppo-kernel.md) |
|
||||||
|
| 2025-09-08 | Task Emacs coverage | [emacs](knowledge/emacs.md) | 6 | 11719 | [transcript](transcripts/2025-09-05-task-emacs-coverage.md) |
|
||||||
|
| 2025-08-13 | Vantaggi di NeoMutt | [workflow-progetti](knowledge/workflow-progetti.md) | 42 | 63147 | [transcript](transcripts/2025-08-05-vantaggi-di-neomutt.md) |
|
||||||
|
| 2026-05-16 | Workflow sviluppo UNIX | [workflow-progetti](knowledge/workflow-progetti.md) | 104 | 122812 | [transcript](transcripts/2025-07-19-workflow-sviluppo-unix.md) |
|
||||||
|
| 2025-07-16 | Distribuzioni Linux più UNIX | [os-unix](knowledge/os-unix.md) | 48 | 76857 | [transcript](transcripts/2025-07-14-distribuzioni-linux-piu-unix.md) |
|
||||||
|
| 2026-06-02 | Linguaggi scripting sistema | [languages](knowledge/languages.md) | 90 | 151683 | [transcript](transcripts/2025-07-10-linguaggi-scripting-sistema.md) |
|
||||||
|
| 2025-07-16 | Tiling WM vs DE | [dotfiles-wm](knowledge/dotfiles-wm.md) | 112 | 144738 | [transcript](transcripts/2025-07-08-tiling-wm-vs-de.md) |
|
||||||
|
| 2025-09-08 | Setup sviluppo kernel Linux | [kernel-linux](knowledge/kernel-linux.md) | 22 | 30007 | [transcript](transcripts/2025-07-08-setup-sviluppo-kernel-linux.md) |
|
||||||
|
| 2025-07-08 | Elevazione privilegi con script | [system-programming](knowledge/system-programming.md) | 10 | 14403 | [transcript](transcripts/2025-07-08-elevazione-privilegi-con-script.md) |
|
||||||
|
| 2026-05-16 | Linux Kernel Development | [kernel-linux](knowledge/kernel-linux.md) | 8 | 13550 | [transcript](transcripts/2025-07-03-linux-kernel-development.md) |
|
||||||
|
| 2026-06-02 | Programmazione di Sistema | [system-programming](knowledge/system-programming.md) | 236 | 257690 | [transcript](transcripts/2025-06-17-programmazione-di-sistema.md) |
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
# Pending distillation
|
||||||
|
|
||||||
|
Conversations not yet distilled into `knowledge/` topic files, most
|
||||||
|
valuable first. After distilling, record the mapping in
|
||||||
|
`knowledge/.distilled.json` and re-run
|
||||||
|
`scripts/chatgpt_export_to_memory.py` to refresh this queue.
|
||||||
|
|
||||||
|
Nothing pending: every conversation has a knowledge topic.
|
||||||
11
dotfiles/common/.config/ai/memory/chatgpt/assets/ASSETS.md
Normal file
11
dotfiles/common/.config/ai/memory/chatgpt/assets/ASSETS.md
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Assets
|
||||||
|
|
||||||
|
Binary and personal assets (PDFs, images) are deliberately not
|
||||||
|
imported into the memory tree; they remain only in the original export.
|
||||||
|
|
||||||
|
| Name | Kind | Size | Origin conversation | Action |
|
||||||
|
| --- | --- | ---: | --- | --- |
|
||||||
|
| Confronto tra notifiche Dunst e Mako.png | missing | — | Tiling WM vs DE | not present in this export |
|
||||||
|
| Scrivania Linux con tema Catppuccin Frappe.png | missing | — | Tiling WM vs DE | not present in this export |
|
||||||
|
| correlazione_sistemi_operativi_apue.org | text | 12128 | 69f7d35d-4978-838b-bcc6-b8c3c68abe36 | copied |
|
||||||
|
| ec021735-83cc-4e2c-998b-38c64e2833c9.png | binary | 284086 | Stereotipi Vim vs Emacs | listed only (privacy) |
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
#+TITLE: Correlazione tra Sistemi Operativi - Concetti ed esempi, 8ª ed. e APUE
|
||||||
|
#+AUTHOR: Fabio Scotto di Santolo
|
||||||
|
#+LANGUAGE: it
|
||||||
|
#+OPTIONS: toc:2 num:nil
|
||||||
|
|
||||||
|
* Nota
|
||||||
|
Questa tabella mette in relazione i capitoli di /Sistemi Operativi - Concetti ed esempi/, 8ª edizione, di Silberschatz, Galvin e Gagne, con i capitoli di /Advanced Programming in the UNIX Environment/ (APUE), 3ª edizione, di Stevens e Rago.
|
||||||
|
|
||||||
|
L'obiettivo non è sostituire nessuno dei due testi, ma usarli insieme:
|
||||||
|
|
||||||
|
- *Sistemi Operativi* fornisce il modello teorico: processi, memoria, file system, scheduling, sincronizzazione, I/O.
|
||||||
|
- *APUE* mostra come quei concetti emergono concretamente nelle API UNIX/POSIX.
|
||||||
|
|
||||||
|
* Tabella di correlazione
|
||||||
|
|
||||||
|
| Capitolo Sistemi Operativi, 8ª ed. | Tema teorico | Capitoli APUE correlati | API / argomenti APUE | Priorità per APUE | Note di studio |
|
||||||
|
|------------------------------------+--------------+--------------------------+----------------------+-------------------+----------------|
|
||||||
|
| Cap. 1 - Introduzione | Ruolo del sistema operativo, kernel, astrazioni, protezione, interrupt, system call | Cap. 1 - UNIX System Overview; Cap. 2 - UNIX Standardization and Implementations | architettura UNIX, kernel, shell, standard POSIX, system call, librerie | Alta | Da leggere prima di APUE per avere il lessico base: kernel, user mode, system call, processo, file. |
|
||||||
|
| Cap. 2 - Strutture dei sistemi operativi | Servizi OS, interfacce, system call, struttura kernel, macchine virtuali | Cap. 1; Cap. 2; Cap. 3 - File I/O | syscall vs funzioni di libreria, POSIX, primitive UNIX | Alta | Aiuta a capire perché APUE distingue spesso tra interfaccia standard, implementazione e comportamento specifico del sistema. |
|
||||||
|
| Cap. 3 - Processi | Processo, PCB, stati, context switch, creazione/terminazione, IPC base | Cap. 7 - Process Environment; Cap. 8 - Process Control; Cap. 9 - Process Relationships; Cap. 15 - Interprocess Communication | =fork()=, =exec()=, =wait()=, exit status, environment, pipe, FIFO | Fondamentale | È il ponte più importante: APUE diventa molto più chiaro se hai già il modello teorico di processo. |
|
||||||
|
| Cap. 4 - Thread | Thread, modelli user/kernel, multithreading, concorrenza nello stesso processo | Cap. 11 - Threads; Cap. 12 - Thread Control | =pthread_create()=, mutex, condition variable, thread attributes, cancellazione | Alta | APUE è molto pratico sui pthread; il capitolo teorico serve per capire condivisione di memoria, stack, race e scheduling. |
|
||||||
|
| Cap. 5 - Scheduling della CPU | Scheduler, processi ready/running/waiting, algoritmi FCFS/SJF/RR/priorità | Cap. 8; Cap. 9; Cap. 11 | ordine non deterministico tra processi/thread, =nice()=, priorità, timing | Media | Non serve conoscere tutti gli algoritmi per APUE, ma serve capire che l'ordine di esecuzione non è garantito. |
|
||||||
|
| Cap. 6 - Sincronizzazione dei processi | Race condition, sezione critica, mutex, semafori, monitor | Cap. 10 - Signals; Cap. 11; Cap. 12; Cap. 15 | signal safety, mutex, condition variable, semafori POSIX/System V, IPC | Fondamentale | Cruciale per scrivere codice robusto: segnali, thread e IPC senza modello di concorrenza diventano pericolosi. |
|
||||||
|
| Cap. 7 - Deadlock | Condizioni di deadlock, prevenzione, avoidance, rilevamento | Cap. 11; Cap. 12; Cap. 15; Cap. 17 - Advanced IPC | lock ordering, mutex multipli, file locking, record locking, IPC | Media | APUE non tratta il deadlock in modo teorico esteso, ma il concetto è essenziale quando usi lock e risorse condivise. |
|
||||||
|
| Cap. 8 - Memoria principale | Address space, linking/loading, paginazione, segmentazione, memoria virtuale di base | Cap. 7; Cap. 8; Cap. 14 - Advanced I/O | layout processo, stack, heap, =fork()=, =exec()=, =mmap()= | Alta | Serve per capire cosa viene ereditato dopo =fork()=, cosa cambia con =exec()= e perché la memoria del processo è un'astrazione. |
|
||||||
|
| Cap. 9 - Memoria virtuale | Demand paging, copy-on-write, page replacement, mmap concettuale | Cap. 7; Cap. 8; Cap. 14 | copy-on-write dopo =fork()=, memory mapping, file mappati in memoria | Alta | Molto utile per non interpretare =fork()= come una copia fisica ingenua dell'intero processo. |
|
||||||
|
| Cap. 10 - Interfaccia del file system | File, directory, attributi, permessi, operazioni, link | Cap. 3 - File I/O; Cap. 4 - Files and Directories; Cap. 6 - System Data Files and Information | =open()=, =read()=, =write()=, =stat()=, =chmod()=, =link()=, =symlink()=, =opendir()= | Fondamentale | È il cuore dell'I/O UNIX: inode, directory, permessi e pathname spiegano moltissimo di APUE. |
|
||||||
|
| Cap. 11 - Implementazione del file system | Strutture interne, allocazione, free space, buffer cache, journaling | Cap. 3; Cap. 4; Cap. 5 - Standard I/O Library; Cap. 14 | buffer cache, sync, fsync, stdio buffering, performance I/O | Alta | Aiuta a capire differenza tra scrivere in un buffer utente, nella cache kernel e su disco fisico. |
|
||||||
|
| Cap. 12 - Struttura dei dispositivi di memoria di massa | Dischi, scheduling disco, blocchi, affidabilità | Cap. 3; Cap. 4; Cap. 14 | I/O sequenziale/casuale, blocchi, =lseek()=, performance, =fsync()= | Media | Utile soprattutto se studi performance I/O, filesystem e comportamento reale della persistenza. |
|
||||||
|
| Cap. 13 - Sistemi di I/O | Driver, interrupt, DMA, buffering, caching, blocking/non-blocking I/O | Cap. 3; Cap. 5; Cap. 14; Cap. 18 - Terminal I/O; Cap. 19 - Pseudo Terminals | =fcntl()=, nonblocking I/O, =select()=, =poll()=, terminal driver, pty | Alta | Spiega bene perché una =read()= può bloccare, essere interrotta, o comportarsi diversamente su file, terminali, pipe e socket. |
|
||||||
|
| Cap. 14 - Protezione | Domini di protezione, access control, capability, permessi | Cap. 4; Cap. 6; Cap. 7; Cap. 8 | UID/GID, effective UID, setuid, file permissions, =umask()= | Alta | Fondamentale per capire il modello di sicurezza UNIX: identità del processo più permessi del file. |
|
||||||
|
| Cap. 15 - Sicurezza | Minacce, autenticazione, attacchi, hardening | Cap. 4; Cap. 6; Cap. 8; Cap. 13 - Daemon Processes; Cap. 16 - Network IPC: Sockets | setuid, daemon, socket, permessi, ambiente, file temporanei | Media | APUE non è un libro di security, ma molte API UNIX sono pericolose se usate senza questo contesto. |
|
||||||
|
| Cap. 16 - Strutture dei sistemi distribuiti | Sistemi distribuiti, comunicazione, modelli client/server | Cap. 16; Cap. 17 | socket, client/server, descriptor passing, IPC avanzata | Media | Utile quando passi dalla programmazione locale a processi che comunicano via rete. |
|
||||||
|
| Cap. 17 - File system distribuiti | File remoti, naming, caching, coerenza | Cap. 3; Cap. 4; Cap. 14; Cap. 16 | semantica file su NFS/remote FS, errori I/O, locking, caching | Bassa/Media | Non è indispensabile all'inizio, ma spiega perché non tutti i filesystem rispettano esattamente le stesse assunzioni. |
|
||||||
|
| Cap. 18 - Coordinamento distribuito | Ordinamento eventi, mutua esclusione distribuita, recovery | Cap. 15; Cap. 16; Cap. 17 | IPC, socket, protocolli applicativi, sincronizzazione tra processi | Bassa | Utile solo se vuoi estendere APUE verso sistemi distribuiti o server complessi. |
|
||||||
|
| Cap. 19 - Sistemi real-time | Vincoli temporali, scheduling real-time, latenza | Cap. 8; Cap. 11; Cap. 12; Cap. 14 | scheduling, priorità, segnali, timer, I/O non bloccante | Bassa/Media | Interessante, ma non propedeutico alla maggior parte di APUE. |
|
||||||
|
| Cap. 20 - Sistemi multimediali | Scheduling e I/O per audio/video, continuità temporale | Cap. 14; Cap. 16 | I/O avanzato, buffering, rete, timing | Bassa | Poco centrale per APUE classico. |
|
||||||
|
| Cap. 21 - Il sistema Linux | Linux come caso di studio: processi, memoria, filesystem, moduli, I/O | Tutto APUE, in particolare Cap. 1, 3, 4, 7, 8, 10, 11, 14, 15, 16 | comportamento reale su Linux delle API UNIX/POSIX | Alta | Molto utile per collegare teoria, APUE e ambiente GNU/Linux reale. |
|
||||||
|
| Cap. 22 - Windows XP | Architettura Windows, processi, thread, memoria, I/O, sicurezza | Confronto indiretto con APUE | differenze rispetto a POSIX/UNIX | Bassa | Utile solo come confronto architetturale, non necessario per studiare APUE. |
|
||||||
|
| Cap. 23 - Sistemi operativi influenti | UNIX, BSD, Linux, Mach, altri sistemi storici | Cap. 1; Cap. 2 | contesto storico UNIX/POSIX/BSD/System V | Media | Aiuta a capire perché APUE cita spesso differenze storiche tra UNIX, BSD, System V e POSIX. |
|
||||||
|
|
||||||
|
* Percorso consigliato
|
||||||
|
|
||||||
|
** Prima passata: capitoli teorici davvero propedeutici ad APUE
|
||||||
|
|
||||||
|
Se vuoi leggere il minimo indispensabile prima o durante APUE, concentrati su:
|
||||||
|
|
||||||
|
| Priorità | Capitoli Sistemi Operativi | Perché |
|
||||||
|
|----------+----------------------------+--------|
|
||||||
|
| 1 | Cap. 1 - Introduzione | Lessico base: kernel, processi, system call, protezione. |
|
||||||
|
| 2 | Cap. 2 - Strutture dei sistemi operativi | Capire interfacce, servizi OS e ruolo delle syscall. |
|
||||||
|
| 3 | Cap. 3 - Processi | Necessario per =fork()=, =exec()=, =wait()=, zombie, orphan. |
|
||||||
|
| 4 | Cap. 8 - Memoria principale | Necessario per address space, stack, heap, ereditarietà dopo =fork()=. |
|
||||||
|
| 5 | Cap. 9 - Memoria virtuale | Necessario per copy-on-write e =mmap()=. |
|
||||||
|
| 6 | Cap. 10 - Interfaccia del file system | Necessario per file descriptor, directory, inode, link, permessi. |
|
||||||
|
| 7 | Cap. 13 - Sistemi di I/O | Necessario per blocking I/O, buffering, driver, terminali. |
|
||||||
|
| 8 | Cap. 6 - Sincronizzazione dei processi | Necessario per thread, segnali e IPC robusto. |
|
||||||
|
|
||||||
|
** Seconda passata: lettura APUE guidata dalla teoria
|
||||||
|
|
||||||
|
| Blocco APUE | Capitoli APUE | Teoria da affiancare |
|
||||||
|
|-------------+---------------+----------------------|
|
||||||
|
| Fondamenti UNIX | APUE 1-2 | Sistemi Operativi 1-2, 23 |
|
||||||
|
| File e directory | APUE 3-5 | Sistemi Operativi 10-13 |
|
||||||
|
| Ambiente di processo | APUE 6-7 | Sistemi Operativi 1-3, 8 |
|
||||||
|
| Processi | APUE 8-9 | Sistemi Operativi 3, 5, 8, 9 |
|
||||||
|
| Segnali | APUE 10 | Sistemi Operativi 3, 6, 13 |
|
||||||
|
| Thread | APUE 11-12 | Sistemi Operativi 4, 5, 6, 7 |
|
||||||
|
| Daemon | APUE 13 | Sistemi Operativi 3, 14, 15 |
|
||||||
|
| I/O avanzato | APUE 14 | Sistemi Operativi 11-13 |
|
||||||
|
| IPC | APUE 15, 17 | Sistemi Operativi 3, 6, 7, 16, 18 |
|
||||||
|
| Socket | APUE 16 | Sistemi Operativi 16 |
|
||||||
|
| Terminali | APUE 18-19 | Sistemi Operativi 13 |
|
||||||
|
|
||||||
|
* Lettura pratica consigliata
|
||||||
|
|
||||||
|
** Metodo
|
||||||
|
Per ogni argomento APUE, fai questo ciclo:
|
||||||
|
|
||||||
|
1. Leggi il capitolo APUE.
|
||||||
|
2. Torna al capitolo teorico corrispondente di /Sistemi Operativi/.
|
||||||
|
3. Scrivi un piccolo programma C che dimostri il comportamento.
|
||||||
|
4. Osserva con strumenti come =strace=, =lsof=, =ps=, =pstree=, =top=, =gdb=.
|
||||||
|
|
||||||
|
** Esempi concreti
|
||||||
|
|
||||||
|
| Tema | Teoria | APUE | Esperimento C |
|
||||||
|
|------+--------+------+---------------|
|
||||||
|
| =fork()= | Processi + memoria virtuale | APUE 8 | Modifica una variabile dopo =fork()= e osserva che padre e figlio non condividono lo stesso valore. |
|
||||||
|
| Buffering | I/O + file system implementation | APUE 5 | Usa =printf()= prima di =fork()= e confronta con =write()=. |
|
||||||
|
| File descriptor | File system + I/O | APUE 3-4 | Apri un file, fai =fork()=, scrivi da padre e figlio, osserva offset condiviso. |
|
||||||
|
| Zombie | Process lifecycle | APUE 8 | Crea un figlio che termina senza =wait()= e osserva con =ps=. |
|
||||||
|
| Pipe | IPC | APUE 15 | Implementa =ls | wc -l= con =pipe()=, =fork()=, =dup2()=, =execvp()=. |
|
||||||
|
| Signal safety | Sincronizzazione + interrupt | APUE 10 | Gestisci =SIGINT= usando =sigaction()= e solo funzioni async-signal-safe. |
|
||||||
|
| Thread race | Thread + sincronizzazione | APUE 11-12 | Incrementa un contatore condiviso con e senza mutex. |
|
||||||
|
| mmap | Memoria virtuale + I/O | APUE 14 | Mappa un file in memoria e modifica il contenuto tramite puntatore. |
|
||||||
|
|
||||||
|
* Sintesi operativa
|
||||||
|
|
||||||
|
Per capire bene APUE, i capitoli più propedeutici di /Sistemi Operativi - Concetti ed esempi/ sono:
|
||||||
|
|
||||||
|
1. Cap. 1 - Introduzione
|
||||||
|
2. Cap. 2 - Strutture dei sistemi operativi
|
||||||
|
3. Cap. 3 - Processi
|
||||||
|
4. Cap. 4 - Thread
|
||||||
|
5. Cap. 6 - Sincronizzazione dei processi
|
||||||
|
6. Cap. 8 - Memoria principale
|
||||||
|
7. Cap. 9 - Memoria virtuale
|
||||||
|
8. Cap. 10 - Interfaccia del file system
|
||||||
|
9. Cap. 11 - Implementazione del file system
|
||||||
|
10. Cap. 13 - Sistemi di I/O
|
||||||
|
11. Cap. 14 - Protezione
|
||||||
|
|
||||||
|
Il resto è utile, ma può essere letto dopo o solo quando APUE porta naturalmente verso quei temi.
|
||||||
@@ -0,0 +1,327 @@
|
|||||||
|
{
|
||||||
|
"685167c3-b12c-800c-81d5-f6bdc8a74562": {
|
||||||
|
"file": "system-programming.md",
|
||||||
|
"update_time": 1780433040.853008,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6866c486-7300-800c-be99-ac3501bf5b77": {
|
||||||
|
"file": "kernel-linux.md",
|
||||||
|
"update_time": 1778923109.243077,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"686d38ec-32c4-800c-a985-c33dd4b44161": {
|
||||||
|
"file": "system-programming.md",
|
||||||
|
"update_time": 1752003606.28604,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"686d7d88-4460-800c-aa07-6c8f911f8c49": {
|
||||||
|
"file": "kernel-linux.md",
|
||||||
|
"update_time": 1757349193.843844,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"686d81d8-69a4-800c-b1ba-530150987032": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1752651719.565563,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"686ff063-7428-800c-9016-e5aa61caea8e": {
|
||||||
|
"file": "languages.md",
|
||||||
|
"update_time": 1780433158.417545,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6874a63d-d6a0-800c-992f-cfc19f80454b": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1752651704.598057,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"687bc9a4-1854-800c-ae29-716738d317e1": {
|
||||||
|
"file": "workflow-progetti.md",
|
||||||
|
"update_time": 1778923094.265412,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"68923cad-2cd4-832d-a105-614b03ca137e": {
|
||||||
|
"file": "workflow-progetti.md",
|
||||||
|
"update_time": 1755117969.032211,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"68bafb5a-d928-832a-8823-c593678fdf77": {
|
||||||
|
"file": "emacs.md",
|
||||||
|
"update_time": 1757349203.215213,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"68bb674f-9908-8333-9173-93b9f68dc596": {
|
||||||
|
"file": "emacs.md",
|
||||||
|
"update_time": 1765579118.250868,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"68cad26e-dd94-8324-8582-035e3ce3fc27": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1772616989.003913,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"68cbae4c-c880-8330-b670-1ae2b72ecf3a": {
|
||||||
|
"file": "workflow-progetti.md",
|
||||||
|
"update_time": 1758179016.783481,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6932aed3-5008-8325-b969-08dc6f35d7eb": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1764947756.940428,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6932dbf4-7a64-832d-a7f7-5005245cf511": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1764940820.249017,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"693c9a44-0b58-8328-afe4-c100001d0b74": {
|
||||||
|
"file": "emacs.md",
|
||||||
|
"update_time": 1768033876.668465,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69402abc-8e94-8330-8fbb-dd89e8500455": {
|
||||||
|
"file": "emacs.md",
|
||||||
|
"update_time": 1765827941.712685,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6941cf18-6f08-8329-b85e-fe8452eca316": {
|
||||||
|
"file": "languages.md",
|
||||||
|
"update_time": 1766521390.157466,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6943c84b-4700-8326-b849-3f04db1095f0": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1766056415.975342,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6949436f-8188-8332-825a-5a1c110f979b": {
|
||||||
|
"file": "emacs.md",
|
||||||
|
"update_time": 1766481588.378852,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"694a6621-433c-8332-bc9e-e30a7c1c58ff": {
|
||||||
|
"file": "emacs.md",
|
||||||
|
"update_time": 1766501505.279918,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"694fe73f-0098-8328-9f6c-5b741ff646f7": {
|
||||||
|
"file": "emacs.md",
|
||||||
|
"update_time": 1766844282.338716,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"696a9898-b0f0-832d-9a3d-8fa63b04faae": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1769535774.84958,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69763d15-3e24-832c-9930-82efa6e25328": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1769535772.281699,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6977b78a-f834-8331-82b9-4e2d54d812bf": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1769634405.491939,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6978f931-c360-8330-bdca-e834d697e573": {
|
||||||
|
"file": "workflow-progetti.md",
|
||||||
|
"update_time": 1770155923.725881,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6979389b-b960-8325-96e3-7b001e50ce7a": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769588061.881458,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6979c732-61d0-832d-bd30-b315fe48a404": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1769589281.670914,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6979d453-6280-8394-b226-f474e9f6396d": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769592026.220427,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6979d80a-94ec-8332-b457-8f9e0565fd50": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1769594005.602308,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"697a3192-f26c-8332-84a0-efabc00bd9ca": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769638385.348066,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"697a8a96-c698-8331-a69e-89e369ccf7af": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769638664.930514,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"697a8d2b-4860-832d-b27a-afe1bc57a374": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769763606.585632,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"697b93aa-5540-8326-af88-8f1f7d3ec3dd": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1769707710.068735,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"697b9bfb-517c-8329-84c7-b7e31f6064eb": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769710121.720131,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"697c8177-058c-832f-aa73-5d596937b859": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769768704.260967,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"697cd843-9ebc-8330-8f76-8be9a5fc5b19": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1769789728.874143,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69a7607d-5e54-8394-ac56-e8fed40dcbcf": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1772577121.688374,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69a8777f-9f50-8392-9cee-b97f215b50ce": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1773143444.063749,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69a98a38-a190-8388-ad12-872cb1b5af6b": {
|
||||||
|
"file": "editors.md",
|
||||||
|
"update_time": 1773143441.163061,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69a9c38b-afe0-8385-b4d7-fedba0df178c": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1773143437.941349,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69ab3ef4-39f4-8394-b777-d4f9b49ff0da": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1773784658.530316,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69b5da0f-d374-8389-9991-89a66fa1e673": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1773580920.053333,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69b5dd63-7898-838a-94ee-b9743f50156b": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1773528489.873979,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69cbefbd-4bb4-8384-a220-62384afef291": {
|
||||||
|
"file": "workflow-progetti.md",
|
||||||
|
"update_time": 1775227965.945387,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"69ff7592-2710-83eb-ae64-e5053372daef": {
|
||||||
|
"file": "kernel-linux.md",
|
||||||
|
"update_time": 1778532066.320462,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a13661f-f078-83eb-8ee5-0c297c98db1e": {
|
||||||
|
"file": "editors.md",
|
||||||
|
"update_time": 1779656241.674157,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a1e6bf8-1b8c-8390-9833-994f3db7d912": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1780378748.191027,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a1f410f-f820-8390-8a34-b6c737026d88": {
|
||||||
|
"file": "system-programming.md",
|
||||||
|
"update_time": 1780433260.971354,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a342e8f-c59c-83eb-9d0f-82d5dc067a98": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1781805156.370825,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a380356-7dac-83eb-9098-1e5296fdb9d1": {
|
||||||
|
"file": "system-programming.md",
|
||||||
|
"update_time": 1782059738.123604,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a3819f6-e77c-83eb-98dc-ac4b805343c3": {
|
||||||
|
"file": "os-unix.md",
|
||||||
|
"update_time": 1782065360.547886,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a398d5f-7f94-83eb-b0ed-be540993bce5": {
|
||||||
|
"file": "editors.md",
|
||||||
|
"update_time": 1782160202.582969,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a39a298-6e90-83eb-9c95-f1e0399209f3": {
|
||||||
|
"file": "editors.md",
|
||||||
|
"update_time": 1787390859.164463,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a57b10f-61fc-83eb-aac9-c6f611262fac": {
|
||||||
|
"file": "editors.md",
|
||||||
|
"update_time": 1784667453.737104,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a5d3c43-0cb0-83eb-bba1-40fa22ac9294": {
|
||||||
|
"file": "dotfiles-wm.md",
|
||||||
|
"update_time": 1784495180.502421,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a6c961b-c828-83eb-8b57-2bf590ca385e": {
|
||||||
|
"file": "system-programming.md",
|
||||||
|
"update_time": 1786801580.813567,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a973c10-e46c-83eb-8628-6372ff91856d": {
|
||||||
|
"file": "workflow-progetti.md",
|
||||||
|
"update_time": 1788296248.558538,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6a9c77bc-3fe0-83ed-906d-19a089a7ac24": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1788640495.337073,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6aacdebe-cc08-83eb-a8bc-02affda0f2ca": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1789715077.072826,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6aad9e99-aa80-83eb-9f9d-9e0656b7fb2e": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1789763243.229647,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6aad9ff4-f1bc-83eb-8ccb-561c5b870ce8": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1789763585.105883,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6ab1837e-8044-83ed-a832-40ea3c795642": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1790019328.545161,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6ab3fa9e-ed44-83eb-a8dc-156cf0aa4f67": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1790180017.108555,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
},
|
||||||
|
"6ab4cb86-1dc0-83eb-b898-af3adde685bc": {
|
||||||
|
"file": "tools-infra.md",
|
||||||
|
"update_time": 1790234352.43415,
|
||||||
|
"distilled": "2026-11-08"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
# Profilo — contesto stabile dell'utente
|
||||||
|
|
||||||
|
> Primo file da consultare quando serve una conoscenza di fondo su chi è
|
||||||
|
> l'utente, il suo ambiente e le sue preferenze. Derivato dall'insieme
|
||||||
|
> delle 74 conversazioni ChatGPT (giugno 2025 – ottobre 2026); i dettagli
|
||||||
|
> sono nei file tematici in `knowledge/` e nei `transcripts/`.
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Percorso e obiettivi
|
||||||
|
- Fabio Scotto di Santolo; percorso principale: system programming in C
|
||||||
|
su UNIX/Linux (APUE 3ª ed. di Stevens/Rago + Silberschatz per la teoria).
|
||||||
|
- Studio parallelo dello sviluppo kernel Linux (Linux Kernel Development
|
||||||
|
di Love); test di deepening su xv6.
|
||||||
|
- Progetto applicativo principale del periodo: fsnap, strumento in C per
|
||||||
|
gli esercizi dei capitoli 1-5 di APUE (vedi system-programming.md).
|
||||||
|
|
||||||
|
## Ambiente (interamente gestito dal playbook AnsiblePlaybook)
|
||||||
|
- ikaros: desktop personale Fedora GNOME (host principale).
|
||||||
|
- nymph: laptop Fedora GNOME.
|
||||||
|
- deadalus: workstation Windows + Fedora WSL.
|
||||||
|
- prometheus: server Rocky Linux 9.
|
||||||
|
- atlas: NAS Rocky 9 con ZFS (dataset `archive` SMB e servizi separati).
|
||||||
|
- aegis: nodo always-on Fedora IoT su Raspberry Pi 4.
|
||||||
|
- Dotfiles layered e riproducibili: "If it cannot be rebuilt, it is not owned."
|
||||||
|
(dettagli in os-unix.md e dotfiles-wm.md).
|
||||||
|
|
||||||
|
## Posizioni stabili (confermate su più conversazioni)
|
||||||
|
- Filosofia: UNIX philosophy, minimalismo, riproducibilità, controllo
|
||||||
|
esplicito (preferisce configurazioni che capisce e ricostruisce).
|
||||||
|
- Vim è l'editor primario di sviluppo; Emacs è l'ambiente di authoring
|
||||||
|
(org-mode, appunti, documenti) con configurazione modulare deployata
|
||||||
|
dal playbook (dettagli in editors.md ed emacs.md).
|
||||||
|
- Fedora è la distro stabile quotidiana; FreeBSD (su ThinkPad T480) e
|
||||||
|
Void Linux sono studiati/valutati come strumenti di apprendimento UNIX,
|
||||||
|
oltre a NixOS valutato senza adozione (dettagli in os-unix.md).
|
||||||
|
- Bash per lo scripting; Go secondario; Python di supporto (languages.md).
|
||||||
|
- Sperimenta dentro VM; dati protetti da una strategia multi-livello: snapshot ZFS,
|
||||||
|
Borg criptato, USB offline con test di ripristino (tools-infra.md).
|
||||||
|
|
||||||
|
## Come usare questa memoria
|
||||||
|
- `INDEX.md` — indice datato di tutte le conversazioni con il topic.
|
||||||
|
- `knowledge/` — un file per argomento (decisions e stati finali).
|
||||||
|
- Ricerca full-text dei contenuti originali:
|
||||||
|
|
||||||
|
rg -i "<keyword>" ~/.config/ai/memory/chatgpt/transcripts/
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# Desktop — window manager, dotfiles, shell
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Preferenze e conclusioni stabili
|
||||||
|
|
||||||
|
- Filosofia UNIX/suckless come bussola: core system "noioso, stabile, sostituibile" separato dallo user environment (rif. separazione_core_system_vs_user_environment.md); tool piccoli e compositabili, niente feature creep né patch/dipendenze speculative.
|
||||||
|
- Velocità > effetti: compositing rimosso del tutto; anche su Hyprland niente blur/ombre/rounding, bordi sottili e contrasto pulito.
|
||||||
|
- Tiling statico (i3) sufficiente: abitudine a 1-2 finestre per workspace (quasi mai 3); apprezzata la modalità tab di i3; la filosofia dinamica di dwm piace "per curiosità" ma non serve al suo workflow.
|
||||||
|
- Preferenza per tool GTK su Qt: flameshot accettato solo come deviazione pragmatica e in seguito sostituito dal tool screenshot di XFCE; spectacle e xfce4-screenshooter scartati per le dipendenze.
|
||||||
|
- Font: nerd font esclusi ("troppo pesanti"; st con font fixed); scelta stabile successiva Liberation / Liberation Mono per terminale, bar e GTK; icone Papirus nell'esperimento Sway 2025.
|
||||||
|
- Wayland giudicato architetturalmente migliore ma immaturo: screencasting via portali, clipboard e tooling giovani sono limiti reali; X11 ritenuto non morente, anche per il fork XLibre.
|
||||||
|
- Su FreeBSD restare su Xorg: XLibre = entropia nel core (governance incerta, rischi input/GPU); Wayland su BSD "supportato ma non centrale" (DRM via port linuxkpi), da default solo su Linux.
|
||||||
|
- Login senza display manager (scelta esplicita): TTY → PAM → startx → i3 con dbus-run-session; su Void elogind; in precedenza lightdm.
|
||||||
|
- Flatpak riservato a GUI che accedono alla rete e software proprietari; XBPS per il resto; stack minimale flatpak + xdg-desktop-portal + xdg-desktop-portal-gtk + dbus (runit).
|
||||||
|
- Shell: un solo .bashrc portabile Void Linux + FreeBSD (detection via uname -s, alias con fallback GNU/BSD), niente GNU-centrismi né framework.
|
||||||
|
|
||||||
|
## Traiettoria storica (i3 → dwm → Hyprland → rimozione)
|
||||||
|
|
||||||
|
- 2025-07 "Tiling WM vs DE": interesse iniziale per Hyprland su Arch (tema catppuccin-frappe, kitty, waybar, hyprpaper, Thunar, ssh/gpg-agent via systemd, rofi-wayland poi sostituito con fuzzel) → cambio idea verso Sway; script di installazione convertito a Void (no systemd: link runit per dbus e NetworkManager, xinitrc): sway, fuzzel, foot, waybar, mako, grim+slurp, swayidle+swaylock, swaybg, pipewire, thunar, Papirus, font Cascadia Code Nerd.
|
||||||
|
- 2026-01 stagione suckless su FreeBSD: dwm patchato + st + dmenu + dwmblocks (poi slstatus) + dunst + clipboard clipmenu/xclip; schema colori habamax condiviso dwm/dmenu/st via Xresources; wallpaper versionato; migrazione a XLibre valutata e respinta (resta Xorg).
|
||||||
|
- 2026-03-05 Hyprland "all-black" su Void (ThinkPad T480): esperimento Nothing-style monocromatico (#000000/#0a0a0a/#e6e6e6, accent #ffffff), layout master, bordi bianchi sottili, wallpaper full-black con Gargantua; bar: dapprima Yambar, poi waybar (scelta per la system tray: cpu/ram/disco/tray, icone grandi, font Liberation, rebase sulla conf waybar già presente nel repo).
|
||||||
|
- 2026-03-06/17 i3 su Void (nymph): macchine dichiarate — ikaros (workstation, Void+XFCE+i3), nymph (laptop T480, da Void+Hyprland a i3; idea iniziale FreeBSD+dwm persa per problemi di dual boot; deve essere stabile per eventi), voidtest (laptop di test, Void+XFCE+i3), deadalus (lavoro, Windows → previsto Debian+GNOME); piano: ikaros → Xorg+i3, nymph → XLibre+i3, voidtest → Hyprland "i3-like"; "scelta di produttività" dichiarata: i3.
|
||||||
|
- Evoluzione tool dichiarata nello stack i3: polybar → i3blocks, diodon → clipboard XFCE (clipman), flameshot → screenshot di XFCE.
|
||||||
|
- Esito finale (fuori da queste chat): i3 rimosso dal repo (scripts/remove_i3.sh); ikaros/nymph oggi Fedora GNOME con dotfiles condivisi; su Void il profilo desktop gestisce Sway e Niri (.bashrc.d, alacritty, foot, rofi, waybar, wlogout, mpv).
|
||||||
|
|
||||||
|
## Prompt bash e shell
|
||||||
|
|
||||||
|
- Prompt bash single-line stile dark/gothic "con accento BSD", formato finale: `fscotto:~/src/dotfiles <main> ›`; path "classico" con `~/` al posto di `/home/fscotto`; colori un po' accesi; no powerline, nessuna Nerd Font obbligatoria.
|
||||||
|
- Feature del prompt: branch git + stato repo (`* + ?`), venv Python, rilevamento container/chroot, host mostrato solo via SSH, exit code riflesso nel colore del simbolo ($ vs # per root).
|
||||||
|
- Origini: config Bash "sobria" nata su FreeBSD (branch git nel prompt + fzf sulla history), poi resa realmente portabile tra Void Linux e FreeBSD.
|
||||||
|
- .bashrc portabile: PLATFORM via `uname -s`; HISTSIZE=10000, HISTFILESIZE=20000, HISTCONTROL=ignoredups:erasedups, HISTIGNORE='ls:ll:la:l:pwd:exit:clear:history'; sync history via PROMPT_COMMAND (`history -a; -c; -r`); shopt histappend checkwinsize cmdhist; set -o emacs; exit se non interattiva.
|
||||||
|
- Alias: `ls --color=auto` con fallback `ls -G`, `grep --color=auto`, l/ll/la, `..`/`...`, git (g, ga, gb, gc, gca, gco, gd, gl, gp, gs, glog), cp/mv/rm con `-i`; PATH con ~/.local/bin e ~/bin; umask 022.
|
||||||
|
- fzf su Ctrl-r (bind -x `__fzf_history__`: history deduplicata, ordine inverso, layout reverse 40%).
|
||||||
|
|
||||||
|
## Configurazioni specifiche (st, dmenu, slstatus, notifiche, clipboard)
|
||||||
|
|
||||||
|
- st: patch applicate alpha, blink-cursor, oneclipboard, Xresources, scrollback-ringbuffer; patch mantenute in repo personale; font fixed (no glifi); patch "search" ufficiale inesistente (alternative: vim_browse, keyboard_select) → decisione: fermarsi, aggiungere patch solo a fronte di attrito reale.
|
||||||
|
- dmenu: patch case-insensitive, desktoponly, xresources; comportamento riconfigurabile via Xresources e non hardcodato; evitare patch con decorazioni, popup o menù a tab.
|
||||||
|
- dwm: patch applicate attachaside, pertag, swallow, Xresources, movestack, cyclelayouts, restartsig, titlecolor (per la bar); exitmenu scartato di proposito; patch consigliate ma non aggiunte: resizecorners o resizehere (una sola), focusonnetactive (opzionale); patch rifiutate: winview, windowtags, stacker, switcher grafici, IPC, scratchpad.
|
||||||
|
- config.h: font Liberation Mono 12 (anche dmenufont); colori norm #222222/#bbbbbb/#444444, sel #005577/#eeeeee; tags 1-9; regole: Gimp floating, Firefox su tag 9, St come terminale (noswallow).
|
||||||
|
- Navigazione: Mod+j/k focusstack, Mod+Shift+j/k movestack, Mod+m focusmaster; layout tile/monocle/floating implicito (cyclelayouts per ciclarli).
|
||||||
|
- Schema habamax unico per dwm/dmenu/st via Xresources; wallpaper con percorso stabile, versionato, impostato con tool semplice (feh/xsetroot), non deve influenzare dwm.
|
||||||
|
- Startup pulito e deterministico in un solo punto: ~/.xinitrc (o ~/.xsession) per Xresources, wallpaper, bar, input; config giudicata "da power user UNIX": non aggiungere altro.
|
||||||
|
|
||||||
|
- dwmblocks: parte dello user environment, installato in ~/.local (`make install PREFIX=$HOME/.local`); script dei blocchi in ~/.config/dwmblocks (ora, batteria, cpu, memoria, temperatura, rete, volume); blocks.h con interval + update signal (`pkill -RTMIN+N dwmblocks`); avvio via autostart di dwm.
|
||||||
|
- Tray richiesta da ProtonMail Bridge: stalonetray scartato ("veramente tremendo"); applicata la patch systray di dwm (merge riuscito).
|
||||||
|
- Blocco volume su FreeBSD: output reale di `mixer vol` è `vol.volume=0.70:0.70` + `vol.mute=on`; script definitivo (una sola chiamata a mixer, POSIX sh, mai output vuoto):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
#!/bin/sh
|
||||||
|
out=$(mixer vol)
|
||||||
|
echo "$out" | grep -q 'vol.mute=on' && { printf "MUTE"; exit 0; }
|
||||||
|
vol=$(echo "$out" | awk -F'[=:]' '/vol.volume/ { printf "%d", $2 * 100 }')
|
||||||
|
printf "%s%%" "$vol"
|
||||||
|
```
|
||||||
|
|
||||||
|
- slstatus: su FreeBSD la compilazione falliva per `sndio.h` assente (sndio è l'audio di OpenBSD; su FreeBSD l'audio nativo è OSS; sndctl non c'entra nulla) → rimossi modulo volume e riferimenti `-lsndio` da config.h/config.mk: funziona senza audio.
|
||||||
|
- Verdetto architetturale: slstatus (standalone, pull-based, run→print→exit, zero IPC) preferito a dwmblocks ("mini-framework", loop residente, coupling con dwm); dichiarato più coerente con gli obiettivi minimale/ricostruibile.
|
||||||
|
- Notifiche: dunst + notify-send per dwm/X11 (dunstrc con tema coerente con st/dwm); mako come equivalente Wayland; dunst confermato anche negli stack Hyprland e i3 (con gap tra le notifiche).
|
||||||
|
- Clipboard (fase dwm): X11 ha PRIMARY (middle click) e CLIPBOARD separate, da supportare entrambe; xclip nello user environment; storia solo testo via clipmenu + clipmenud (`clipmenud &` in .xinitrc, binding Mod+v in config.h); da evitare manager grafici (parcellite, copyq), systemd user service, notifiche a ogni copia.
|
||||||
|
- Immagini: dmenu/clipmenu non gestiscono immagini; screenshot → clipboard con `maim -s | xclip -selection clipboard -t image/png` (binding Mod+Shift+s); flameshot = deviazione pragmatica per annotazioni (Qt + demone residente); via di mezzo: `gnome-screenshot -a -c`; persistenza solo su file, mai in history.
|
||||||
|
- i3 puro su Void (nymph): stack finale dichiarato completo — i3, rofi (visualizzato stile dmenu), dunst, alacritty (nero profondo), i3blocks, powermenu rofi con icone (Shutdown/Reboot/Logout/Lock/Suspend), i3lock-color con lockscreen screenshot+blur (scrot + convert), pipewire, power management, automount USB con tray, gnome-keyring funzionante, ProtonMail Bridge verificato.
|
||||||
|
- Temi: Yaru dark accento blue (pacchetti yaru, yaru-plus) + font Liberation per GTK, applicati da script invocato dalla config i3; palette blu #4a90d9 unificata su i3/dunst/rofi/i3blocks/i3lock; wallpaper minimal con Gargantua; rofi con contrasto ridotto tra righe non selezionate.
|
||||||
|
- i3blocks attivi: memory, temperature, backlight, essid, keyindicator, time (script in ~/.config/i3blocks/scripts); risolti problemi di visibilità di brightness e keyindicator.
|
||||||
|
- Keyring: la causa era il doppione di keyring `login`/`Login`; fix: un solo keyring `login` con password uguale all'utente, pam_gnome_keyring in /etc/pam.d/login (auth/session optional + use_authtok), rimosso `exec gnome-keyring-daemon` manuale dalla config i3; flusso: TTY login → PAM → startx → i3 → dbus-run-session; verifiche con secret-tool e busctl (org.freedesktop.secrets).
|
||||||
|
- Flatpak + i3 (Void): nessun problema strutturale con i3; stack minimale flatpak + xdg-desktop-portal + xdg-desktop-portal-gtk (+ dbus runit: `ln -s /etc/sv/dbus /var/service`); senza gnome-shell, gvfs, gnome-settings-daemon; portal via DBus activation; dati app in ~/.var/app.
|
||||||
|
- App Flatpak installate (approvate): ProtonMail Bridge, Flatseal, Warehouse, Spotify, Telegram; Calibre neutro (alternativa XBPS lecita); Chromium rimasto da XBPS su ikaros.
|
||||||
|
- Separazione dichiarata: base XBPS (i3, rofi, dunst, alacritty, chromium, neovim, git, mpv, zathura) vs app isolate in Flatpak; audit periodico `flatpak list --runtime` e `flatpak uninstall --unused`.
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- dwm: exitmenu solo se strettamente necessario; policy floating via Rules (dialog, file picker) al posto di nuove patch; modello multi-monitor da decidere.
|
||||||
|
- slstatus: revisione del config.h e scelta di dove eseguirlo (loop, cron, autostart dwm); eventuale modulo OSS custom per il volume (manutenzione propria, non upstream).
|
||||||
|
- st: valutare vim_browse/keyboard_select solo a fronte di attrito reale; confronto scrollback-ringbuffer vs workflow `less`.
|
||||||
|
- i3: struttura definitiva dei dotfiles (i3, rofi, dunst, i3blocks, scripts) da preparare e replicare su ikaros; rifiniture durante l'uso quotidiano.
|
||||||
|
- Sperimenti rimandati: Hyprland "i3-like" su voidtest (plugin + keybinding stile i3) come esercizio per il futuro; XLibre previsto per nymph su Void (poi abbandonato con l'intera linea i3).
|
||||||
|
- Prompt bash: rifiniture facoltative — git dirty compatto (`<main*>`), prompt root rosso con `#`.
|
||||||
|
- Flatpak: integrazione automatica di tema/font per le app Flatpak proposta ma non implementata.
|
||||||
|
- 2026-07-19 "Notifications Summary": non pertinente (sintesi di una pagina di notifiche ChatGPT), nessun contenuto tecnico.
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-07-08 → 2025-07-16 | Tiling WM vs DE | transcripts/2025-07-08-tiling-wm-vs-de.md |
|
||||||
|
| 2026-01-27 → 2026-01-28 | Review configurazione terminale st | transcripts/2026-01-27-review-configurazione-terminale-st.md |
|
||||||
|
| 2026-01-28 | Patch consigliate DWM | transcripts/2026-01-28-patch-consigliate-dwm.md |
|
||||||
|
| 2026-01-28 | Review configurazione dmenu | transcripts/2026-01-28-review-configurazione-dmenu.md |
|
||||||
|
| 2026-01-28 | Sistema di notifiche Linux | transcripts/2026-01-28-sistema-di-notifiche-linux.md |
|
||||||
|
| 2026-01-28 → 2026-01-30 | Configurazione dwmblocks | transcripts/2026-01-28-configurazione-dwmblocks.md |
|
||||||
|
| 2026-01-29 | Configurare clipboard con dmenu | transcripts/2026-01-29-configurare-clipboard-con-dmenu.md |
|
||||||
|
| 2026-01-30 | Errore compilazione slstatus | transcripts/2026-01-30-errore-compilazione-slstatus.md |
|
||||||
|
| 2026-01-30 | Migrazione X11 a XLibre | transcripts/2026-01-30-migrazione-x11-a-xlibre.md |
|
||||||
|
| 2026-03-05 → 2026-03-10 | Configurazione Hyprland All-Black | transcripts/2026-03-05-configurazione-hyprland-all-black.md |
|
||||||
|
| 2026-03-06 → 2026-03-17 | Configurazione i3 | transcripts/2026-03-06-configurazione-i3.md |
|
||||||
|
| 2026-03-14 | Prompt bash personalizzato | transcripts/2026-03-14-prompt-bash-personalizzato.md |
|
||||||
|
| 2026-03-14 → 2026-03-15 | Flatpak con i3 | transcripts/2026-03-14-flatpak-con-i3.md |
|
||||||
|
| 2026-07-19 | Notifications Summary | transcripts/2026-07-19-notifications-summary.md |
|
||||||
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# Editor — vim, neovim, emacs
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Posizioni e preferenze stabili
|
||||||
|
|
||||||
|
- Vim è l'editor primario per lo sviluppo; Emacs resta lo strumento di authoring: appunti in Org Mode (anche sulla workstation Windows di lavoro), documentazione, curriculum e altri documenti.
|
||||||
|
- Linguaggi dichiarati: C per lo sviluppo sui sistemi operativi, Go lato applicativo, Bash/Python per gli script di automazione; per lavoro Java su IntelliJ.
|
||||||
|
- Ergonomia comune: Vim-style sugli IDE — IdeaVim installato su IntelliJ; Vim Motion su VS Code/IntelliJ valutato per abituarsi rapidamente; evil-mode su Emacs scartata (torna a Emacs "puro": già usato per mesi senza evil).
|
||||||
|
- Criteri guida stabili: strumenti semplici, riproducibili, con ruoli ben distinti; FOSS ogniqualvolta possibile; nessuna scelta "per partito preso" — spirito Gilfoyle, "pratico più che ideologico" (la gente gli dice di essere "tipo Gilfoyle").
|
||||||
|
- Vim one-file come principio: "la installo e me la porto ovunque e funziona sempre uguale"; up-and-running più veloce; estremo minimalismo; Vim deve restare utilizzabile anche senza plugin (nessun plugin manager: non usa Plug).
|
||||||
|
- Workflow terminal-first: sviluppo nel terminale con vim + git da CLI (adottato `git grep` per cercare nei repo); git, compilazione e debugger già usati separati da Vim; il vero pain point è cercare/aprire i file da Vim → integrazione fzf/grep interna ritenuta necessaria.
|
||||||
|
- La config che si rompe tra distro è fragilità: la config Emacs "diversa" dopo il passaggio Void→Mint e il desiderio di "qualcosa di più solido" hanno spinto verso il .vimrc one-file; playbook poi portato su Fedora Workstation (ikaros + nymph) con workflow quasi totalmente nel terminale.
|
||||||
|
- Riproducibilità > comodità grafica: Thunderbird non ha dotfile di configurazione → i feed RSS (elfeed) restano in Emacs "che già funziona".
|
||||||
|
- Setup dichiarato sul lavoro: workstation Windows + WSL: IDEA o VS Code per il codice, Emacs per gli appunti, Vim nel WSL per le configurazioni.
|
||||||
|
- In combo con Vim considera già sufficienti ctags + cscope ("praticamente nativi"); tmux per splittare sessioni e usare gdb, make e altri tool su pannelli/window.
|
||||||
|
|
||||||
|
## Decisioni pratiche
|
||||||
|
|
||||||
|
- **`.vimrc` "Sysdev Portable" (2026-03)**: pensato come config "da vero kernel hacker" ma per sviluppo system in generale (non solo kernel), portabile in pochi secondi su ambienti terzi e robusta su Vim minimale. Impostazioni chiave:
|
||||||
|
```vim
|
||||||
|
set nocompatible
|
||||||
|
set encoding=utf-8
|
||||||
|
let mapleader=" "
|
||||||
|
set tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab
|
||||||
|
set textwidth=80 colorcolumn=81
|
||||||
|
set incsearch hlsearch ignorecase smartcase gdefault
|
||||||
|
set updatetime=250 timeoutlen=400
|
||||||
|
set nolist " marker whitespace OFF di default, toggle <leader>l
|
||||||
|
```
|
||||||
|
|
||||||
|
- Fix robusto per il bug `$XDG_CACHE_HOME` (Vim creava la cartella letterale `XDG_CACHE_HOME` invece del path risolto):
|
||||||
|
```vim
|
||||||
|
set undofile
|
||||||
|
if has("unix")
|
||||||
|
if exists("$XDG_CACHE_HOME") && !empty($XDG_CACHE_HOME)
|
||||||
|
let s:cache = $XDG_CACHE_HOME
|
||||||
|
else
|
||||||
|
let s:cache = expand("~/.cache")
|
||||||
|
endif
|
||||||
|
let s:ud = s:cache . "/vim/undo//"
|
||||||
|
if !isdirectory(s:ud)
|
||||||
|
call mkdir(s:ud,"p")
|
||||||
|
endif
|
||||||
|
execute "set undodir=" . fnameescape(s:ud)
|
||||||
|
endif
|
||||||
|
```
|
||||||
|
- Resto del `.vimrc` finale (rifinito su iterazioni): tema dark "deep black" incorporato nel file (sfondi neri profondi, sintassi migliore di `industry`; temi con sfondo grigio scartati); file manager rimosso ("piena di glitch"); marker whitespace tolti ("quei dannati spazi visualizzati"), riattivabili con `<leader>l`; `rg → grep`; `ctags`; `cscope` se presente; `:ClangFormat`; `:Make` smart; `:Run`; `K` → man. In corso d'opera sistemato l'errore `notermguicolors`.
|
||||||
|
- **Plugin**: nessun plugin manager; fzf.vim adottato per la navigazione dei file (il pain point dichiarato); fugitive da tenere solo perché fzf.vim ci si integra, non per sostituire git da CLI. Da NON aggiungere (consiglio ChatGPT, per non perdere "una configurazione che puoi clonare ovunque e capire in mezz'ora"): Telescope, lazy.nvim, dashboard, file tree persistenti, decine di plugin LSP, framework completi tipo LazyVim/AstroNvim.
|
||||||
|
- **Emacs**: tenuta la configurazione attuale invece di passare a Doom Emacs (valutato solo per non rifare la config da capo, con versioning nel playbook); config da snellire per potenziare Org Mode (export in vari formati) e da uniformare tra desktop e workstation; Emacs abilitato su ikaros. Magit + Projectile usati parecchio per aprire i progetti e fare code review, più funzioni custom per lanciare un coding agent AI nella root del progetto ("vibe coding").
|
||||||
|
- **Editing remoto**: TRAMP già provato ma troppo lento → orientamento: montare il filesystem remoto via sshfs e usare sempre Emacs locale (config, Magit, Projectile, tema/keybinding, agent AI) su path remoti. Pattern consigliato: sshfs per editing comodo, Vim remoto come fallback, clone locale per sviluppo serio (repo grandi → meglio Vim remoto; build/test sul remoto → shell SSH + editor remoto). Escludere `node_modules target build dist vendor .git/objects .cache` (es. `projectile-globally-ignored-directories`); Magit su repo grandi via sshfs va usato con prudenza; mount tipo `-o reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,follow_symlinks,cache=yes,kernel_cache,compression=no`.
|
||||||
|
- **Provato e scartato (evoluzione)**: appunti in Markdown invece di Org (con blocchi di codice; condivisione OneDrive personale + Box di progetto) → riconfermato Org/Emacs; feed RSS spostati in Thunderbird → scartato per riproducibilità, restano in elfeed; Doom Emacs → scartato; evil-mode su Emacs per memoria muscolare → scartata; TRAMP → scartato; file manager nel .vimrc → rimosso; tema `industry`/sfondi grigi → deep black; ipotesi "Emacs per tutto lo sviluppo user-space + Vim solo in remoto" (2026-06-22) → superata dalla convergenza terminale-first con Vim come editor di sviluppo.
|
||||||
|
|
||||||
|
## Comparazioni approfondite (sintesi)
|
||||||
|
|
||||||
|
- **vi vs vim**: vi (Bill Joy, 1976, BSD) non è più sviluppato davvero; il `vi` di oggi è nvi (macOS/FreeBSD), busybox vi (embedded) o vim in modalità compatibile (su Linux quasi sempre vim); sopravvive solo per compatibilità POSIX. vim (Bram Moolenaar, 1991) aggiunge syntax highlighting, plugin system, vimscript, split, undo multiplo, autocompletion, macro e ampio supporto filetype; sviluppo proseguito anche dopo la morte di Moolenaar (2023).
|
||||||
|
- **Vim vs Neovim**: Vim vince su disponibilità (su server, rescue, BSD, sistemi minimi e aziendali `vi`/`vim` c'è quasi sempre, `nvim` raramente), config one-file (`scp ~/.vimrc server:` e sei operativo) e stabilità concettuale — un editor "noioso" che non richiede attenzione, con config scritta oggi che funziona ovunque a lungo. Neovim spinge verso Lua, plugin manager, Tree-sitter, LSP, dipendenze esterne e config multi-file: il suo centro di gravità è una piccola distribuzione personale, contrario agli obiettivi di portabilità/prevedibilità dell'utente.
|
||||||
|
- **Vim vs Emacs**: Vim superiore su editing puro, startup immediato, editing remoto via SSH, ergonomia terminal-first, semplicità mentale — "UNIX sharp tool" per editing opportunistico (`vim /etc/ssh/sshd_config`, `git commit`, `sudoedit /etc/fstab`). Emacs dà il meglio come piattaforma: Projectile, Magit, LSP, terminali, note, RSS, funzioni Lisp, agent di coding — "più vicino a una Lisp machine minimale che a un editor". Verdetto ChatGPT (2026-05-24, domanda "una parola"): Emacs, per il suo profilo di "ambiente operativo"/centro di controllo; l'utente è però poi convergito su Vim per lo sviluppo + Emacs per Org.
|
||||||
|
- **Stereotipi** (folklore): vim guy = vive nel terminale, tool piccoli componibili UNIX-style, .vimrc portabile, memoria muscolare quasi religiosa, "edita file di configurazione alle 2 di notte su una macchina remota via SSH"; emacs guy = casa digitale, workflow integrale (codice, Git, note, RSS, email, agenda, shell), funzioni Lisp, "Emacs is a great operating system, lacking only a decent editor" → replica: "infatti uso Evil mode". Nella serie Gilfoyle appare su Mac/Ubuntu con WM floating, ma l'utente ne incarna l'approccio pragmatico; Hendricks per ChatGPT ha "energia da vim guy".
|
||||||
|
- **Audit Emacs** (2026-06-22, nello scenario "Vim editor principale"): vterm si auto-risolve col terminale (tmux/zellij/abduco/dvtm oppure finestre del terminal emulator + workspaces Sway; consiglio: non sostituire vterm con tmux "solo per principio") → nessun motivo forte per tenere Emacs; Org è overkill se usato solo per appunti (basterebbe Markdown in `~/notes` con rg/fzf/glow), vale solo con TODO/agenda/capture/clocking/refile/export/Babel; elfeed sostituibile da tool CLI; il peso reale di Emacs nel workflow = Magit + Projectile + funzioni agent AI.
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- Tree-sitter per Vim: suggerito come miglioramento più efficace e "invisibile" (parsing accurato per C/Go/Bash senza cambiare modo di lavorare) — adozione da valutare.
|
||||||
|
- Toolchain C consigliata: `entr` (`find . -name '*.c' | entr -c make test`), `bear` (genera `compile_commands.json` così clangd funziona ovunque), `delta` come pager Git (da rimettere in uso), `btop`.
|
||||||
|
- Config Vim su tre livelli — core (editing/search/motions) / language (c, go, bash) / local (macchina corrente), con core immutabile e portabile: proposta "architetturale" di ChatGPT, non ancora adottata.
|
||||||
|
- Investimento consigliato su un solo strumento: padroneggiare GDB, poi `rr` (record & replay: `rr record`, `rr replay`, `reverse-continue`, `reverse-step`); toolbox in ordine: GDB → Valgrind → strace/ltrace → rr → perf/eBPF. rr utile con thread/segnali/programmi concorrenti (APUE avanzata); limiti con funzionalità kernel e hardware particolari.
|
||||||
|
- Org Mode: configurare l'export multi-formato (obiettivo dichiarato, ancora da fare); snellire in generale la config Emacs.
|
||||||
|
- sshfs: pattern e funzioni mount/unmount definite in conversazione (opzioni e ignore-dirs), consolidamento nel playbook/workflow ancora aperto.
|
||||||
|
- Vim Motion su VS Code e IntelliJ: suggerito per consolidare la memoria muscolare, esito non registrato (IdeaVim su IntelliJ invece confermato installato).
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2026-03-05 → 2026-03-10 | Differenze tra vi e vim | [transcripts/2026-03-05-differenze-tra-vi-e-vim.md](transcripts/2026-03-05-differenze-tra-vi-e-vim.md) |
|
||||||
|
| 2026-05-24 | Vim vs Emacs | [transcripts/2026-05-24-vim-vs-emacs.md](transcripts/2026-05-24-vim-vs-emacs.md) |
|
||||||
|
| 2026-06-22 | Emacs vs Terminal Workflow | [transcripts/2026-06-22-emacs-vs-terminal-workflow.md](transcripts/2026-06-22-emacs-vs-terminal-workflow.md) |
|
||||||
|
| 2026-06-22 → 2026-08-22 | Stereotipi Vim vs Emacs | [transcripts/2026-06-22-stereotipi-vim-vs-emacs.md](transcripts/2026-06-22-stereotipi-vim-vs-emacs.md) |
|
||||||
|
| 2026-07-15 → 2026-07-21 | Vim vs Neovim | [transcripts/2026-07-15-vim-vs-neovim.md](transcripts/2026-07-15-vim-vs-neovim.md) |
|
||||||
94
dotfiles/common/.config/ai/memory/chatgpt/knowledge/emacs.md
Normal file
94
dotfiles/common/.config/ai/memory/chatgpt/knowledge/emacs.md
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
# Emacs
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Decisioni e preferenze stabili
|
||||||
|
|
||||||
|
- Emacs custom (nessuna distribuzione), orientato ad authoring: org-mode, mu4e, elfeed, documenti; sviluppo C/Go con LSP+DAP; Vim resta l'editor primario di sviluppo (Emacs è complementare); la .emacs.d è gestita dal playbook Ansible dei dotfiles.
|
||||||
|
- UX in stile Doom Emacs (lo usa su un'altra macchina Windows): leader `C-c`, sottomenu descrittivi con `which-key` e etichette per i prefissi (es. `C-c g` = "git"); preferisce funzionalità e menu ordinate al "purismo".
|
||||||
|
- Completion: `company` + `company-capf`; `corfu` rifiutato esplicitamente (già provato su Doom, non è piaciuto); `company-lsp` non serve, lsp-mode integra già il backend.
|
||||||
|
- Keybinding = infrastruttura: centralizzati in `core/keybindings`, sempre caricati e PRIMA dei moduli che dipendono dai prefissi `C-c`.
|
||||||
|
- Binding contestuali, non globali: mappa LSP visibile solo nei buffer con LSP attivo, mappa DAP solo con `dap-mode` attivo; pattern: keymap "muta" + `autoload` + `local-set-key` buffer-local via hook.
|
||||||
|
- Struttura modulare `~/.emacs.d/lisp/` con moduli `core-*`, `tools-*`, `lang-*`, `misc-*`; `init.el` = manifesto dichiarativo (principio: se cresce oltre 30-40 righe, qualcosa non va).
|
||||||
|
- Python e Bash usati solo per script semplici mono-file: configurazione volutamente essenziale, no over-engineering.
|
||||||
|
- Formattazione C: approccio custom, resta volontariamente parziale.
|
||||||
|
- Tree-sitter = "una scelta, non un dogma": usabile insieme ai major mode classici dove serve davvero.
|
||||||
|
- Stack finale documentato: lsp-mode + clangd, dap-mode + dap-cpptools, magit, consult + consult-lsp, project.el, doom-modeline, which-key, company, flycheck, vterm, elfeed, mu4e, org-mode (org-directory `~/Remotes/pCloud/Org`).
|
||||||
|
|
||||||
|
## Configurazioni e stati finali
|
||||||
|
|
||||||
|
- Ordine/caricamento moduli (`init.el`):
|
||||||
|
```elisp
|
||||||
|
(require 'core-packages) (require 'core-ui) (require 'core-editor)
|
||||||
|
(require 'core-performance)
|
||||||
|
(require 'core-keybindings) ;; NON opzionale: prima di tutto ciò che usa C-c
|
||||||
|
;; poi: which-key, tools-completion, tools-lsp, tools-dap, tools-project, vcs, lang/*, misc/*
|
||||||
|
```
|
||||||
|
- Load dichiarativo dei moduli da mappa:
|
||||||
|
```elisp
|
||||||
|
(defconst fscotto/modules-dir (expand-file-name "lisp" user-emacs-directory))
|
||||||
|
(defun fscotto/load-module (module)
|
||||||
|
"Carica un modulo dato come simbolo, es. 'core/packages."
|
||||||
|
(let* ((module-name (symbol-name module))
|
||||||
|
(path (expand-file-name (concat module-name ".el") fscotto/modules-dir)))
|
||||||
|
(unless (file-exists-p path) (error "Modulo non trovato: %s" path))
|
||||||
|
(load path nil 'nomessage)))
|
||||||
|
```
|
||||||
|
- Leader keymap: `C-c` → `fscotto/leader-map`; sottomappe: `v` version-control, `o` open (`T` vterm, `m` mu4e, `f` elfeed), `g` git/Magit (`s` status, `b` branch, `c` commit, `p` push, `f` fetch), `l` LSP, `d` DAP.
|
||||||
|
- Mappa LSP `C-c l`: `s` consult-lsp-symbols, `e` consult-lsp-diagnostics, `d` find-definition, `D` type-definition, `i` implementation, `a` code-action, `r` rename, `f` format-buffer, `R` restart-workspace.
|
||||||
|
- Mappa DAP `C-c d`: `d` dap-debug, `b` breakpoint-toggle, `c` continue, `n` next, `i` step-in, `o` step-out, `r` restart-frame, `q` disconnect.
|
||||||
|
- Pattern keymap contestuale (LSP; identico per DAP con `dap-mode` su `dap-mode-hook` + `dap-session-created-hook` + `dap-terminated-hook`):
|
||||||
|
```elisp
|
||||||
|
(defvar fscotto/lsp-map (make-sparse-keymap)) ;; NON legarla subito a C-c l
|
||||||
|
(autoload 'lsp-find-definition "lsp-mode" nil t) ;; ecc. per ogni comando
|
||||||
|
(defun fscotto/enable-lsp-keymap ()
|
||||||
|
(when (and (bound-and-true-p lsp-mode) (lsp-workspaces))
|
||||||
|
(local-set-key (kbd "C-c l") fscotto/lsp-map)))
|
||||||
|
(add-hook 'lsp-mode-hook #'fscotto/enable-lsp-keymap)
|
||||||
|
```
|
||||||
|
- Tree-sitter su Emacs 29.3 / Linux Mint: grammatiche compilate da Emacs, NON le .so di sistema (che danno `version-mismatch: 15`):
|
||||||
|
```elisp
|
||||||
|
(setq treesit-extra-load-path (list (expand-file-name "tree-sitter" user-emacs-directory)))
|
||||||
|
(setq treesit-font-lock-level 4)
|
||||||
|
(setq major-mode-remap-alist '((c-mode . c-ts-mode) (c++-mode . c++-ts-mode)
|
||||||
|
(python-mode . python-ts-mode) (bash-mode . bash-ts-mode)))
|
||||||
|
;; treesit-language-source-alist: c, cpp, python, bash, go (repo GitHub tree-sitter)
|
||||||
|
```
|
||||||
|
Installazione grammatiche: `M-x treesit-install-language-grammar` per c, cpp, go, python, bash; dipendenze sistema su Mint: `build-essential` + `git` (più eventualmente make/cmake).
|
||||||
|
- LSP Bash: server `bash-language-server` installato con `npm install -g bash-language-server`; `(add-hook 'sh-mode-hook #'lsp)`; company (min-prefix 1, idle-delay 0.0), flycheck; shfmt via `reformatter` (args `-i 2 -ci`, `shfmt-format-on-save-mode`); yasnippet opzionale.
|
||||||
|
- Debug C: DAP con `require 'dap-cpptools` agganciato al caricamento di dap-mode; funzionante con il template di debug salvato nel progetto secondo https://emacs-lsp.github.io/dap-mode/page/configuration/#dap-cpptools.
|
||||||
|
- Look&feel stabile: tema `wombat`, font "Iosevka Nerd Font 14", toolbar/menu/scrollbar off, frame massimizzati, startup/splash screen off, `y-or-n-p`, `fill-column` 120, `undo-limit` 8000000 / `undo-strong-limit` 12000000, `scroll-step` 3, ring-bell ignorato, column-number e display-time attivi, numeri di riga solo in prog-mode/conf-mode.
|
||||||
|
- Avvio: gc-cons-threshold elevato temporaneamente durante l'init e `file-name-handler-alist` disabilitato durante l'avvio (startup speed tweaks).
|
||||||
|
- which-key: `which-key-mode`, idle-delay 0.5, etichette prefissi con `which-key-add-key-based-replacements` (es. "C-c g" → "git").
|
||||||
|
|
||||||
|
## Evoluzione nel tempo
|
||||||
|
|
||||||
|
- 2025-09 (task coverage): valutati task quotidiani copribili con Emacs — bene: email (mu4e), Telegram (telega.el), PDF/EPUB (pdf-tools, nov.el), sviluppo; parziale: browsing (eww/w3m), Spotify/VLC solo controllo; meglio esterni: browser pesante, WhatsApp, Discord. RSS: adottato elfeed (+elfeed-org/elfeed-webkit come opzioni), scartati Gnus/nnrss, feedly.el, org-feed.
|
||||||
|
- 2025-09 (kernel dev): confronto Emacs vs Neovim per sviluppo kernel Linux — entrambi validi; Vim/Neovim più popolare tra kernel hacker (stima sondaggi 60-70% vs 20-25%); Emacs forte su debug integrato (GUD/realgud), magit, progetti complessi; Neovim più reattivo su file enormi; consigli: lsp-mode/ccls, realgud, projectile+magit, diff-hl, indentazione kernel-style.
|
||||||
|
- 2025-12-12 → 2026-01-10 (ottimizzazione): da init.el monolitico a config consolidata via revisioni iterative: analisi config, which-key + etichette stile Doom, keybinding tipo Doom, projectile con menu Doom-like, Magit con keybinding (priorità dichiarata sopra il "purismo"), chiarimenti ivy vs counsel/vertico/consult, consult-lsp, tuning clangd; setup sviluppo C completato, poi Go portato "allo stesso livello di C"; stack di fine dicembre: consult, project.el, doom-modeline.
|
||||||
|
- Provati e scartati in itinere: opzioni clangd invalide `--header-insertion-decorations=0`, `--limit-result=500`, `--limit-references=2000` (bloccavano l'avvio del server, poi rimosse — nota: lsp parte sia da c-mode che da c-ts-mode); grammatiche tree-sitter .so di distro su Mint (Emacs 29.3, `version-mismatch: 15`); undo-limit 2000000/undo-strong-limit 4000000000 (finali: 8000000/12000000); corfu; config tutta in un unico init.el (ingestibile dopo 2-3 mesi).
|
||||||
|
- Errori DAP superati: `dap-version` non trovato, `Undefined command: "Content-Length"` nel buffer GDB::Run, `waiting for v8 protocol on stdin/stdout` → risolti con il template ufficiale dap-cpptools caricato nel progetto.
|
||||||
|
- 2025-12-22 (modularizzazione): split dell'init.el reale in moduli core→tools→lang→misc (originale conservato in `init.el.bak`); regressione post-split "menu Git sotto C-c sparito" = `core-keybindings` non incluso → fix con `require` esplicito; prefissi resi espliciti in core-keybindings (`define-prefix-command 'fscotto/git-map` su `C-c g`, `'fscotto/project-map` su `C-c p`), moduli agganciano solo comandi; early-init.el proposto come opzionale (Emacs 27+).
|
||||||
|
- 2025-12-23 (load dichiarativo): `fscotto/load-module` rende init.el un manifesto; chiarita la semantica di `with-eval-after-load` (i binding nascono solo al primo effettivo utilizzo della feature, es. vterm si caricava mentre elfeed/mu4e no); migrazione verso binding contestuali per git, LSP, DAP e `C-c C-t vterm-copy-mode` solo nei buffer vterm.
|
||||||
|
- 2025-12-27: proposta dashboard stile Doom con dashboard.el.
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- Dashboard stile Doom: snippet `dashboard.el` proposto (logo, center-content, heading/file icons, banner title "Welcome back, Fabio", recents 8 / projects 5 / bookmarks 5, modulo `misc-dashboard.el` + `require`, opzionali `dashboard-projects-backend 'project-el` e override stile `SPC f r`, logo PNG in `~/.emacs.d/assets/`); resta da scegliere "identico a Doom" vs "minimal Unix-like".
|
||||||
|
- Configurazione in formato org (config.org fonte unica + org-babel-tangle per generare i .el): proposta, poi rimandata ("facciamo prima lo split dei file").
|
||||||
|
- Keymap git visibile solo all'interno di progetti git: richiesta e discussa, esito finale non documentato.
|
||||||
|
- Calendario in Emacs: valutati Calfw, org-gcal, org-caldav-ics, khalel (vdirsyncer+khal), org-timeblock.el/org-hyperscheduler; nessuna adozione documentata.
|
||||||
|
- early-init.el e profili: discussione avviata ("Proviamo"), esito non documentato.
|
||||||
|
- Tree-sitter vs major mode classici: panoramica completata (pro: parsing strutturale, sinergia con clangd, editing strutturale, performance su file grandi, futuro Emacs 29+; contro: dipendenze esterne + ABI, debug più difficile); nessuna scelta finale esplicita.
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-09-05 | Task Emacs coverage | [transcripts/2025-09-05-task-emacs-coverage.md](transcripts/2025-09-05-task-emacs-coverage.md) |
|
||||||
|
| 2025-09-06 | Emacs per sviluppo kernel | [transcripts/2025-09-06-emacs-per-sviluppo-kernel.md](transcripts/2025-09-06-emacs-per-sviluppo-kernel.md) |
|
||||||
|
| 2025-12-12 | Ottimizzazione configurazione Emacs | [transcripts/2025-12-12-ottimizzazione-configurazione-emacs.md](transcripts/2025-12-12-ottimizzazione-configurazione-emacs.md) |
|
||||||
|
| 2025-12-15 | Configurazione LSP Bash | [transcripts/2025-12-15-configurazione-lsp-bash.md](transcripts/2025-12-15-configurazione-lsp-bash.md) |
|
||||||
|
| 2025-12-22 | Modularizzare configurazione Emacs | [transcripts/2025-12-22-modularizzare-configurazione-emacs.md](transcripts/2025-12-22-modularizzare-configurazione-emacs.md) |
|
||||||
|
| 2025-12-23 | Load moduli dichiarativo Emacs | [transcripts/2025-12-23-load-moduli-dichiarativo-emacs.md](transcripts/2025-12-23-load-moduli-dichiarativo-emacs.md) |
|
||||||
|
| 2025-12-27 | Dashboard stile Doom | [transcripts/2025-12-27-dashboard-stile-doom.md](transcripts/2025-12-27-dashboard-stile-doom.md) |
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
# Sviluppo kernel Linux
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Percorso di studio (libri, roadmap, obiettivi)
|
||||||
|
|
||||||
|
- Obiettivo: apprendimento personale; estendere la programmazione di sistema in C (base: *Linux System Programming*) allo sviluppo di moduli kernel — cambio di paradigma (niente libc, "dentro" il kernel).
|
||||||
|
- *Linux Kernel Development* di Robert Love (lettura alternata): chiaro e ben organizzato, valido per basi concettuali e come ponte, ma datato — 3ª ed. del 2010 basata su kernel 2.6.x (oggi 6.x); API cambiate/deprecate; non copre KBuild moderno, eBPF, cgroup v2, ARM64, Rust.
|
||||||
|
- Testo successivo consigliato: *Linux Kernel Programming* di Kaiwan N. Billimoria (2ª ed. 2022, kernel 5.x; capp. 2–5: moduli, debug, logging, simboli). Per il modello driver: *Linux Device Drivers* (Rubini & Corbet, 3ª ed., datata ma valida). Riferimenti moderni: docs.kernel.org e sorgenti kernel.
|
||||||
|
- Percorso pratico moduli (esercizi progressivi): 1) Hello Kernel (`module_init`/`module_exit`, `pr_info`/`pr_alert`, `insmod`/`rmmod`, `dmesg`); 2) parametri (`module_param` int/charp); 3) procfs/sysfs (`proc_create`, `seq_file`, extra `kobject` + `sysfs_create_file`); 4) memoria (`kmalloc`/`kfree`, `GFP_KERNEL`); 5) sincronizzazione (spinlock, mutex, workqueue); poi `ftrace`, `kprobes`, `perf`, `EXPORT_SYMBOL`.
|
||||||
|
|
||||||
|
## Setup di sviluppo (VM, build, debug)
|
||||||
|
|
||||||
|
- Distro di riferimento: Arch Linux; pacchetti `emacs ripgrep ctags cscope gdb clang bear` (opz. `gcc`, `make`, `qemu` per build e test).
|
||||||
|
- Build kernel: clone `torvalds/linux` da git.kernel.org → `make defconfig` (o menuconfig/nconfig) → `make -j$(nproc)` → `make modules` + `modules_install` + `install`; test in VM QEMU con initramfs minimale. Config usata nei test: `make allyesconfig`.
|
||||||
|
- Benchmark reale su Geekom: build kernel mainline con allyesconfig ≈ 50 minuti, meno di 2 GB di RAM → i numeri "pesanti" riportati da Deepseek contestati come infondati.
|
||||||
|
- Build machine remota: serve a non bloccare la workstation (build molto costosa) e a testare su hardware reale (la VM non basta sempre).
|
||||||
|
- Editor: Vim/Neovim standard de facto tra i kernel hacker, Emacs alternativa storica molto usata, VS Code marginale; preferire editor leggeri a IDE pesanti (es. CLion) è la norma (i kernel hacker fanno comunque refactoring, col supporto del tooling).
|
||||||
|
- Navigazione codice (strategia ibrida): `ctags`/`cscope` (kernel fornisce `scripts/tags.sh`; indici: `make tags`, `cscope -Rbq`) per navigazione rapida; LSP `clangd` via `compile_commands.json` (generato con `bear make`) per analisi profonda e refactoring.
|
||||||
|
- Emacs: Eglot (nativo da Emacs 29) con clangd; `xcscope` (`C-c s s`, `C-c s g`, `C-c s c`) ed etags (`M-.`, `M-*`); build mirate con `M-x compile` (es. `make drivers/net/ethernet/intel/e1000e/`); debug con `M-x gdb` (`gdb -i=mi vmlinux`, `target remote :1234`) su QEMU avviato con `-s -S`; opzionale `realgud`.
|
||||||
|
- Accesso remoto: TRAMP lento su alta latenza → alternative: `ssh` + `tmux` + `emacs -nw`, oppure `emacs --daemon` + `emacsclient` sul server; X11 forwarding evitato; TRAMP (anche ottimizzato) solo su connessioni a bassa latenza/LAN.
|
||||||
|
- Debug/tracing: gdb + kgdb; `perf`, `ftrace`, `bpftrace`.
|
||||||
|
- Moduli: mai test sul sistema principale → VM (VirtualBox + Debian/Ubuntu, Docker privilegiato o QEMU; kernel ≥ 5.x, `linux-headers-$(uname -r)`); Makefile `obj-m` con `make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules`.
|
||||||
|
|
||||||
|
## Decisioni e preferenze stabili
|
||||||
|
|
||||||
|
- Editor per lo sviluppo kernel: **Emacs**. Evoluzione lug–set 2025: prima orientato su Neovim (aveva una buona config da far controllare), poi ha cambiato idea.
|
||||||
|
- Client email: **Neomutt** al posto di mu4e/Emacs mail (il fetch delle email si blocca spesso; vuole una TUI integrata che gestisca fetch/send/auth senza più pezzi). Migrazione ad aerc solo se i problemi persistono (aerc gestisce l'autenticazione direttamente).
|
||||||
|
- Ripartizione del workflow: Emacs = cockpit dello sviluppo (coding agent, gestione progetti, scrittura codice); email esterne con Neomutt (test); web Firefox; PDF Xournal++. Coding agent già integrati aprendoli nella dir del progetto da shell esterna.
|
||||||
|
- Workflow upstream: `git format-patch` e `git send-email` lanciati da magit; dentro Emacs resta configurato solo il client SMTP, per l'invio si può sfruttare la gestione mail integrata di Emacs.
|
||||||
|
- Stack desktop target: **Arch + GNOME** con unica estensione rilevante PaperWM (tiling); workflow terminal-first; abbandonato il "periodo Hyprland totale"; principio: "pochi strumenti chiari con responsabilità precise" invece di "un solo tool che fa tutto"; il WM non è il vero moltiplicatore di produttività.
|
||||||
|
- Distro: Arch come compromesso tra controllo UNIX-style e pragmatismo moderno (systemd accettato — richiesto da GNOME/Wayland); Void apprezzata (runit, minimalismo, BSD-like) ma incompatibile con GNOME.
|
||||||
|
- tmux: poco o per niente usato.
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- Config Emacs per kernel-dev da esaminare/ottimizzare (mai avvenuto); ChatGPT aveva offerto script per rigenerare `tags`/`cscope.out`/`compile_commands.json`, snippet e integrazioni gdb/QEMU/Makefile.
|
||||||
|
- Esito del test Neomutt: eventuale passaggio futuro ad aerc.
|
||||||
|
- Migrazione effettiva ad Arch + GNOME + PaperWM discussa ma non confermata.
|
||||||
|
- Workflow su build machine remota da adattare al basso uso di tmux (emacs --daemon + emacsclient vs TRAMP).
|
||||||
|
- Contenuti troncati nei digest: risposta su "come attivare queste config" dopo `make allyesconfig` e tappa 6 del percorso moduli.
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-07-03 | Linux Kernel Development | [transcripts/2025-07-03-linux-kernel-development.md](transcripts/2025-07-03-linux-kernel-development.md) |
|
||||||
|
| 2025-07-08 | Setup sviluppo kernel Linux | [transcripts/2025-07-08-setup-sviluppo-kernel-linux.md](transcripts/2025-07-08-setup-sviluppo-kernel-linux.md) |
|
||||||
|
| 2026-05-09 | Sviluppo Kernel Linux | [transcripts/2026-05-09-sviluppo-kernel-linux.md](transcripts/2026-05-09-sviluppo-kernel-linux.md) |
|
||||||
|
|
||||||
112
dotfiles/common/.config/ai/memory/chatgpt/knowledge/languages.md
Normal file
112
dotfiles/common/.config/ai/memory/chatgpt/knowledge/languages.md
Normal file
@@ -0,0 +1,112 @@
|
|||||||
|
# Linguaggi — scripting di sistema e Go
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Posizioni e preferenze sui linguaggi di scripting
|
||||||
|
|
||||||
|
- Sintesi del confronto system programming (C vs C++/Rust/Zig/Go): **C come linguaggio principale**, **Bash/Python di supporto** per lo scripting.
|
||||||
|
- Conclusione: lo studio di C e della programmazione di sistema Linux user-space vale per ogni percorso; divergono solo gli approfondimenti kernel vs Docker/sistemi distribuiti.
|
||||||
|
- Bash: fondamentale su Unix/Linux (startup, deploy, backup, catene di comandi); nel piano: *Linux Command Line and Shell Scripting Bible*.
|
||||||
|
- Python: universale per automazione/orchestrazione (Ansible, Fabric); nel piano: *Automate the Boring Stuff with Python*.
|
||||||
|
- Perl: storico "glue language" (text processing, sysadmin); in panoramica, non nel piano finale. PowerShell solo per amministrazione Windows (Core cross-platform); Ruby nota per DevOps (Chef/Puppet): nessuno dei due adottato.
|
||||||
|
- Go: compilato, performante, con concurrency (CLI, microservizi, DevOps); compare tra i linguaggi del piano (C, Bash, Python, Go, Zig); Clojure presente solo nella prima stesura del piano.
|
||||||
|
- Piano C su 12 settimane: *Linux System Programming* 2ª ed. + *APUE* 3ª ed. integrata per settimana (processi 8-10, thread 12-13, memoria 14, segnali 11, socket 16, shell/daemon 13.6+17-19) + *OSTEP* (scheduling, VM, FS).
|
||||||
|
- Esercizi pratici cumulativi per settimana: mycp, tree con readdir, downloader multithread, allocator con mmap, gestione segnali, echo server TCP IPv4, chat server select/epoll, mini-shell finale; diario di apprendimento in Markdown.
|
||||||
|
- Evoluzione piano: variante "Kernel Hacker" aggiunge *Linux Kernel Programming* Part 1 e 2 in Fase 3 e sposta *Designing Data-Intensive Applications* in Fase 4 opzionale; decisione di mantenere LSP e APUE insieme.
|
||||||
|
- Avanzamento: *Linux System Programming* 2ª ed. letto fino ai capitoli su file I/O, I/O avanzato e processi; possiede *APUE* 3ª ed.
|
||||||
|
|
||||||
|
## Toolchain Go (configurazione, decisioni, fix)
|
||||||
|
|
||||||
|
- Obiettivi dichiarati per l'ambiente di sviluppo: autocompletamento, analisi statica, debugger e formatter (tranne in C); linguaggi C, Go, Python, Bash; approccio "consapevole e non magico".
|
||||||
|
- Stato iniziale (2025-12): lsp-mode e autocompletamento globale (company/corfu) funzionanti, ma Go era "plain editing": nessun mode Go, nessun hook Go→LSP, nessun debugger Delve, nessun formatter, nessuna analisi statica.
|
||||||
|
- Setup target minimale: `go-ts-mode` (Emacs 29+), `gopls` (LSP + staticcheck/govet), formatter `gofmt`/`goimports`, debugger `delve` via `dap-mode`.
|
||||||
|
- go.mod/go.sum: gestione dedicata richiesta → `go-mod-ts-mode`; grammatica tree-sitter `gomod` installata dopo errore treesit (libtree-sitter-gomod assente in ~/.emacs.d/tree-sitter); associazioni errate (go.mod→modula-2, go.sum→fundamental) corrette a mano dall'utente.
|
||||||
|
- Format-on-save Go: falliva per funzione assente `fscotto/go-format-on-save`; sistemata → formattazione al salvataggio funzionante.
|
||||||
|
- Debug: template "Go :: Debug test at point (auto)" produceva "Unknown JSON error" (lambda in `:args`) e warning LSP "Currently active thread is not stopped"; sostituito da 3 template su `dap-go` ("Debug all tests", "Debug package tests", "Debug single test"); debugger verificato funzionante dall'utente.
|
||||||
|
- Preferenza stabile: le patch dell'assistente non funzionano ("malformed") → l'utente applica le modifiche a mano su init.el.
|
||||||
|
- Lint: architettura `gopls` (analisi semantica + quick fixes) + `flycheck` (aggregatore diagnostiche) + `golangci-lint` (lint), gopls affiancato e non sostituito.
|
||||||
|
- Fix chiave: `(flycheck-add-next-checker 'lsp 'golangci-lint)` fallisce perché `lsp` non è un checker Flycheck; le diagnostiche LSP entrano via `lsp-diagnostics-provider :flycheck`.
|
||||||
|
|
||||||
|
## Configurazioni finali
|
||||||
|
|
||||||
|
init.el — Go: mode, LSP e debug applicati e verificati; lint = soluzione conclusiva consigliata.
|
||||||
|
|
||||||
|
```elisp
|
||||||
|
(use-package go-ts-mode
|
||||||
|
:mode "\\.go\\'")
|
||||||
|
(add-hook 'go-ts-mode-hook #'lsp-deferred)
|
||||||
|
(setq lsp-diagnostics-provider :flycheck)
|
||||||
|
|
||||||
|
;; Debug (dap-mode + delve): template finali
|
||||||
|
(with-eval-after-load 'dap-go
|
||||||
|
;; Debug all tests in module
|
||||||
|
(dap-register-debug-template
|
||||||
|
"Go :: Debug all tests"
|
||||||
|
(list :type "go"
|
||||||
|
:request "launch"
|
||||||
|
:name "Go :: Debug all tests"
|
||||||
|
:mode "test"
|
||||||
|
:program "${workspaceFolder}"
|
||||||
|
:cwd "${workspaceFolder}"))
|
||||||
|
;; + "Go :: Debug package tests" (program/cwd: ${fileDirname})
|
||||||
|
;; + "Go :: Debug single test" (test scelto con prompt)
|
||||||
|
)
|
||||||
|
|
||||||
|
;; Lint: golangci-lint checker principale per Go, solo al salvataggio
|
||||||
|
(with-eval-after-load 'flycheck
|
||||||
|
(add-hook 'go-ts-mode-hook
|
||||||
|
(lambda ()
|
||||||
|
(setq-local flycheck-checker 'golangci-lint)
|
||||||
|
;; evita lint continuo, solo su save
|
||||||
|
(setq-local flycheck-check-syntax-automatically '(save mode-enabled))
|
||||||
|
(flycheck-mode 1))))
|
||||||
|
```
|
||||||
|
|
||||||
|
Linter (fuori da Emacs; deve stare nel PATH di Emacs, altrimenti exec-path-from-shell):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
||||||
|
```
|
||||||
|
|
||||||
|
`.golangci.yml` proposto, a root del modulo Go ("serio, non pedante, molto usato in produzione"):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
run:
|
||||||
|
timeout: 2m
|
||||||
|
tests: false
|
||||||
|
linters:
|
||||||
|
disable-all: true
|
||||||
|
enable:
|
||||||
|
- govet
|
||||||
|
- errcheck
|
||||||
|
- staticcheck
|
||||||
|
- ineffassign
|
||||||
|
- unused
|
||||||
|
- gosimple
|
||||||
|
linters-settings:
|
||||||
|
errcheck:
|
||||||
|
check-type-assertions: true
|
||||||
|
check-blank: true
|
||||||
|
issues:
|
||||||
|
exclude-use-default: false
|
||||||
|
max-issues-per-linter: 50
|
||||||
|
max-same-issues: 10
|
||||||
|
```
|
||||||
|
|
||||||
|
Trade-off della soluzione lint: le diagnostiche di gopls non compaiono più in Flycheck; LSP continua a fornire hover, code actions, rename.
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- Reintrodurre eventualmente le diagnostiche gopls anche nell'UI di Flycheck (lasciato in sospeso).
|
||||||
|
- Chaining opzionale `(flycheck-add-next-checker 'go-build 'golangci-lint)`: fattibile solo se esiste il checker `go-build`; verificare con `M-x flycheck-verify-setup`.
|
||||||
|
- Layout di debug Emacs simile a IntelliJ: richiesto, esito non documentato nel digest.
|
||||||
|
- Scelta finale del percorso kernel vs Docker/sistemi distribuiti: rimandata ("ne parliamo quando sarà di scegliere il percorso").
|
||||||
|
- Esecuzione del piano 12 settimane (LSP+APUE+OSTEP) con relativo diario in Markdown.
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-07-10 | Linguaggi scripting sistema | [2025-07-10-linguaggi-scripting-sistema.md](transcripts/2025-07-10-linguaggi-scripting-sistema.md) |
|
||||||
|
| 2025-12-16 | Configurazione Go incompleta | [2025-12-16-configurazione-go-incompleta.md](transcripts/2025-12-16-configurazione-go-incompleta.md) |
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
# Sistema operativo e distribuzioni — Linux, Unix, BSD
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Posizioni e preferenze stabili
|
||||||
|
|
||||||
|
- Criterio guida per la distro ideale: fedeltà a UNIX sia nella filosofia sia nell'esecuzione tecnica (organizzazione leggibile e componibile del sistema); conta la coerenza, non l'estetica "retro".
|
||||||
|
- Preferenza stabile: restare lontano da systemd; runit apprezzato per minimalismo, leggibilità dei servizi, assenza di "piattaforma integrata"; xbps-src considerato trasparente e formativo (studio del packaging e del basso livello).
|
||||||
|
- Void Linux = distro "strumento" di riferimento ("Penso che Void Linux sia perfetta", 2025-07); nel playbook personale il profilo Void ha SwayFX predefinito + Hyprland.
|
||||||
|
- Distro "strumento" (Void, Arch, Gentoo, Alpine, Debian minimale) preferita alle distro "ambiente" (Mint, Fedora Workstation, Ubuntu): l'ambiente pronto è accettabile solo quando serve stabilità già testata.
|
||||||
|
- Workflow consolidato dentro Emacs (mu4e, elfeed, org-mode, pdf-tools) → bassa dipendenza dal desktop: accettabile sia tiling WM sia floating, se l'intero workflow vive in terminale/Emacs.
|
||||||
|
- Preferenza netta per applicazioni GTK: Firefox, Emacs GTK, Thunar/Nemo, Xournal++, pavucontrol, nm-applet, blueman, dunst/mako, rofi/wofi.
|
||||||
|
- Per lo sviluppo in C non serve inseguire l'ultima versione del compilatore (C11 è sufficiente, anche per il kernel).
|
||||||
|
- Separazione netta core system / user environment (2026-01-28), regola del setup BSD:
|
||||||
|
- core system: minimale, stabile, non-opinionated (kernel, init, libc, coreutils, rete base, /etc); sudo serve solo per il core.
|
||||||
|
- user environment: opinionated, ricostruibile, buttabile, versionabile ($HOME/.config + dotfiles via git+stow); test: "se cancello $HOME e lo ricostruisco da git, il sistema deve restare sano".
|
||||||
|
- categoria "svago" (mpv, ncmpcpp, yt-dlp) separata dai tool di lavoro; il browser (LibreWolf) accettato come compromesso inevitabile.
|
||||||
|
- Minimalismo anche nei font: Nerd Fonts rimossi con la "pulizia UNIX"; scelta finale Liberation Mono; Inconsolata unica alternativa piaciuta; Hack, Fira Code, JetBrains Mono rifiutati come "developer font" (ligature, IDE-centric, marketing).
|
||||||
|
- Coerenza UNIX dei terminali (rating ChatGPT, 2025-07): st > foot > alacritty > kitty > wezterm.
|
||||||
|
- Shell su BSD: /bin/sh (POSIX) per scripting e portabilità (shell di root da FreeBSD 14+), tcsh/csh storica, zsh/bash per uso interattivo moderno, ksh su OpenBSD; sui propri sistemi usa bash come shell utente.
|
||||||
|
## Criteri di scelta e valutazioni (distro/OS provati)
|
||||||
|
|
||||||
|
- 2025-07 · "Quale distro Linux è più UNIX": candidate valutate Slackware, Gentoo, CRUX, Alpine, Arch, Void → scelta Void (runit, nata da ex utenti NetBSD, rolling senza essere caotica). Flatpak discusso come deviazione dalla filosofia UNIX; piano di sostituire i tool Electron/X11 con alternativi nativi Wayland; setup Hyprland minimale con ssh/gpg integrato; configurazione kitty convertita in foot.ini (tema catppuccin frappe).
|
||||||
|
- 2025-09 → 2026-03 · conversazione "Sistema operativo" (304 messaggi, il percorso completo):
|
||||||
|
- ChatGPT indica Void+runit come sistema ideale (coerenza UNIX, studio kernel/user space, Emacs senza sovrastrutture).
|
||||||
|
- Deviazione "stabilità": Linux Mint + workflow interamente in Emacs ("la distro conta poco"); desktop: sessione XFCE con i3 come window manager + tool XFCE/Cinnamon alternativi.
|
||||||
|
- Scelte registrate durante la chat (poi superate): EndeavourOS su tutti i desktop → Arch Linux dichiarata "distribuzione di riferimento".
|
||||||
|
- Stato flotta dichiarato (all'epoca): deadalus (workstation di lavoro) → Debian stable (o Ubuntu LTS solo per problemi hardware); prometheus (RPi 4) → Ubuntu LTS; ikaros (desktop personale) → Void + XFCE+i3, valutando i3 puro; portatile dedicato a FreeBSD per test/studio.
|
||||||
|
- Debian "esperta" minimale (LUKS2 + btrfs + zram + XFCE+i3): provata in VM → scartata, installazione troppo macchinosa.
|
||||||
|
- Mint XFCE (btrfs, Timeshift, YubiKey per sblocco LUKS con password di fallback via systemd-cryptenroll, YubiKey pam per login+sudo) → scartata: Mint/Ubuntu impongono automaticamente layout ext4 invece di btrfs.
|
||||||
|
- Fedora spin XFCE = base finale della workstation: script idempotente per il layout dei subvolumi (copia dei dati in /var/log e /var/cache), snapper con snapshot pre-aggiornamento dnf, entry snapper in GRUB → da qui evolve il playbook Ansible fedora-playbook (repo verificato su codeberg, poi https://github.com/fscotto/fedora-playbook).
|
||||||
|
- Nella stessa chat nasce l'interesse per NixOS (configurazione portabile via flake, prova su WSL prima di altre macchine).
|
||||||
|
- 2026-01 · BSD per un laptop di studio: comprato un Lenovo ThinkPad T480; scelto FreeBSD perché è l'unico BSD che parte con il Wi-Fi funzionante ("gli altri o non partono o non riescono a connettersi al wifi"); OpenBSD apprezzato (filosofia, sicurezza, driver iwx(4)) ma più compromesso su laptop; NetBSD/DragonFlyBSD citati ma non scelti.
|
||||||
|
- 2026-03 · Bluefin (Universal Blue, Fedora Silverblue immutabile, developer image con KVM/QEMU, Podman, VSCode) valutato come sistema del portatile di lavoro ("deve funzionare sempre"): a favore — aggiornamenti atomici rpm-ostree, rollback, Btrfs già configurato, manutenzione quasi zero; contro — minor controllo (solo layering rpm-ostree o immagine custom), Ansible perde senso, filosofia container-first vs tool locale (mise); nessuna decisione finale registrata.
|
||||||
|
- 2026-03 · NixOS: configurazione sperimentale partita dal fedora-playbook (host deadalus); nessun esito successivo documentato.
|
||||||
|
- 2026-06 · Scelta distro "per filosofia", con playbook già pronto e profilo Void attivo: adora Void e la sua configurazione SwayFX/Hyprland ma trova fragile il supporto Hyprland (repo di terzi) e cerca un ambiente più supportato; ora accettabile anche un WM floating se il workflow resta in terminale/Emacs. Fallback valutati: KDE più istituzionale su Void (handbook ufficiale: kde-plasma, kde-baseapps, SDDM), Cinnamon più GTK-friendly ma poco integrato su Void. Decisione finale: restare su Hyprland finché il problema non si pone; nel playbook SwayFX è il predefinito; se il repo Hyprland si ferma, sistemare il playbook da SwayFX verso KDE, migrando le app verso Qt solo dove dà integrazione reale (Dolphin, Okular, Spectacle, Gwenview, Ark; tenere Firefox, Emacs, Alacritty, Xournal++, pavucontrol). "KDE non deve diventare una religione."
|
||||||
|
## Configurazioni e esiti pratici
|
||||||
|
|
||||||
|
### FreeBSD su ThinkPad T480 (2026-01)
|
||||||
|
- Hardware: em0 (Intel I219-LM) con link flapping "no carrier" → risolto pulendo i connettori fisici di router e PC (difetto hardware: non funzionava nemmeno su Linux); ue0 = scheda della dock USB-C, da non confondere con em0; Wi-Fi con driver iwm funzionante da sistema base.
|
||||||
|
- Rete finale in rc.conf:
|
||||||
|
```sh
|
||||||
|
# /etc/rc.conf
|
||||||
|
ifconfig_em0="DHCP mtu 1480"
|
||||||
|
wlans_iwm0="wlan0"
|
||||||
|
ifconfig_wlan0="WPA DHCP"
|
||||||
|
```
|
||||||
|
- pr_io_timeout_error (HTTPS in timeout; ping e SSH OK; nessun firewall attivo: pf.ko non caricato, ipfw non abilitato) → diagnosi: PMTU blackhole — "frag needed and DF set (MTU 1480)", path reale 1480 (probabile PPPoE/VLAN); diagnostica: `ping -D -s 1472 8.8.8.8`, `traceroute -M do -s <size>`; opzionale `net.inet.tcp.mssdflt=1440` in /etc/sysctl.conf. Nota: FreeBSD è RFC-compliant e non maschera gli errori di rete (Linux "funziona spesso" grazie a fallback MSS più permissivo).
|
||||||
|
- GPU: dGPU NVIDIA (drmn0 "Link Training Unsuccessful", Optimus) lasciata non gestita; si usa la sola iGPU con drm-kmod.
|
||||||
|
- Desktop minimal: `pkg install xorg dwm stterm xinit`; `~/.xinitrc` con `exec dwm`; dwm/dmenu/st compilati manualmente dalla propria repo; extra: slstatus, xrandr, xrdb; aggiornamenti: `freebsd-update fetch install` + `pkg upgrade`.
|
||||||
|
- Pacchetti utente finali (setup ritenuto coerente): bash, dmidecode, drm-kmod, entr, feh, fzf, git, git-delta, isync, lf, librewolf, mpv, ncmpcpp, nsxiv, pkg, pkgconf, sfeed, stow, sudo, tmux, vim, wget, xclip, xlsfonts, xorg, yt-dlp.
|
||||||
|
- Prompt shell minimale (solo info git + un po' di colore); fzf per la history con bug di selezione corretto; font finale: Liberation Mono.
|
||||||
|
### Script di installazione Void (2026-03, gist install_void_btrfs.sh, host `nymph`)
|
||||||
|
- Layout disco richiesto e ottenuto: /boot/efi (FAT32, 512M) + /boot (ext4, 1024M) + root btrfs su LUKS2; LVM rimosso; montaggi via `UUID=<BTRFS_PART_UUID>`; subvolumi: @ (radice), @home, @libvirt (/var/lib/libvirt), @cache, @log, @docker (/var/lib/docker), @snapshots; NODATACOW su @docker e @libvirt; opzioni btrfs: noatime,compress=zstd.
|
||||||
|
- Configurazione dello script:
|
||||||
|
```bash
|
||||||
|
HOSTNAME="nymph"; USERNAME="fscotto"
|
||||||
|
USER_SHELL="/bin/bash"; TIMEZONE="Europe/Rome"
|
||||||
|
CRYPT_NAME="cryptroot"; EFI_SIZE="+512M"; BOOT_SIZE="+1024M"
|
||||||
|
BTRFS_OPTS="noatime,compress=zstd"
|
||||||
|
```
|
||||||
|
- Fix di scripting applicati: heredoc quotati `<<'EOF'` (nel gist erano troncati e corrompevano i file generati → lo script "spariva" senza errori dopo i locales); variabili esterne passate al chroot con `xchroot /mnt env ... /post_install.sh`; CRYPT_UUID ricavato con `blkid` dentro il chroot; `rm -f /etc/resolv.conf || true` + `ln -sf /run/NetworkManager/resolv.conf` per evitare uscite silenziose con `set -e`; debug consigliato: `set -x` + `trap ... ERR`.
|
||||||
|
|
||||||
|
### NixOS (2026-03, bozza)
|
||||||
|
- Struttura proposta: `flake.nix` + `hosts/deadalus/{configuration,hardware-configuration}.nix` + `home/fscotto.nix`; nixpkgs `nixos-24.11`, home-manager `release-24.11` (useGlobalPkgs, useUserPackages); replica i blocchi del playbook Fedora: Flatpak+Flathub (Chrome/Telegram/Spotify/Postman/DevPod), policy Snapper + grub-btrfs, hardening (sysctl, sudo, firewall, session timeout, auto-upgrade), YubiKey + pcscd + regole udev, dotfiles + stow, font.
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- Bluefin vs Fedora+playbook per il portatile di lavoro: valutazione fra "affidabilità e manutenzione quasi zero" e "controllo esplicito della macchina"; nessuna decisione finale.
|
||||||
|
- Prova NixOS ferma alla configurazione flake proposta (porta del fedora-playbook); nessuna installazione o test documentato.
|
||||||
|
- FreeBSD: patch dello stack grafico dwm+st+dmenu+slock rimandata a un thread dedicato; dGPU NVIDIA/Optimus non gestita.
|
||||||
|
- MTU: sistemare l'MTU sul router/ISP (soluzione "definitiva"), capire perché il path è 1480; eventuale check automatico via rc.d; MSS clamping (mssdflt=1440) non decisionato.
|
||||||
|
- DNS su Void: scelta definitiva tra NetworkManager default, resolvconf o "non toccare resolv.conf" lasciata in sospeso.
|
||||||
|
- Documento di separazione core/user: da versionare come SYSTEM_LAYOUT.md / PHILOSOPHY.md nella repo principale, con sezione anti-pattern (es. editor in /usr/local con config in /etc) e bootstrap formalizzato (installazione base → clone dotfiles → sistema ricostruito).
|
||||||
|
- KDE come fallback su Void: sostituzione opportunistica delle app verso Qt (Dolphin, Okular, Spectacle, Gwenview, Ark) solo se/dove dà integrazione reale; da rivalutare solo se il repo Hyprland si fermasse.
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-07-14 | Distribuzioni Linux più UNIX | transcripts/2025-07-14-distribuzioni-linux-piu-unix.md |
|
||||||
|
| 2025-09-17 | Sistema operativo | transcripts/2025-09-17-sistema-operativo.md |
|
||||||
|
| 2026-01-16 | Sistemi BSD per laptop | transcripts/2026-01-16-sistemi-bsd-per-laptop.md |
|
||||||
|
| 2026-01-25 | Shell più usate BSD | transcripts/2026-01-25-shell-piu-usate-bsd.md |
|
||||||
|
| 2026-01-26 | Font UNIX simili Nerd | transcripts/2026-01-26-font-unix-simili-nerd.md |
|
||||||
|
| 2026-01-28 | Separazione core system user | transcripts/2026-01-28-separazione-core-system-user.md |
|
||||||
|
| 2026-01-29 | Troubleshooting FreeBSD Firewall | transcripts/2026-01-29-troubleshooting-freebsd-firewall.md |
|
||||||
|
| 2026-03-03 | Configurazione NixOS da Fedora | transcripts/2026-03-03-configurazione-nixos-da-fedora.md |
|
||||||
|
| 2026-03-04 | Void Linux install script | transcripts/2026-03-04-void-linux-install-script.md |
|
||||||
|
| 2026-06-21 | Scelta distro Linux filosofia | transcripts/2026-06-21-scelta-distro-linux-filosofia.md |
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
# Programmazione di sistema — C, UNIX APIs, APUE
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Percorso di studio e obiettivi
|
||||||
|
|
||||||
|
- Partenza (giu 2025): programmatore Java professionista, conosce già la sintassi di C, vuole passare alla programmazione di sistema da zero.
|
||||||
|
- Piano di studio a fasi (riportato in più occasioni): linguaggi C, Bash, Python, Go, Zig; Fase 1 fondamenti (algoritmi/strutture dati, sistemi operativi con OSTEP/Silberschatz, git); Fase 2 reti, container e system programming (Modern C, Linux System Programming, APUE, CS:APP); Fase 3 kernel programming e principi di design; Fase 4 opzionale (UNIX Network Programming vol. 1, DDIA).
|
||||||
|
- Primo piano operativo: 12 settimane su Linux System Programming (R. Love, 2ª ed.): 4 giorni/sett. lettura + esercizi, 1 giorno/sett. progetto hands-on; diario di apprendimento (concetti chiave, codice scritto, errori e soluzioni); piani esportati anche in RTF compatibile con Apple Notes.
|
||||||
|
- Esercizi su LSP (repo `github.com/fscotto/system-programming`): mycp, tree, run_scripts, downloader multi-thread simulato, benchmark di allocazione (malloc/calloc/mmap), esercizio segnali SIGINT/SIGUSR1; per ciascuno Makefile (target build/run/test/valgrind/clean), unit test e report valgrind automatici (run_tests.sh).
|
||||||
|
- Dopo la fine di LSP: consolidamento reimplementando le coreutils GNU (cartella `exercises/coreutils/`: ls ed echo sviluppati, sleep spiegato); indice degli esercizi in `exercises/README.md`.
|
||||||
|
- Consigli adottati: consolidare il C con Modern C e la teoria dei SO prima/in parallelo ad APUE; le socket non sono trattate in LSP → networking demandato ad APUE (richiesto sommario del cap. 16); prima del networking, rinforzare file/processi/thread/segnali via coreutils (dubbio espresso sulla reale necessità del networking in questa fase).
|
||||||
|
- Modern C (Gustedt) scelto al posto di K&R (fermo a C89/C90); percorso: capp. 1–6, 7, 8, 10, 14 (poi 9, 11, 12, 13, 15); Modern C e alcuni libri della Fase 1 non ancora terminati.
|
||||||
|
- Dal 2026 APUE (Stevens & Rago) è il testo principale; a lug 2026 l'utente è al cap. 6 e consolida i capp. 1–5 con il progetto fsnap; orientamento dichiarato: sviluppo user-space (non kernel), più pratica su C e algoritmi mentre studia le API POSIX.
|
||||||
|
- xv6 (giu 2026): affiancare alla lettura di APUE un corso su xv6 per vedere il lato kernel (es. `fork()` in APUE → `sys_fork()` in xv6); consigliato il corso MIT 6.S081 (ex 6.828); xv6 rende concreta la teoria ma non la sostituisce; OSTEP solo selettivo (virtual memory, concurrency, scheduling, persistence); non trasformare xv6 in un progetto kernel completo; obiettivo: arrivare a leggere il kernel Linux con più sicurezza.
|
||||||
|
- Ambiente (giu 2026): Linux come piattaforma di sviluppo ("non cerco purezza UNIX, ma sviluppare con i tool che preferisco"); manpage NetBSD ritenute superiori come riferimento POSIX; lavoro su terminale con Vim, con vimrc "onefile" senza plugin; LSP: utile ma non centrale.
|
||||||
|
- Skill del system programmer (sintesi ChatGPT): C solido; API POSIX/UNIX la skill più importante (fd, open/read/write/close, fork/exec, waitpid, pipe, segnali, processi/thread, mmap, socket); interno del SO; debugging (gdb, strace, ltrace, perf, valgrind); toolchain; "chi padroneggia APUE può già definirsi system programmer junior".
|
||||||
|
|
||||||
|
## Progetto fsnap (stato, struttura, decisioni)
|
||||||
|
|
||||||
|
- Origine (lug 2026): consolidare i capp. 1–5 di APUE con un unico progetto "vero"; scartato l'ennesimo clone isolato di un comando Unix (mycp e tree già realizzati).
|
||||||
|
- Repo: `github.com/fscotto/fsnap`; layout `src/` + `include/`; Makefile con `-Iinclude` (fix dell'errore `undefined reference to scan` durante il link); review del codice richiesta più volte a ChatGPT.
|
||||||
|
- Concetto: utility POSIX in C che attraversa ricorsivamente un albero di directory, crea snapshot testuali dei metadati del filesystem, li legge e valida, confronta snapshot e verifica lo stato corrente.
|
||||||
|
- Comandi progettati:
|
||||||
|
```text
|
||||||
|
fsnap scan <directory>
|
||||||
|
fsnap create <directory> <snapshot>
|
||||||
|
fsnap list <snapshot>
|
||||||
|
fsnap diff <old.fsnap> <new.fsnap>
|
||||||
|
fsnap verify <snapshot> <directory>
|
||||||
|
```
|
||||||
|
- Formato snapshot: testuale, campi separati da `|`, scelto esplicitamente contro un formato binario (più facile da ispezionare, debuggare e leggere via stdio).
|
||||||
|
- Record inizialmente proposto: path, tipo (F/D/L), device ID, inode, permessi, nlink, UID, GID, size, atime, mtime, ctime, target del symlink (es. `F|src/main.c|2049|83124|0644|1|1000|1000|4821|1722410134`).
|
||||||
|
- Record della specifica finale: `type|permissions|uid|gid|size|mtime|path` (es. `F|0644|1000|1000|125|1753999812|src/main.c`).
|
||||||
|
- Requisiti di `scan`: opendir/readdir/closedir, lstat(), readlink(); niente nftw() inizialmente (nasconderebbe la parte da esercitare); ignorare `.` e `..`; non seguire i symlink, trattati come foglie comuni (se non si segue il link, nel walk non serve distinguerli dai file regolari); fallback a lstat() quando `dirent.d_type == DT_UNKNOWN`; chiara la differenza tra stat() e lstat(); walker generico `walk(directory, operation, context)` indipendente dall'operazione, riusato da scan e create; errori di traversal e callback propagati al chiamante.
|
||||||
|
- Portabilità: requisito esplicito (Linux e NetBSD); scan verificato funzionante anche su NetBSD, preludio al punto 2.
|
||||||
|
- `create` (punto 2): riusa il walker, raccoglie i metadati con lstat() e li serializza; durante lo sviluppo errori "bad descriptor" con mkstemp (ipotesi dell'utente: il file di mkstemp è opaco); dopo revisione del repo l'utente dichiara tutto risolto.
|
||||||
|
- `list` (punto 3): parser, percorso inverso di create; richieste solo le specifiche, non il codice; linee di lunghezza arbitraria (no buffer fissi tipo `char line[1024]`); separazione dei campi e conversioni numeriche controllate (valore valido, campo vuoto, caratteri residui, overflow, negativi non ammessi); validazione semantica (tipo `X|` sconosciuto, permessi `9999`, size negativa per file regolare); errori con numero di riga (`snapshot.fsnap:12: invalid uid`); decisioni aperte: pathname contenenti `|` o newline, chi possiede la memoria del pathname, quali controlli nel parser e quali nelle fasi successive.
|
||||||
|
- Specifica finale richiesta in inglese ("fsnap — Project Specification"): goals = traversal, metadati, file descriptor, stdio, link simbolici e hard link, tipi POSIX, error handling con errno, portabilità Unix, gestione risorse, parsing testuale, interfacce C riutilizzabili; non-goal iniziali (filesystem monitoring, real-time change detection, parallelismo, thread, garanzie crittografiche, compressione, network sync, feature FS-specifiche) come estensioni opzionali future.
|
||||||
|
- Stato a fine conversazione (ago 2026): scan completato (Linux + NetBSD); create completato; list/parser in fase di progettazione; diff e verify da implementare.
|
||||||
|
|
||||||
|
## Conoscenze e correzioni tecniche chiave apprese
|
||||||
|
|
||||||
|
- I/O su file (mycp): per l'usage usare `fprintf(stderr, "Usage: %s ...", argv[0])`, non perror; copiare con loop read/write fino a read()==0, senza pre-calcolare la dimensione del file; riprovare su EINTR; controllare anche gli errori di close; buffer da 4096 byte.
|
||||||
|
- Processi (run_scripts): figli con fork() + execlp("/bin/bash", "bash", script, NULL); attesa con waitpid(pid,&status,0) e non wait(); esito con WIFEXITED/WEXITSTATUS e WIFSIGNALED/WTERMSIG (distinguere uscita normale da terminazione via segnale); gestire errori di fork/exec/waitpid con perror e exit.
|
||||||
|
- Segnali: nell'handler solo funzioni async-signal-safe (write, _exit; non exit/perror); contatori come `volatile sig_atomic_t`, non una semplice `static int`; sa_mask va costruita con sigemptyset + sigaddset (non `sa_mask = SIGINT|SIGUSR1`); strlen non è garantita re-entrant nell'handler; wrapper safe_print(msg,len) con write(..., len-1): non stampava la riga intera.
|
||||||
|
- Benchmark memoria: tempi con clock_gettime(CLOCK_MONOTONIC); uso memoria via /proc/self/status o /proc/self/statm; firme diverse delle funzioni di allocazione → array di function pointer (typedef StatsFn) con wrapper; blocchi di prova da 1024 a 100000 byte; statistiche su tempi medi e picco RSS.
|
||||||
|
- echo: calcolare prima le lunghezze in un array, un solo malloc + memcpy e una sola write (no strcat/strlen ripetuti); la variante con cache delle strlen produceva segfault, corretta ricalcolando gli offset; byte extra per il newline (chiarito il +1).
|
||||||
|
- ls: chiarito il trattamento del path al raggiungimento di PATH_MAX.
|
||||||
|
- Makefile: `-Iinclude` per gli header in cartella dedicata; standard C11 impostato; target build/run/test/valgrind/clean; cleanup eseguito dal Makefile; report valgrind generati via run_tests.sh.
|
||||||
|
- Shell POSIX (script con auto-elevazione sudo): `exec sudo bash "$0" "$@"` reinvoca lo script con l'interprete corretto; `exec` sostituisce la shell nel processo corrente e chiude subito l'emulatore di terminale (osservato); `sudo env "$0"` esegue con la shell indicata dal shebang; lo script non era POSIX: `[[ ]]` → `[ ]`, `source` → `.`, `$BASH_SOURCE` → `$0`, niente pipefail; `yay` è una dipendenza specifica di Arch.
|
||||||
|
- LSP in C: un LSP accurato (clangd) richiede compile_commands.json; utile per navigazione/diagnostica ma non sostituisce make, man, grep, ctags, cscope, gdb, strace, valgrind; i bug tipici del system programming (syscall errate, errno incompleta, EINTR ignorato, fd leak, race/deadlock, buffer troppo piccoli, UB, differenze POSIX/Linux, linking/ABI) non emergono da un LSP.
|
||||||
|
|
||||||
|
## Preferenze di coding emerse
|
||||||
|
|
||||||
|
- Low-level POSIX prima delle astrazioni: API dirette (no nftw in fsnap), formato dati testuale e ispezionabile.
|
||||||
|
- Il codice lo scrive da solo: chiede specifiche, test, makefile e review del proprio codice ("è corretto secondo le specifiche?", "dai un altro sguardo al repo"); per il punto 3 di fsnap, esplicitamente "Non darmi il codice già fatto".
|
||||||
|
- Ogni esercizio dotato di unit test (anche con mock della struttura delle directory), integrazione valgrind e Makefile con target di build/test/clean.
|
||||||
|
- Inglese per README, specifiche di progetto e commenti del Makefile; indice markdown centralizzato degli esercizi su GitHub.
|
||||||
|
- Gestione errori sistematica: perror + errno, controllo del ritorno di ogni syscall, gestione di EINTR.
|
||||||
|
- Portabilità: requisito del progetto fsnap (Linux + NetBSD); NetBSD usato come secondo sistema di prova; manpage NetBSD come riferimento per le funzioni POSIX.
|
||||||
|
- Stile kernel per il C (tabstop/shiftwidth 8, colonna 80) con vimrc onefile senza plugin; quickfix al centro del flusso (`:make` → `:copen` → `:cnext`); grepprg rg con fallback a grep; giudizio sulla config: portabilità 8/10, C/POSIX 8/10, kernel style 8/10, minimalismo 9/10, robustezza VimL 6.5/10, LSP readiness 5/10.
|
||||||
|
- Codice pubblico su GitHub: `fscotto/system-programming` (esercizi), `fscotto/fsnap` (progetto APUE), gist per la .vimrc onefile.
|
||||||
|
- Piani di studio mantenuti come markdown esportabile (anche RTF per Apple Notes).
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- fsnap: implementare `list`/parser con le decisioni ancora aperte (pathname con `|` o newline, memoria del pathname, confine parser/validazione); poi `diff` e `verify`; estensioni opzionali dai non-goal.
|
||||||
|
- APUE: proseguire dal cap. 6; socket/networking (cap. 16) in agenda, con dubbio già espresso sul momento giusto della fase reti.
|
||||||
|
- Modern C: capitoli selezionati (1–6, 7, 8, 10, 14) da leggere; alcuni libri della Fase 1 del piano non completati.
|
||||||
|
- xv6 (MIT 6.S081): da affiancare ad APUE per processi, memoria, filesystem e system call.
|
||||||
|
- Esercizio segnali: safe_print nell'handler non ancora funzionante (stampa solo parte della riga).
|
||||||
|
- Config vimrc: parti aggressive/fragili da sistemare; eventuale LSP da valutare.
|
||||||
|
- coreutils: proseguire con i comandi rimanenti del piano (svolti ls ed echo; sleep spiegato).
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-06-17 | Programmazione di sistema | [transcripts/2025-06-17-programmazione-di-sistema.md](transcripts/2025-06-17-programmazione-di-sistema.md) |
|
||||||
|
| 2025-07-08 | Elevazione privilegi con script | [transcripts/2025-07-08-elevazione-privilegi-con-script.md](transcripts/2025-07-08-elevazione-privilegi-con-script.md) |
|
||||||
|
| 2026-06-02 | Studiare xv6 con APUE | [transcripts/2026-06-02-studiare-xv6-con-apue.md](transcripts/2026-06-02-studiare-xv6-con-apue.md) |
|
||||||
|
| 2026-06-21 | Skill system programmer | [transcripts/2026-06-21-skill-system-programmer.md](transcripts/2026-06-21-skill-system-programmer.md) |
|
||||||
|
| 2026-07-31 | Progetto fsnap per APUE | [transcripts/2026-07-31-progetto-fsnap-per-apue.md](transcripts/2026-07-31-progetto-fsnap-per-apue.md) |
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
# Tool e infrastruttura — VM, backup, SSH/GPG, DNS, dischi
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Macchine virtuali e desktop remoto
|
||||||
|
|
||||||
|
**VM Windows 11 su KVM/QEMU (da conversione P2V VMware)**
|
||||||
|
- Windows 11 fisico virtualizzato con VMware vCenter Converter Standalone; disco VMDK convertito con `qemu-img convert -p -O qcow2 in.vmdk out.qcow2` (opzione `-c` per compressione interna).
|
||||||
|
- VMDK "split": passare a qemu-img solo il file descriptor (`Windows11.vmdk`), mai i file `-s001...`.
|
||||||
|
- VM "Windows 11 - TIF": machine q35, OVMF con Secure Boot + enrolled keys e TPM 2.0 emulato, 16 GiB RAM, 4 vCPU, cpu `host-passthrough` con AES/AVX/AVX2 e `<pmu state='on'/>`, Hyper-V enlightenments `mode="custom"` (relaxed, vapic, spinlocks 8191, vpindex, runtime, synic, stimer, frequencies, tlbflush, ipi, avic).
|
||||||
|
- Driver VirtIO (qemu-guest-agent, balloon, NetKVM, viostor) installati in Windows da virtio-win.iso; passare disco a bus virtio (`io='native'`, `discard='unmap'`, `cache='writeback'`, I/O thread) e rete a virtio-net SOLO dopo aver installato i driver in Windows (prima backup dell'XML/disco); in Windows rimuovere i driver dell'hardware fisico (sensore biometrico, GPU, Wi-Fi, chipset, NVMe/RST) e impostare power plan High Performance.
|
||||||
|
- Problema impronta digitale post-P2V: risolto reimpostando il PIN di Windows.
|
||||||
|
|
||||||
|
**Risoluzione grafica VM Linux (EndeavourOS)**
|
||||||
|
- Video Virtio (QXL solo per SPICE legacy), display Spice con OpenGL + 3D accel, guest `spice-vdagent` (pacman) per auto-resize, copia/incolla e multi-monitor; su Wayland virtio-gpu funziona al 90%, per maturità di SPICE meglio sessione Plasma X11.
|
||||||
|
|
||||||
|
**Audio remoto con RDP (Remmina su Fedora Silverblue → laptop Windows 11 Pro)**
|
||||||
|
- Setup funzionante per Teams con audio bidirezionale: `Audio output mode: Local`, `Redirect local audio output: sys:pulse`, `Redirect local microphone: sys:pulse` (la build FreeRDP richiede il formato `sys:{} device:{}`; fallback `sys:alsa,device:default`).
|
||||||
|
- Lato Windows abilitare in gpedit "Allow audio and video playback redirection" e "Allow audio recording redirection"; FreeRDP consigliato ≥ 2.8.
|
||||||
|
- Test: `xfreerdp /sound:sys:pulse` e `/microphone:sys:pulse`; in Windows devono comparire "Microfono remoto RDP" e "Remote Audio". Miglioramenti suggeriti ma non adottati: `/gfx:rfx /network:auto /audio-mode:1`, NoMachine/RustDesk.
|
||||||
|
|
||||||
|
## Strategia backup (Borg, USB offline, ripristino)
|
||||||
|
|
||||||
|
**Architettura dati Atlas (NAS Rocky 9, ZFS) — tre livelli**
|
||||||
|
- ZFS snapshot (rollback e cancellazioni accidentali) → Borg → Hetzner Storage Box off-site (cifratura, deduplica, retention) → rsync → HDD USB scollegato dopo il backup (anti-ransomware; recovery banale su qualunque Linux).
|
||||||
|
|
||||||
|
**Passphrase e chiavi Borg (Borg 1.4, modalità repokey)**
|
||||||
|
- `vault_atlas_borg_passphrase` = passphrase di cifratura del repository, in `secrets/vault.yml` (Ansible Vault), mai in chiaro nel Git; Borg conserva la repokey cifrata dentro il repository.
|
||||||
|
- Credenziali distinte: la chiave SSH borg (`/etc/atlas-borg/id_ed25519`, 0600 borg:borg) autentica Atlas verso Hetzner ed è rigenerabile, NON è materiale di disaster recovery.
|
||||||
|
- Generare la passphrase con `openssl rand -base64 48` e salvarla subito nel password manager. Kit DR = passphrase Borg + export recovery key (`borg key export` dopo `borg init`, prodotto dal playbook; export cifrato senza passphrase, reintegrabile con `borg key import`; variante `--paper` da stampare) + password Ansible Vault.
|
||||||
|
- In automazione usare `BORG_PASSPHRASE`/`BORG_PASSCOMMAND`, mai la passphrase in command line (visibile in process list).
|
||||||
|
- Playbook: `ansible-playbook ansible/site.yml --limit atlas --tags borg --ask-vault-pass` (dry-run con `--check --diff`); prima caricare su Hetzner la public key borg (`atlas-borg@atlas`).
|
||||||
|
|
||||||
|
**Verifica backup Borg (primo popolamento di /zpool/archive)**
|
||||||
|
- Metriche da valutare: durata, Original size, Compressed size, Deduplicated size, dimensione repo; secondo run senza modifiche per confermare la deduplicazione; poi test con modifica controllata (attesi solo i chunk nuovi).
|
||||||
|
- `atlas-borg-backup.service`: Type=oneshot, TimeoutStartSec=infinity, SuccessExitStatus=1, Restart=on-failure/30m, Condition su `/etc/atlas-borg/{passphrase,id_ed25519,known_hosts}`, sandbox systemd.
|
||||||
|
- `Result=success` con `ExecMainExitTimestamp` vuoto = job ancora in corso, non completato (le statistiche `--stats` compaiono solo alla fine) → non interrompere il primo backup lungo.
|
||||||
|
- `borg create` sul dataset live non è uno snapshot coerente (warning "file changed while we backed it up", exit 1): decisione di design = far leggere a Borg uno snapshot ZFS (valutare il riuso degli snapshot ricorsivi già previsti), dati aggiunti durante il job entreranno nel backup successivo.
|
||||||
|
|
||||||
|
**Backup USB offline (realizzato come `atlas-usb-backup.service`)**
|
||||||
|
- Vincolo all'UUID (`atlas_usb_backup_uuid`): UUID corrisponde → mount → backup → verifica → umount, altrimenti abort; disco collegato solo durante il backup; routine manuale ogni 2–4 settimane (la presenza fisica del disco è una feature, non automatizzare il collegamento).
|
||||||
|
- rsync versionato con `--link-dest`: directory datate (es. `2026-09-23/`) + symlink `latest`, file invariati condivisi come hard link; NO mirror puro con `--delete` (propaga le cancellazioni).
|
||||||
|
- Il service gestisce namespace privato, LUKS, snapshot consistente, rsync, verifica checksum, pubblicazione `latest`, cleanup; oltre all'exit code controllare filesystem montato corretto e struttura plausibile; restore test periodico su un campione di file.
|
||||||
|
|
||||||
|
**Ripristino e monitoraggio (protezione dati operativa)**
|
||||||
|
- Test Borg normale completato: `borg extract` dell'archivio reale da Hetzner in dir temporanea, confronto di 170 file con `/zpool/archive` → backup leggibile e ripristinabile.
|
||||||
|
- Checklist: recovery indipendente per livello — ZFS (recupero file da `.zfs/snapshot`, senza rollback), Borg/Hetzner da ambiente pulito (recovery key offline + passphrase + nuova SSH key), USB. Manca ancora il test Borg da ambiente pulito.
|
||||||
|
- Controlli: `zpool status` ONLINE senza errori READ/WRITE/CKSUM, scrub/resilver senza errori, SMART (reallocated/pending/uncorrectable, self-test), temperature, spazio 80%/90% (pool e dataset), fallimenti unit systemd, età dell'ultimo backup riuscito; "timer attivo" ≠ "backup recente"; un backup "silenziosamente morto" (timer mai partito) non produce failure.
|
||||||
|
- Proposta `atlas-health-check.timer` (ogni 15–30 min, controlli pesanti giornalieri), silenzioso se tutto OK; alert via email o ntfy; livello 1 failure immediate → 45Drives Alerts, livello 2 controlli periodici giornalieri, livello 3 Prometheus/Grafana solo come evoluzione.
|
||||||
|
- Prometheus (Raspberry Pi) come controllo esterno (Atlas raggiungibile? metriche fresche? backup recente?); base per il futuro "backup pull da Prometheus verso Atlas"; voce checklist completata solo dopo aver provocato un errore innocuo e ricevuto l'alert (configurato ≠ verificato).
|
||||||
|
- 45Drives Cockpit Scheduler (Houston, Rocky 9 supportato): genera unit systemd service+timer; task nativi scrub ZFS, SMART self-test, snapshot ZFS, rsync, replica ZFS, custom. Migrazione selettiva: sì a scrub e SMART self-test; snapshot da valutare (vs nostra retention); no a Borg, backup USB e reminder USB (già negli Alerts). Da verificare prima: integrazione reale Scheduler→Cockpit Alerts sulla versione installata, sovrapposizioni coi timer esistenti (evitare doppio scrub/snapshot), provisioning dei task via Ansible.
|
||||||
|
|
||||||
|
## SSH, GPG e protezione dischi
|
||||||
|
|
||||||
|
**Agenti SSH/GPG su FreeBSD**
|
||||||
|
- Principio: agenti solo user-space, chiavi solo in `$HOME` (mai in `/etc`), core system standard minimale; dotfiles versionati con git+stow.
|
||||||
|
- ssh-agent in `.profile`/`.bashrc`: crea `~/.ssh/agent_env` (chmod 600) con `SSH_AUTH_SOCK`/`SSH_AGENT_PID`, lo ri-sourca a ogni login, riparte solo se l'agente non è più vivo; `ssh-add` di `~/.ssh/id_rsa` e `~/.ssh/id_ed25519`. Senza quelle variabili esportate la shell non comunica con l'agente.
|
||||||
|
- gpg-agent: `~/.gnupg/gpg-agent.conf` (`pinentry-program /usr/local/bin/pinentry-curses`, default-cache-ttl 600, max-cache-ttl 7200), avvio user-space `gpg-agent --daemon --enable-ssh-support`; firma git con `user.signingkey` + `commit.gpgsign true`.
|
||||||
|
|
||||||
|
**Blocco scrittura dischi esterni (Windows)**
|
||||||
|
- GPO (Pro/Enterprise): gpedit → Sistema → Accesso all'archiviazione rimovibile → "Dischi rimovibili: nega accesso in scrittura"; oppure registro: `reg add HKLM\SYSTEM\CurrentControlSet\Control\StorageDevicePolicies /v WriteProtect /t REG_DWORD /d 1 /f` (0 per rimuovere).
|
||||||
|
- Varianti aziendali: GPO di dominio con eccezioni per gruppo, Intune/Defender Device Control (whitelist VID/PID/seriale), consentire la scrittura solo su USB cifrate BitLocker To Go.
|
||||||
|
- Verifiche: `gpresult /h report.html`, `reg query`/`Get-ItemProperty` su StorageDevicePolicies, test di scrittura su chiavetta, `dsregcmd /status` per dominio/Entra.
|
||||||
|
|
||||||
|
**Dual boot con BitLocker (ThinkPad P1 Gen 7, 2 TB, Windows 11 Enterprise, dominio IBM)**
|
||||||
|
- Fattibile senza reinstallare né disattivare: backup dati → salvare la Recovery Key (`manage-bde -protectors -get C:\`) → sospendere BitLocker prima del partizionamento (`manage-bde -protectors -disable C:\`) → ridurre C: da Gestione Disco → installare Fedora nello spazio libero usando la stessa ESP (non toccare ESP/MSR/recovery) → riattivare (`-enable`); possibile richiesta della Recovery Key al primo avvio; Fedora supporta Secure Boot nativamente.
|
||||||
|
- Su macchina gestita (Intune/Entra ID/EDR): prima chiedere all'IT — cambiare bootloader può generare alert SOC o violare policy; alternative: WSL2, VM Fedora (VMware/VirtualBox/Hyper-V), secondo SSD NVMe (SSD1 Windows, SSD2 Fedora) se il modello ha due slot.
|
||||||
|
- Sul portale IBM esistono istruzioni ufficiali per installare Fedora: leggerle per capire lo scenario previsto (dual boot, immagine Fedora gestita o dispositivo "Linux-managed").
|
||||||
|
|
||||||
|
## DNS e rete locale
|
||||||
|
|
||||||
|
**AdGuard Home + FRITZ!Box**
|
||||||
|
- Spostato il DNS dal FRITZ!Box a AdGuard → persa la risoluzione hostname↔IP dei client DHCP: aggiungere upstream condizionali `[/fritz.box/]192.168.178.1` e `[//]192.168.178.1` (nomi non qualificati), accanto agli upstream normali (es. DoH Cloudflare/Quad9); in Private reverse DNS mettere `192.168.178.1`.
|
||||||
|
- Architettura scelta: DHCP resta sul FRITZ!Box, AdGuard solo DNS/filter; il FRITZ rimane autoritativo per la LAN; verifica: `dig @192.168.178.1 host.fritz.box` e `dig @IP_ADGUARD host.fritz.box` devono coincidere.
|
||||||
|
- `localhost` non dipende dal DNS: risolto da `/etc/hosts` prima del DNS; `dig` interroga direttamente il DNS, mentre `getent`/`ping`/`curl` passano dal resolver NSS (`nsswitch.conf` deve avere `files`); confrontare `curl http://127.0.0.1:porta` vs `http://localhost:porta` per distinguere problema di servizio da problema di risoluzione.
|
||||||
|
- Verifica servizio locale: `ss -ltnp` (porta in ascolto su 127.0.0.1 vs 0.0.0.0), `nc -vz 127.0.0.1 8080`, `systemctl status`/`journalctl -u`.
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- Modificare il job Borg per leggere da uno snapshot ZFS (valutando il riuso degli snapshot ricorsivi esistenti) invece del dataset live.
|
||||||
|
- Test di ripristino Borg da ambiente pulito con recovery key offline + passphrase del password manager; test di recovery indipendente anche per il livello USB.
|
||||||
|
- Esito della verifica Codex (read-only su Atlas): versione/integrazione Scheduler↔Alerts 45Drives, sovrapposizioni coi timer systemd esistenti, provisioning via Ansible → poi migrazione selettiva dei task.
|
||||||
|
- Verificare dove viene salvato l'export della Borg recovery key (fuori da Atlas) e come la passphrase passa dal Vault a Borg (file 0600 / BORG_PASSCOMMAND).
|
||||||
|
- Prometheus come controllore esterno di Atlas e futuro "backup pull da Prometheus verso Atlas".
|
||||||
|
- Workstation IBM: interpretare le istruzioni del portale per scegliere tra dual boot, WSL2, VM o secondo SSD.
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-12-05 | Convertire VMDK in QCOW2 | [2025-12-05-convertire-vmdk-in-qcow2.md](transcripts/2025-12-05-convertire-vmdk-in-qcow2.md) |
|
||||||
|
| 2025-12-05 | Come posso ottimizzare la risoluzione di una macchina virtuale su KVM/Qemu | [2025-12-05-come-posso-ottimizzare-la-risoluzione-di-una-macchina-virtua.md](transcripts/2025-12-05-come-posso-ottimizzare-la-risoluzione-di-una-macchina-virtua.md) |
|
||||||
|
| 2025-12-18 | Audio remoto con RDP | [2025-12-18-audio-remoto-con-rdp.md](transcripts/2025-12-18-audio-remoto-con-rdp.md) |
|
||||||
|
| 2026-01-28 | Configurazione SSH e GPG | [2026-01-28-configurazione-ssh-e-gpg.md](transcripts/2026-01-28-configurazione-ssh-e-gpg.md) |
|
||||||
|
| 2026-06-02 | Blocco scrittura dischi esterni | [2026-06-02-blocco-scrittura-dischi-esterni.md](transcripts/2026-06-02-blocco-scrittura-dischi-esterni.md) |
|
||||||
|
| 2026-06-18 | Dual boot con BitLocker | [2026-06-18-dual-boot-con-bitlocker.md](transcripts/2026-06-18-dual-boot-con-bitlocker.md) |
|
||||||
|
| 2026-09-05 | Risoluzione Nomi Locali AdGuard | [2026-09-05-risoluzione-nomi-locali-adguard.md](transcripts/2026-09-05-risoluzione-nomi-locali-adguard.md) |
|
||||||
|
| 2026-09-18 | Spiegare passphrase Borg | [2026-09-18-spiegare-passphrase-borg.md](transcripts/2026-09-18-spiegare-passphrase-borg.md) |
|
||||||
|
| 2026-09-18 | Test di ripristino indipendenti | [2026-09-18-test-di-ripristino-indipendenti.md](transcripts/2026-09-18-test-di-ripristino-indipendenti.md) |
|
||||||
|
| 2026-09-18 | Monitoraggio protezione dati | [2026-09-18-monitoraggio-protezione-dati.md](transcripts/2026-09-18-monitoraggio-protezione-dati.md) |
|
||||||
|
| 2026-09-21 | Valutare backup Borg | [2026-09-21-valutare-backup-borg.md](transcripts/2026-09-21-valutare-backup-borg.md) |
|
||||||
|
| 2026-09-23 | Backup USB offline | [2026-09-23-backup-usb-offline.md](transcripts/2026-09-23-backup-usb-offline.md) |
|
||||||
|
| 2026-09-24 | Monitoraggio E Alert Atlas | [2026-09-24-monitoraggio-e-alert-atlas.md](transcripts/2026-09-24-monitoraggio-e-alert-atlas.md) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
# Workflow di sviluppo e progetti
|
||||||
|
|
||||||
|
> Distillato dalle conversazioni ChatGPT elencate in fondo (transcript completi in ~/.config/ai/memory/chatgpt/transcripts/).
|
||||||
|
> Generato da scripts/chatgpt_export_to_memory.py + distillazione AI, 2026-11-08.
|
||||||
|
|
||||||
|
## Workflow UNIX e strumenti scelti
|
||||||
|
|
||||||
|
- Principi: filosofia UNIX ("do one thing well"), tool CLI testuali e componibili, documentazione tecnica in plain text; compatibilità con i formati proprietari aziendali tramite strumenti di conversione.
|
||||||
|
- Struttura standard dei progetti: `~/projects/<nome>/` con `src/`, `bin/`, `doc/`, `test/` e `Makefile`; documenti sincronizzati nel cloud via `rclone` (prima Mega, poi pCloud).
|
||||||
|
- Toolchain per linguaggio: C (`gcc`/`clang`, `clang-format`, `cppcheck`, `make`, `gdb`, `valgrind`), Bash (`shellcheck`, `shfmt`, `bats`), Python (`black`, `ruff`, `mypy`, `pytest`, `venv`), Go (`go fmt`, `golangci-lint`, `gopls`, `go test`); formatter configurati anche per Lua e Zig.
|
||||||
|
- Editor — evoluzione: Neovim → **Emacs**, dichiarato "editor di riferimento per lo sviluppo" su Linux e centro operativo del workflow; su **FreeBSD** invece usa **vim** anche per lo sviluppo: Emacs non viene installato perché lì privilegia i tool nativi e storici UNIX.
|
||||||
|
- Emacs come hub, non come sostituzione ("integra, non inglobare"): org-mode (note, to-do, journaling), projectile, dirvish/dired, magit, LSP + dap-mode, vterm, tramp, pdf-tools per annotazioni PDF.
|
||||||
|
- Regola anti "Emacs come OS": non duplicare ciò che il sistema fa già bene (mail, fs, job control); se Emacs si rompe, il sistema deve continuare a funzionare.
|
||||||
|
- Desktop — evoluzione: fase Wayland valutata (alias pbcopy/pbpaste con `wl-clipboard` come funzioni, clipman su Sway, screenshot `grim` + notifica `fyi`) → ritorno a **X11 + i3**; distro **Linux Mint**; storage **pCloud** al posto di Mega.
|
||||||
|
- Preview file per formato: `bat` per i markdown; viewer PDF nel terminale; i file binari solo con output di `file`, mai nel pager; paging come flag esplicito, non default.
|
||||||
|
- PDF e immagini: `zathura` come viewer leggero/scriptabile (potenziato con indice/sidebar), `feh`/`sxiv` per le immagini; calibre valutato per le collezioni di PDF ma trovato poco coerente con la filosofia UNIX (valutato anche calibre-tui) → scartato.
|
||||||
|
- Mergetool grafico: **Meld**, integrato con l'editor via Telescope: confronto tra file, inclusa la versione del file corrente su un altro branch (primo branch = corrente, secondo selezionato, ricerca ricorsiva dalla root del progetto).
|
||||||
|
- Git: `.gitconfig` dichiarata produttiva e mantenuta contro ogni proposta di modifica — `delta` (tema catppuccin-mocha) come pager/differ, `meld` come difftool/mergetool, conflictstyle diff3, `pull.rebase`, firma GPG, alias (`co`, `br`, `ci`, `st`, `lg`, `undo`, `stash-all`…).
|
||||||
|
- Mail: **neomutt** scelto su mutt (patch integrate, notmuch, sidebar, truecolor, account multipli) e preferito a Thunderbird in un workflow UNIX; esplorate catene di programmi esterni (contatti), integrazione Google con più rubriche, PEC (in uso Namirial Spidmail), ProtonMail bridge, condivisione di mailbox locale con Thunderbird.
|
||||||
|
- Password di posta = preoccupazione principale: valutati unix pass e solo-Bitwarden; approdo a **GNOME Keyring + libsecret** (`secret-tool lookup` per `imap_pass` in neomutt, sblocco via PAM, config completa preparata per Arch + Hyprland); script per casella Gmail con log e commenti in inglese.
|
||||||
|
- ChatGPT come assistente di scrittura: riscrittura di email di servizio in forma più formale.
|
||||||
|
## Piano e metodo per i goal
|
||||||
|
|
||||||
|
- Goal dichiarato (workstation FreeBSD): sistema coerente con la filosofia UNIX, minimale ma realmente usabile ("minimale ma non ascetico"), tecnicamente difendibile, comprensibile end-to-end.
|
||||||
|
- Metodo di revisione: parte dall'elenco dei pacchetti installati manualmente, li motiva uno per uno e poi li riduce; ogni tool deve avere una ragione tecnica; domanda guida: "posso eliminarlo senza perdere una funzionalità essenziale?"; due tool per lo stesso lavoro → tenere il più semplice, evitare stack di daemon/wrapper.
|
||||||
|
- Dopo la revisione su FreeBSD rimossi: bat, fastfetch, hack-font, nerd-fonts, starship, zoxide (motivato e poi eliminato), lynis; confermati invece fzf, git-delta (differ predefinito per la review del codice), stow (dotfiles in repo git).
|
||||||
|
- Compromessi dichiarati: browser e multimedia non-UNIX confinati in `$HOME`, non integrati nel workflow, documentati come compromessi.
|
||||||
|
- Le regole si mettono per iscritto in documenti verificabili e vincolanti: `separazione_core_system_vs_user_environment.md`; regola angolare: il sistema deve restare funzionale anche in assenza completa di `$HOME`.
|
||||||
|
- Carica i file di configurazione (vim, git, bash) e i documenti di regole nella knowledge del progetto ChatGPT; chiede resoconti "stato dell'arte e cosa manca" come punti di controllo, considerando le altre chat del progetto parte integrante del riassunto.
|
||||||
|
- Il goal, una volta stabilito, "non è più in discussione" e viene tradotto in regole verificabili; i resoconti valutano, non riaprono le decisioni.
|
||||||
|
- Suckless = disciplina, non moda: patch solo per problemi reali, diff spiegabile riga per riga; FreeBSD va usato, non combattuto (rc(8), jail, pf; UFS+snapshot salvo necessità provata di ZFS).
|
||||||
|
- Scrivere C reale (filtri stdin→stdout, demoni semplici, tool di ispezione) per costruire il sistema, non solo configurarlo; documentare come se si dovesse rifare tutto da zero.
|
||||||
|
|
||||||
|
## Progetti in corso (stato e contesto)
|
||||||
|
|
||||||
|
- Progetti/tematiche sviluppate con ChatGPT (iniziative strutturate trattate come progetti):
|
||||||
|
- Setup multi-macchina: `deadalus` workstation di lavoro, `ikaros` desktop personale (Void + i3/XFCE), `nymph` laptop T480, `prometheus` server Raspberry Pi.
|
||||||
|
- Installazione automatizzata Void Linux: EFI + `/boot` + LUKS2 + LVM, split root/home, utente + runit + NetworkManager; poi conversione in Ansible (idempotenza, gestione pacchetti, deploy dotfiles tipo Rofi).
|
||||||
|
- Automazione Fedora/AlmaLinux con Kickstart (problemi Flatpak, confronto con Ubuntu Autoinstall); script installazione Debian (btrfs + encryption).
|
||||||
|
- Dotfiles & desktop: i3 "XFCE-lite" (tray, PipeWire, keyring via PAM, xdg-desktop-portal); tema grafico completo (Yaru dark, Rofi, Dunst, Alacritty deep black, i3bar/i3blocks).
|
||||||
|
- Contesto building dei sistemi operativi (AGENTS.md tematico), integrando il playbook fatto con Codex.
|
||||||
|
- `infra` (github.com/fscotto/infra): playbook sviluppato con Codex, con proprio `AGENTS.md`; per il contesto va letto l'AGENTS.md più che il README.
|
||||||
|
- Contesto per agenti AI, evoluzione: prima `AGENTS.md` per ogni progetto nato su ChatGPT; poi, essendo l'agente locale **opencode** (non Codex), ristrutturato per lui: file markdown in `~/.config/opencode`, letti automaticamente come memoria dell'agente; distribuiti via `opencode_full_context.zip`.
|
||||||
|
- Struttura del contesto: `bootstrap.md` (sempre caricato) + `knowledge/` (os_setup, infra, architecture, desktop, dotfiles, cli, emacs, system_programming, kernel, server, philosophy) + `rules/` (safety, ansible, dotfiles, workflow) + `patterns/` (ansible_role, dotfiles_layering, service_setup, project_structure).
|
||||||
|
- Semantica: `knowledge/` = cosa è vero nel sistema; `rules/` = cosa l'agente non deve rompere; `patterns/` = come si fanno le cose; uso: sempre `bootstrap.md` + `rules/safety.md`, poi i file per task (es. infra → `knowledge/infra.md` + `rules/ansible.md`); un file riassuntivo per ogni argomento, coerente con le ultime scelte fatte.
|
||||||
|
- `rules/safety.md` (salvaguardia infra): mai rompere un host esistente; identificare host e layer (common/OS/profile/host); idempotenza, no duplicazioni, modifiche minime; vietata logica host-specifica in role condivise, pacchetti senza giustificazione, shell dove esiste un modulo Ansible; aree a rischio: display manager, PAM, networking, GPU/driver, boot; validazione: dry-run `--check --diff` e `--limit` su un singolo host prima di estendere.
|
||||||
|
- Salto concettuale dichiarato: da "documentazione" a **contesto persistente strutturato per agenti** ("sistema operativo per agenti"), un framework operativo personale.
|
||||||
|
- Stato del progetto FreeBSD (checkpoint finale): obiettivo chiaro e stabile; separazione core/user environment **chiusa e formalizzata**; core system completo e corretto (Xorg come infrastruttura, dwm/dmenu/st compilati manualmente, drm-kmod, nessuna configurazione personale in `/etc`, nessun tool di workflow nel core); user environment maturo (bash, vim, tmux, git con delta+meld come compromessi dichiarati, stow, lf, feh, sfeed, isync; compromessi confinati); workflow/git/shell/editor stabili, nessuna deriva "comfort-first".
|
||||||
|
|
||||||
|
## Memoria delle conversazioni (conclusioni sull'export ChatGPT)
|
||||||
|
|
||||||
|
- Export ufficiale OpenAI: Impostazioni → Controlli dati → Esporta dati → ZIP spedito via email/SMS; può richiedere fino a 7 giorni, link valido 24 ore.
|
||||||
|
- Contenuto: cronologia delle conversazioni in `conversations.json` (o più JSON numerati) più eventuali file/risorse associati.
|
||||||
|
- Limiti: è un backup dell'account, non un export/import strutturato dei Progetti; reimportare `conversations.json` non ricrea chat e sidebar; memorie, GPT e impostazioni non vengono trasferiti.
|
||||||
|
- Conclusione adottata: trasformare l'export in un archivio **Markdown/Org per progetto** (es. `chatgpt-archive/projects/fsnap/*.org`), versionato sotto Git e ricercabile con grep/ripgrep, invece di dipendere dall'interfaccia di ChatGPT — coerente con il workflow Emacs/Org.
|
||||||
|
- Esito: da questa conclusione nasce il sistema di memoria attuale — transcript completi + knowledge distillata in `~/.config/ai/memory/chatgpt/` tramite `scripts/chatgpt_export_to_memory.py` + distillazione AI — che rende il contesto delle conversazioni disponibile ai coding agent.
|
||||||
|
|
||||||
|
## Thread aperti
|
||||||
|
|
||||||
|
- FreeBSD: toolchain di sistema da dichiarare (`clang`, `make`, `lldb`) e uso esplicito degli strumenti BSD (`ktrace`, `truss`, `dtrace`); mancano 2-3 piccoli programmi C per studiare/interagire/misurare il sistema.
|
||||||
|
- FreeBSD: policy su servizi e runtime non ancora scritta ("chiusura concettuale" mancante, anche solo mentale).
|
||||||
|
- opencode: estensioni proposte e non ancora realizzate — `rules/infra_strict.md`, `patterns/validation.md` (checklist di test sempre), `knowledge/decisions.md` (registro delle motivazioni delle scelte, "oro puro nel tempo").
|
||||||
|
- Mail: `.muttrc` pronto per Gmail con GNOME Keyring offerto ma non ancora generato.
|
||||||
|
- Dopo il ritorno su Emacs/X11/Mint: tre prossimi passi rimasti in sospeso (Emacs "core" minimale; Org-mode come knowledge base tecnica + sync pCloud; audit di cosa tenere/buttare/sostituire rispetto al setup precedente).
|
||||||
|
|
||||||
|
## Fonti
|
||||||
|
| Data | Conversazione | Transcript |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| 2025-07-19 → 2026-05-16 | Workflow sviluppo UNIX | [2025-07-19-workflow-sviluppo-unix.md](transcripts/2025-07-19-workflow-sviluppo-unix.md) |
|
||||||
|
| 2025-08-05 → 2025-08-13 | Vantaggi di NeoMutt | [2025-08-05-vantaggi-di-neomutt.md](transcripts/2025-08-05-vantaggi-di-neomutt.md) |
|
||||||
|
| 2025-09-18 | Rendere email più formale | [2025-09-18-rendere-email-piu-formale.md](transcripts/2025-09-18-rendere-email-piu-formale.md) |
|
||||||
|
| 2026-01-27 → 2026-02-03 | Suggerimenti per un goal | [2026-01-27-suggerimenti-per-un-goal.md](transcripts/2026-01-27-suggerimenti-per-un-goal.md) |
|
||||||
|
| 2026-03-31 → 2026-04-03 | Progetti sviluppati insieme | [2026-03-31-progetti-sviluppati-insieme.md](transcripts/2026-03-31-progetti-sviluppati-insieme.md) |
|
||||||
|
| 2026-09-01 | Esportare Progetti E Chat | [2026-09-01-esportare-progetti-e-chat.md](transcripts/2026-09-01-esportare-progetti-e-chat.md) |
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,397 @@
|
|||||||
|
---
|
||||||
|
conversation_id: "6866c486-7300-800c-be99-ac3501bf5b77"
|
||||||
|
title: "Linux Kernel Development"
|
||||||
|
created: 2025-07-03
|
||||||
|
updated: 2026-05-16
|
||||||
|
model: "auto"
|
||||||
|
messages: 8
|
||||||
|
---
|
||||||
|
|
||||||
|
# Linux Kernel Development
|
||||||
|
|
||||||
|
## Utente — 2025-07-03 19:57
|
||||||
|
|
||||||
|
Il libro Linux Kernel Development di Robert Love quanto è utile per imparare lo sviluppo kernel?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-03 19:57
|
||||||
|
|
||||||
|
Il libro **"Linux Kernel Development" di Robert Love** è **stato uno dei testi di riferimento per imparare lo sviluppo del kernel Linux**, ma con alcune **importanti precisazioni**:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Punti di forza del libro:**
|
||||||
|
1. **Chiarezza espositiva**: Robert Love ha uno stile molto chiaro e accessibile, anche per chi non ha mai toccato codice kernel.
|
||||||
|
2. **Struttura ben organizzata**: il libro introduce gradualmente i concetti fondamentali dello sviluppo kernel (gestione dei processi, scheduling, interrupt, sincronizzazione, memoria, file system, ecc.).
|
||||||
|
3. **Buona introduzione pratica**: spiega come compilare il kernel, aggiungere moduli e interagire con il sistema.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ⚠️ **Limiti (soprattutto nel 2025):**
|
||||||
|
1. **Non è aggiornato**: l'ultima edizione (terza, 2010) è basata su un kernel **2.6.x**, mentre oggi siamo al kernel **6.x**.
|
||||||
|
- Molte API sono cambiate o deprecate.
|
||||||
|
- Le architetture multiprocessore, il model threading, i meccanismi di sicurezza e le interfacce sono molto più complessi ora.
|
||||||
|
2. **Non tratta le novità recenti**: come il sistema di build `KBuild`, eBPF, cgroup v2, nuove architetture ARM64, Rust nel kernel, ecc.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🎯 **Quando è ancora utile nel 2025?**
|
||||||
|
- Se **sei alle prime armi** con lo sviluppo kernel e vuoi **capire le basi**: è un'ottima introduzione.
|
||||||
|
- Se ti interessa una **visione concettuale** del funzionamento del kernel, anche se con esempi datati.
|
||||||
|
- Se vuoi un **ponte tra la programmazione di sistema in C e lo sviluppo kernel**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🔁 Cosa leggere dopo / al posto di Robert Love:
|
||||||
|
1. **"Linux Kernel Programming" di Kaiwan N Billimoria** (seconda edizione, 2022) – molto più aggiornato, tratta il kernel 5.x.
|
||||||
|
2. **"Linux Device Drivers" (terza edizione)** di Rubini & Corbet – anch'esso un po’ datato (2.6), ma ottimo per comprendere il modello driver.
|
||||||
|
3. **La documentazione ufficiale del kernel** (`https://docs.kernel.org`) – fondamentale per lavorare con versioni moderne.
|
||||||
|
4. **Sorgenti del kernel** (github.com/torvalds/linux): leggere e sperimentare direttamente è insostituibile.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ Conclusione:
|
||||||
|
**"Linux Kernel Development" è ancora utile come introduzione teorica e pratica**, ma **va integrato con materiale aggiornato**. Pensalo come **un primo gradino** in un percorso più lungo e tecnico. Se già hai basi solide in C e programmazione di sistema, potresti trarne meno beneficio rispetto a chi parte da zero.
|
||||||
|
|
||||||
|
Se vuoi, posso aiutarti a costruire un piano di studio più moderno e progressivo per imparare lo sviluppo kernel partendo da dove sei ora.
|
||||||
|
|
||||||
|
## Utente — 2025-07-03 19:59
|
||||||
|
|
||||||
|
Quale è il libro considerato migliore per lo sviluppo kernel?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-03 19:59
|
||||||
|
|
||||||
|
Nel 2025 **non esiste un singolo libro “migliore” universalmente riconosciuto** per lo sviluppo del kernel Linux, perché:
|
||||||
|
|
||||||
|
- lo **sviluppo del kernel è un campo molto vasto** (scheduler, memory management, networking, device drivers, sicurezza, architettura hardware…);
|
||||||
|
- la **documentazione ufficiale e i sorgenti stessi** del kernel sono spesso la fonte primaria per i professionisti.
|
||||||
|
|
||||||
|
Tuttavia, ecco i **libri più autorevoli e consigliati** oggi, con una breve descrizione dei punti di forza:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🔵 **1. _Linux Kernel Programming_ – Kaiwan N Billimoria (Seconda edizione, 2022)**
|
||||||
|
**✅ Il più moderno e pratico tra i libri generici.**
|
||||||
|
|
||||||
|
- Basato su kernel 5.x (più vicino ai 6.x attuali).
|
||||||
|
- Copre lo sviluppo di moduli, gestione memoria, processi, interrupt, ecc.
|
||||||
|
- Include esempi e mini-progetti hands-on.
|
||||||
|
- Spiega il sistema di build (`KBuild`) e il debugging con `ftrace`, `gdb`, ecc.
|
||||||
|
|
||||||
|
**Ideale per:** chi vuole iniziare seriamente con una base aggiornata e pratica.
|
||||||
|
|
||||||
|
📘 **Valutazione**: ⭐⭐⭐⭐½
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🔵 **2. _Understanding the Linux Kernel_ – Bovet & Cesati (terza edizione, 2005)**
|
||||||
|
**✅ Ottimo per la teoria approfondita.**
|
||||||
|
|
||||||
|
- Analizza in dettaglio il funzionamento interno del kernel.
|
||||||
|
- Basato su kernel 2.6, ma con molte sezioni ancora valide sul piano teorico (scheduler, memoria virtuale, VFS, ecc.).
|
||||||
|
- Non è pensato per scrivere codice kernel, ma per **capirne la logica interna**.
|
||||||
|
|
||||||
|
**Ideale per:** chi vuole capire come funziona il kernel "sotto il cofano", più che scrivere moduli.
|
||||||
|
|
||||||
|
📘 **Valutazione**: ⭐⭐⭐⭐
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🔵 **3. _Linux Device Drivers_ – Rubini, Corbet, et al. (terza edizione, 2005)**
|
||||||
|
**✅ Il riferimento storico per scrivere driver.**
|
||||||
|
|
||||||
|
- Incentrato sui device driver, modulo fondamentale dello sviluppo kernel.
|
||||||
|
- Basato su kernel 2.6 – molti concetti sono ancora validi, ma richiede confronto con la documentazione attuale.
|
||||||
|
- Il codice va adattato alle moderne API.
|
||||||
|
|
||||||
|
**Ideale per:** chi vuole scrivere driver e interfacciarsi con l’hardware.
|
||||||
|
|
||||||
|
📘 **Valutazione**: ⭐⭐⭐½ (perché datato)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🔵 **4. _Linux Kernel Development_ – Robert Love (2010)**
|
||||||
|
**✅ Introduttivo e ben scritto, ma obsoleto.**
|
||||||
|
|
||||||
|
- Ottimo come primo libro, ma non sufficiente da solo per sviluppare sul kernel moderno.
|
||||||
|
|
||||||
|
📘 **Valutazione**: ⭐⭐⭐ (buono come inizio)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🟢 **Fonti alternative imprescindibili:**
|
||||||
|
|
||||||
|
- 🧾 **[docs.kernel.org](https://docs.kernel.org/)** – documentazione ufficiale (aggiornata e curata).
|
||||||
|
- 🧑💻 **Il codice sorgente del kernel** (https://github.com/torvalds/linux).
|
||||||
|
- 🧵 **Mailing list LKML, commit log e patchset** – essenziali per seguire l'evoluzione del kernel.
|
||||||
|
- 🎥 Corsi (es. Linux Foundation: *Developing Linux Device Drivers*, *Linux Kernel Internals*).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Conclusione**
|
||||||
|
> Se dovessimo sceglierne **uno solo oggi nel 2025**, il **migliore punto di partenza pratico è _Linux Kernel Programming_ di Kaiwan N Billimoria** (seconda edizione).
|
||||||
|
|
||||||
|
Poi, per una comprensione più profonda o mirata:
|
||||||
|
- _Understanding the Linux Kernel_ per la teoria.
|
||||||
|
- _Linux Device Drivers_ + docs.kernel.org per chi vuole scrivere driver.
|
||||||
|
|
||||||
|
Se vuoi, posso aiutarti a strutturare un percorso combinando questi testi con esempi pratici. Vuoi qualcosa di progressivo per lo studio?
|
||||||
|
|
||||||
|
## Utente — 2025-07-03 20:05
|
||||||
|
|
||||||
|
Se volessi partire con lo sviluppo di moduli kernel dopo aver letto Linux System Programming
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-03 20:05
|
||||||
|
|
||||||
|
Ottimo! Se hai già letto (o stai leggendo) **_Linux System Programming_**, hai un’ottima base di:
|
||||||
|
|
||||||
|
- programmazione in C a basso livello,
|
||||||
|
- interazione con syscalls e il sistema operativo,
|
||||||
|
- concetti come file descriptor, memoria, segnali, thread e processi.
|
||||||
|
|
||||||
|
Da qui, passare allo **sviluppo di moduli del kernel Linux** è **un passo naturale**, ma richiede un cambio di paradigma: **non c'è più libc, non c'è `printf`, sei “dentro” il kernel**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 **Percorso consigliato per iniziare con i moduli kernel**
|
||||||
|
|
||||||
|
### 🧱 **Prerequisiti**
|
||||||
|
Assicurati di avere:
|
||||||
|
- Buona padronanza del C (strutture, puntatori, macro, pre-processore).
|
||||||
|
- Una distribuzione Linux con:
|
||||||
|
- un kernel compatibile (idealmente 5.x o 6.x),
|
||||||
|
- headers del kernel installati (`linux-headers-$(uname -r)`),
|
||||||
|
- strumenti come `make`, `gcc`, `insmod`, `rmmod`, `dmesg`.
|
||||||
|
|
||||||
|
> 👉 Evita di fare test sul tuo sistema principale: lavora in una **VM** (es. con VirtualBox + Debian/Ubuntu) o in un **ambiente Docker con privilegi**, oppure con **QEMU** se vuoi fare emulazione avanzata.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📘 **Fase 1: Leggere / consultare un libro moderno**
|
||||||
|
|
||||||
|
🔹 **Consigliato**:
|
||||||
|
📗 _Linux Kernel Programming_ – Kaiwan N. Billimoria (2022)
|
||||||
|
- Capitoli 2–5: introduzione, moduli, debug, logging, kernel symbols.
|
||||||
|
- Ottimo equilibrio tra teoria e codice.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✍️ **Fase 2: Scrivere il primo modulo**
|
||||||
|
|
||||||
|
Un modulo semplice:
|
||||||
|
|
||||||
|
```c
|
||||||
|
#include <linux/init.h>
|
||||||
|
#include <linux/module.h>
|
||||||
|
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
|
MODULE_AUTHOR("Tuonome");
|
||||||
|
MODULE_DESCRIPTION("Un semplice modulo kernel di esempio");
|
||||||
|
|
||||||
|
static int __init my_module_init(void) {
|
||||||
|
pr_info("Ciao dal modulo kernel!\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void __exit my_module_exit(void) {
|
||||||
|
pr_info("Addio dal modulo kernel!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
module_init(my_module_init);
|
||||||
|
module_exit(my_module_exit);
|
||||||
|
```
|
||||||
|
|
||||||
|
Makefile:
|
||||||
|
|
||||||
|
```make
|
||||||
|
obj-m += mymodule.o
|
||||||
|
|
||||||
|
all:
|
||||||
|
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules
|
||||||
|
|
||||||
|
clean:
|
||||||
|
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
|
||||||
|
```
|
||||||
|
|
||||||
|
Comandi:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make
|
||||||
|
sudo insmod mymodule.ko
|
||||||
|
dmesg | tail
|
||||||
|
sudo rmmod mymodule
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧪 **Fase 3: Approfondimenti**
|
||||||
|
|
||||||
|
🔧 Impara a:
|
||||||
|
- Leggere e usare `dmesg`, `ftrace`, `kprobes`, `perf`.
|
||||||
|
- Scrivere moduli con parametri (`module_param()`).
|
||||||
|
- Esportare simboli (`EXPORT_SYMBOL()`).
|
||||||
|
- Interagire con il file system (`procfs`, `sysfs`).
|
||||||
|
- Gestire sincronizzazione (`spinlock`, `mutex`, `semaphore`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 **Risorse consigliate**
|
||||||
|
|
||||||
|
| Obiettivo | Risorsa |
|
||||||
|
|----------|---------|
|
||||||
|
| Capire le basi del kernel moderno | _Linux Kernel Programming_ (Billimoria) |
|
||||||
|
| Guida aggiornata e ufficiale | [docs.kernel.org](https://docs.kernel.org/) |
|
||||||
|
| Esempi pratici moderni | [The Linux Kernel Module Programming Guide (modern fork)](https://sysprog21.github.io/lkmpg/) |
|
||||||
|
| Imparare dai sorgenti | [torvalds/linux on GitHub](https://github.com/torvalds/linux) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧭 **Suggerimento di percorso pratico**
|
||||||
|
1. Scrivi 2–3 moduli “hello world” con vari parametri.
|
||||||
|
2. Esponi dati via `/proc` o `/sys`.
|
||||||
|
3. Crea un modulo che registra un handler IRQ fittizio.
|
||||||
|
4. Scrivi un modulo che alloca memoria e la gestisce.
|
||||||
|
5. Prova a interagire con moduli già caricati (dipendenze, simboli).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Conclusione
|
||||||
|
|
||||||
|
Con **_Linux System Programming_** alle spalle, sei pronto a partire con lo sviluppo di moduli kernel. Inizia con piccoli esercizi, **lavora sempre in un ambiente sicuro (VM o emulazione)** e impara leggendo il codice sorgente del kernel.
|
||||||
|
|
||||||
|
Se vuoi ti posso preparare un **mini-percorso pratico in 4–6 tappe**, con esercizi progressivi. Ti interessa?
|
||||||
|
|
||||||
|
## Utente — 2025-07-03 20:09
|
||||||
|
|
||||||
|
Sì grazie
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-03 20:09
|
||||||
|
|
||||||
|
Perfetto! Ecco un **mini-percorso pratico in 6 tappe** per iniziare a scrivere **moduli kernel Linux**, pensato come naturale prosecuzione a ciò che hai imparato in *Linux System Programming*. Ogni tappa introduce concetti fondamentali, con esercizi reali da implementare.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧭 **Percorso pratico – Moduli Kernel Linux**
|
||||||
|
|
||||||
|
### 🔧 **Ambiente consigliato**
|
||||||
|
- **Linux (VM)** con kernel ≥ 5.x
|
||||||
|
- Installati:
|
||||||
|
```bash
|
||||||
|
sudo apt install build-essential linux-headers-$(uname -r)
|
||||||
|
```
|
||||||
|
- Una directory di lavoro dedicata con un file `Makefile` come visto prima.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Tappa 1: Hello Kernel!**
|
||||||
|
|
||||||
|
**Obiettivo**: Scrivere il primo modulo, caricarlo, scaricarlo, esaminare `dmesg`.
|
||||||
|
|
||||||
|
🛠️ Cosa fare:
|
||||||
|
- Crea un modulo che stampa un messaggio all’inserimento (`insmod`) e all’eliminazione (`rmmod`).
|
||||||
|
- Usa `pr_info()` e `pr_alert()` per variare i livelli di log.
|
||||||
|
- Leggi l'output con `dmesg | tail`.
|
||||||
|
|
||||||
|
🎯 Concetti:
|
||||||
|
- `module_init`, `module_exit`, `MODULE_LICENSE`.
|
||||||
|
- Logging con `pr_*`.
|
||||||
|
- Comandi base: `insmod`, `rmmod`, `dmesg`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Tappa 2: Parametri del modulo**
|
||||||
|
|
||||||
|
**Obiettivo**: Passare valori al modulo da `insmod`.
|
||||||
|
|
||||||
|
🛠️ Cosa fare:
|
||||||
|
- Aggiungi un parametro intero (`int`) e una stringa (`charp`) al modulo.
|
||||||
|
- Stampa il valore nei log quando il modulo viene caricato.
|
||||||
|
|
||||||
|
```c
|
||||||
|
module_param(myint, int, 0);
|
||||||
|
module_param(mystr, charp, 000);
|
||||||
|
```
|
||||||
|
|
||||||
|
🎯 Concetti:
|
||||||
|
- `module_param`, tipi e permessi.
|
||||||
|
- Interazione tra spazio utente e kernel in fase di caricamento.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Tappa 3: Procfs o Sysfs – Esponi dati al sistema**
|
||||||
|
|
||||||
|
**Obiettivo**: Fare in modo che il modulo **esponga dati leggibili dall’utente** via `/proc` o `/sys`.
|
||||||
|
|
||||||
|
🛠️ Cosa fare:
|
||||||
|
- Crea una voce in `/proc/my_module` che stampa un contatore o un messaggio.
|
||||||
|
|
||||||
|
🎯 Concetti:
|
||||||
|
- `proc_create()`, `proc_remove()`, `seq_file`.
|
||||||
|
- Comunicazione kernel ↔ userspace.
|
||||||
|
|
||||||
|
📌 Extra: prova anche con `sysfs` (`kobject_create_and_add` e `sysfs_create_file`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Tappa 4: Gestione memoria kernel**
|
||||||
|
|
||||||
|
**Obiettivo**: Allocare e liberare memoria nel modulo.
|
||||||
|
|
||||||
|
🛠️ Cosa fare:
|
||||||
|
- Alloca un array dinamico con `kmalloc()`.
|
||||||
|
- Inizializzalo in `init`, liberalo in `exit`.
|
||||||
|
|
||||||
|
🎯 Concetti:
|
||||||
|
- `kmalloc`, `kfree`, `GFP_KERNEL`.
|
||||||
|
- Gestione sicura della memoria nel kernel.
|
||||||
|
|
||||||
|
📌 Extra: stampa l’indirizzo della memoria con `pr_info("%px", ptr);`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Tappa 5: Sincronizzazione nel kernel**
|
||||||
|
|
||||||
|
**Obiettivo**: Usare un meccanismo di sincronizzazione semplice.
|
||||||
|
|
||||||
|
🛠️ Cosa fare:
|
||||||
|
- Crea un modulo che ha un contatore protetto da un `spinlock` o `mutex`.
|
||||||
|
- Fai accedere più volte (simulando) da thread kernel o workqueue.
|
||||||
|
|
||||||
|
🎯 Concetti:
|
||||||
|
- `DEFINE_SPINLOCK`, `spin_lock`, `spin_unlock`.
|
||||||
|
- `mutex_init`, `mutex_lock`, `mutex_unlock`.
|
||||||
|
|
||||||
|
📌 Extra: guarda anche `atomic_t` e `atomic_inc()` per contatori semplici.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ **Tappa 6: Creare un task kernel o workqueue**
|
||||||
|
|
||||||
|
**Obiettivo**: Fare qualcosa di asincrono nel modulo.
|
||||||
|
|
||||||
|
🛠️ Cosa fare:
|
||||||
|
- Usa `kthread_run()` per creare un thread nel kernel che stampa periodicamente un messaggio.
|
||||||
|
- In alternativa, usa una **workqueue** (`queue_work`) per simulare un task ritardato.
|
||||||
|
|
||||||
|
🎯 Concetti:
|
||||||
|
- Thread kernel (`kthread_create`, `kthread_run`, `kthread_stop`).
|
||||||
|
- `schedule_timeout`, `msleep`.
|
||||||
|
|
||||||
|
📌 Extra: aggiungi un parametro per fermare il thread dopo un certo numero di esecuzioni.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧩 **Bonus: Idee per esercizi extra**
|
||||||
|
- Crea un modulo che tiene traccia del numero di chiamate a `open()` su un file usando `kprobes`.
|
||||||
|
- Crea un modulo che registra un handler di interrupt software (`request_irq()` con un IRQ fittizio o simulato).
|
||||||
|
- Scrivi un modulo che logga eventi quando un file viene creato o cancellato in una directory.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📚 Risorse rapide da consultare
|
||||||
|
- [https://docs.kernel.org/](https://docs.kernel.org/)
|
||||||
|
- [Linux Kernel Module Programming Guide (aggiornata)](https://sysprog21.github.io/lkmpg/)
|
||||||
|
- [Kaiwan’s GitHub – esempi kernel](https://github.com/kaiwan/linux-kernel-programming-examples)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Se vuoi, posso seguirti **tappa per tappa**: mi dici su quale vuoi iniziare e ti do un esercizio più dettagliato con codice ed estensioni!
|
||||||
@@ -0,0 +1,494 @@
|
|||||||
|
---
|
||||||
|
conversation_id: "686d38ec-32c4-800c-a985-c33dd4b44161"
|
||||||
|
title: "Elevazione privilegi con script"
|
||||||
|
created: 2025-07-08
|
||||||
|
updated: 2025-07-08
|
||||||
|
model: "auto"
|
||||||
|
messages: 10
|
||||||
|
---
|
||||||
|
|
||||||
|
# Elevazione privilegi con script
|
||||||
|
|
||||||
|
## Utente — 2025-07-08 17:28
|
||||||
|
|
||||||
|
Modifica lo script in modo che dopo elevati i permessi esegue lo script in automatico
|
||||||
|
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "$SCRIPT_DIR/../lib/logging.sh"
|
||||||
|
|
||||||
|
# Auto elevate to root if needed
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
info "Elevating privileges with sudo..."
|
||||||
|
exec sudo "$0" "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PLYMOUTH_THEME="bgrt"
|
||||||
|
|
||||||
|
info "Installing and configuring Plymouth theme..."
|
||||||
|
|
||||||
|
# Function to detect initramfs tool: mkinitcpio or dracut
|
||||||
|
detect_initramfs_tool() {
|
||||||
|
if [[ -f /etc/mkinitcpio.conf ]]; then
|
||||||
|
echo "mkinitcpio"
|
||||||
|
elif [[ -f /etc/dracut.conf || -d /usr/lib/dracut/modules.d ]]; then
|
||||||
|
echo "dracut"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
initramfs_tool=$(detect_initramfs_tool)
|
||||||
|
if [[ -z "$initramfs_tool" ]]; then
|
||||||
|
error "Could not detect initramfs tool (mkinitcpio or dracut). Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install Plymouth if missing
|
||||||
|
if yay -Qi plymouth &>/dev/null; then
|
||||||
|
info "Plymouth is already installed"
|
||||||
|
else
|
||||||
|
info "Installing Plymouth"
|
||||||
|
yay -S --noconfirm plymouth >>"$LOG_FILE" 2>&1 && success "Plymouth installed" || {
|
||||||
|
error "Failed to install Plymouth"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install Plymouth theme if missing
|
||||||
|
if yay -Qi "plymouth-theme-$PLYMOUTH_THEME" &>/dev/null; then
|
||||||
|
info "Plymouth theme '$PLYMOUTH_THEME' is already installed"
|
||||||
|
else
|
||||||
|
info "Installing Plymouth theme '$PLYMOUTH_THEME'"
|
||||||
|
yay -S --noconfirm "plymouth-theme-$PLYMOUTH_THEME" >>"$LOG_FILE" 2>&1 && success "Theme '$PLYMOUTH_THEME' installed" || warn "Failed to install theme '$PLYMOUTH_THEME'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Plymouth theme in configuration file
|
||||||
|
if grep -q "^Theme=" /etc/plymouth/plymouthd.conf 2>/dev/null; then
|
||||||
|
sed -i "s/^Theme=.*/Theme=$PLYMOUTH_THEME/" /etc/plymouth/plymouthd.conf
|
||||||
|
else
|
||||||
|
echo "Theme=$PLYMOUTH_THEME" >>/etc/plymouth/plymouthd.conf
|
||||||
|
fi
|
||||||
|
success "Set Plymouth theme to '$PLYMOUTH_THEME'"
|
||||||
|
|
||||||
|
if [[ "$initramfs_tool" == "mkinitcpio" ]]; then
|
||||||
|
# Add plymouth hook to mkinitcpio.conf if not present
|
||||||
|
if ! grep -q plymouth /etc/mkinitcpio.conf; then
|
||||||
|
info "Adding 'plymouth' hook to mkinitcpio.conf"
|
||||||
|
sudo sed -i 's/^\(HOOKS=.*\)/\1 plymouth/' /etc/mkinitcpio.conf
|
||||||
|
info "Regenerating initramfs with mkinitcpio"
|
||||||
|
mkinitcpio -P >>"$LOG_FILE" 2>&1 && success "Updated mkinitcpio with 'plymouth' hook" || warn "Failed to regenerate initramfs"
|
||||||
|
else
|
||||||
|
info "'plymouth' hook already present in mkinitcpio.conf"
|
||||||
|
fi
|
||||||
|
elif [[ "$initramfs_tool" == "dracut" ]]; then
|
||||||
|
# Add plymouth module to dracut config if not present
|
||||||
|
if ! grep -q "plymouth" /etc/dracut.conf 2>/dev/null; then
|
||||||
|
info "Adding 'plymouth' to dracut modules in /etc/dracut.conf"
|
||||||
|
echo 'add_dracutmodules+=" plymouth "' >>/etc/dracut.conf
|
||||||
|
else
|
||||||
|
info "'plymouth' module already enabled in dracut config"
|
||||||
|
fi
|
||||||
|
info "Regenerating initramfs with dracut"
|
||||||
|
dracut --force --kver "$(uname -r)" >>"$LOG_FILE" 2>&1 && success "Updated dracut initramfs with 'plymouth' module" || warn "Failed to regenerate dracut initramfs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
success "Plymouth setup completed"
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-08 17:28
|
||||||
|
|
||||||
|
Puoi modificare lo script in questo modo per fare in modo che, **dopo l’elevazione dei privilegi**, venga **eseguito automaticamente senza uscire**. L’unica modifica necessaria è nell’uso di `sudo` per reinvocare lo script: bisogna usare `exec sudo bash "$0"` per garantire che venga rieseguito con lo stesso interprete (`bash`), utile quando lo script è lanciato con `./script.sh` ma senza il bit eseguibile o senza il corretto shebang.
|
||||||
|
|
||||||
|
Ecco la versione modificata (modifica principale commentata):
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
source "$SCRIPT_DIR/../lib/logging.sh"
|
||||||
|
|
||||||
|
# Auto elevate to root if needed
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
info "Elevating privileges with sudo..."
|
||||||
|
exec sudo bash "$0" "$@" # <--- modificato per reinvocare correttamente lo script
|
||||||
|
fi
|
||||||
|
|
||||||
|
PLYMOUTH_THEME="bgrt"
|
||||||
|
|
||||||
|
info "Installing and configuring Plymouth theme..."
|
||||||
|
|
||||||
|
# Function to detect initramfs tool: mkinitcpio or dracut
|
||||||
|
detect_initramfs_tool() {
|
||||||
|
if [[ -f /etc/mkinitcpio.conf ]]; then
|
||||||
|
echo "mkinitcpio"
|
||||||
|
elif [[ -f /etc/dracut.conf || -d /usr/lib/dracut/modules.d ]]; then
|
||||||
|
echo "dracut"
|
||||||
|
else
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
initramfs_tool=$(detect_initramfs_tool)
|
||||||
|
if [[ -z "$initramfs_tool" ]]; then
|
||||||
|
error "Could not detect initramfs tool (mkinitcpio or dracut). Exiting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install Plymouth if missing
|
||||||
|
if yay -Qi plymouth &>/dev/null; then
|
||||||
|
info "Plymouth is already installed"
|
||||||
|
else
|
||||||
|
info "Installing Plymouth"
|
||||||
|
yay -S --noconfirm plymouth >>"$LOG_FILE" 2>&1 && success "Plymouth installed" || {
|
||||||
|
error "Failed to install Plymouth"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Install Plymouth theme if missing
|
||||||
|
if yay -Qi "plymouth-theme-$PLYMOUTH_THEME" &>/dev/null; then
|
||||||
|
info "Plymouth theme '$PLYMOUTH_THEME' is already installed"
|
||||||
|
else
|
||||||
|
info "Installing Plymouth theme '$PLYMOUTH_THEME'"
|
||||||
|
yay -S --noconfirm "plymouth-theme-$PLYMOUTH_THEME" >>"$LOG_FILE" 2>&1 && success "Theme '$PLYMOUTH_THEME' installed" || warn "Failed to install theme '$PLYMOUTH_THEME'"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set Plymouth theme in configuration file
|
||||||
|
if grep -q "^Theme=" /etc/plymouth/plymouthd.conf 2>/dev/null; then
|
||||||
|
sed -i "s/^Theme=.*/Theme=$PLYMOUTH_THEME/" /etc/plymouth/plymouthd.conf
|
||||||
|
else
|
||||||
|
echo "Theme=$PLYMOUTH_THEME" >>/etc/plymouth/plymouthd.conf
|
||||||
|
fi
|
||||||
|
success "Set Plymouth theme to '$PLYMOUTH_THEME'"
|
||||||
|
|
||||||
|
if [[ "$initramfs_tool" == "mkinitcpio" ]]; then
|
||||||
|
# Add plymouth hook to mkinitcpio.conf if not present
|
||||||
|
if ! grep -q plymouth /etc/mkinitcpio.conf; then
|
||||||
|
info "Adding 'plymouth' hook to mkinitcpio.conf"
|
||||||
|
sudo sed -i 's/^\(HOOKS=.*\)/\1 plymouth/' /etc/mkinitcpio.conf
|
||||||
|
info "Regenerating initramfs with mkinitcpio"
|
||||||
|
mkinitcpio -P >>"$LOG_FILE" 2>&1 && success "Updated mkinitcpio with 'plymouth' hook" || warn "Failed to regenerate initramfs"
|
||||||
|
else
|
||||||
|
info "'plymouth' hook already present in mkinitcpio.conf"
|
||||||
|
fi
|
||||||
|
elif [[ "$initramfs_tool" == "dracut" ]]; then
|
||||||
|
# Add plymouth module to dracut config if not present
|
||||||
|
if ! grep -q "plymouth" /etc/dracut.conf 2>/dev/null; then
|
||||||
|
info "Adding 'plymouth' to dracut modules in /etc/dracut.conf"
|
||||||
|
echo 'add_dracutmodules+=" plymouth "' >>/etc/dracut.conf
|
||||||
|
else
|
||||||
|
info "'plymouth' module already enabled in dracut config"
|
||||||
|
fi
|
||||||
|
info "Regenerating initramfs with dracut"
|
||||||
|
dracut --force --kver "$(uname -r)" >>"$LOG_FILE" 2>&1 && success "Updated dracut initramfs with 'plymouth' module" || warn "Failed to regenerate dracut initramfs"
|
||||||
|
fi
|
||||||
|
|
||||||
|
success "Plymouth setup completed"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Spiegazione della modifica:
|
||||||
|
```bash
|
||||||
|
exec sudo bash "$0" "$@"
|
||||||
|
```
|
||||||
|
- `exec` sostituisce il processo corrente (quindi lo script non continua da riga successiva dopo `sudo`);
|
||||||
|
- `bash "$0"` assicura che venga usato `bash` anche se lo script non ha il bit eseguibile o viene invocato con `sh`;
|
||||||
|
- `"$@"` passa tutti gli argomenti originali allo script.
|
||||||
|
|
||||||
|
Se preferisci che venga usato `env bash` per coerenza con lo shebang iniziale, puoi anche scrivere:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
exec sudo env bash "$0" "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
Fammi sapere se vuoi anche gestire il caso in cui `sudo` non è installato o l’utente lo rifiuta.
|
||||||
|
|
||||||
|
## Utente — 2025-07-08 17:41
|
||||||
|
|
||||||
|
eseguendo il comando in questa maniera viene eseguito nel processo corrente sostituendo la shell questo provoca la chiusura immediata dell'emulatore di terminale
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-08 17:41
|
||||||
|
|
||||||
|
Hai ragione: l’uso di `exec` sostituisce il processo corrente con quello dello script rieseguito come `sudo`, e **se lo script è avviato da un terminale grafico** (es. `gnome-terminal`, `konsole`, `xfce4-terminal`), questo può causare la **chiusura immediata del terminale** una volta che lo script termina.
|
||||||
|
|
||||||
|
### ✅ Soluzione corretta: **evitare `exec` e usare `sudo` normalmente**
|
||||||
|
|
||||||
|
Sostituisci questa parte:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
exec sudo bash "$0" "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
con:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo bash "$0" "$@"
|
||||||
|
exit $?
|
||||||
|
```
|
||||||
|
|
||||||
|
### Perché funziona meglio
|
||||||
|
|
||||||
|
- **`sudo bash "$0"`** lancia lo script in un nuovo processo figlio con privilegi elevati;
|
||||||
|
- **`exit $?`** termina lo script restituendo lo stesso codice di uscita del figlio (per trasparenza);
|
||||||
|
- Non si usa `exec`, quindi il terminale **rimane aperto** anche dopo la fine dello script.
|
||||||
|
|
||||||
|
### Codice aggiornato del blocco `if`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Auto elevate to root if needed
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
info "Elevating privileges with sudo..."
|
||||||
|
sudo bash "$0" "$@"
|
||||||
|
exit $?
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
### Se vuoi ancora più robustezza (es. fallback se `bash` non è disponibile sotto sudo), puoi usare:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo env "$0" "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
Ma nella maggior parte dei casi `sudo bash "$0"` va benissimo.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Fammi sapere se lo script potrebbe essere chiamato in contesti non interattivi (es. da cron, o da altre automazioni), e ti adatto il comportamento.
|
||||||
|
|
||||||
|
## Utente — 2025-07-08 21:36
|
||||||
|
|
||||||
|
Sudo env che shell userebbe?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-08 21:36
|
||||||
|
|
||||||
|
Ottima domanda.
|
||||||
|
|
||||||
|
### Comportamento di `sudo env "$0"`:
|
||||||
|
|
||||||
|
Quando esegui:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo env "$0" "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
- **`env`** esegue lo script **usando lo shebang** (`#!`) specificato all'inizio del file.
|
||||||
|
- Quindi la shell usata sarà **quella dichiarata nel tuo script** nella prima riga:
|
||||||
|
```bash
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
```
|
||||||
|
|
||||||
|
- In pratica:
|
||||||
|
- `env` cerca l'eseguibile `bash` nel `$PATH` dell'utente root (poiché stai usando `sudo`);
|
||||||
|
- quindi lo script sarà eseguito con **`bash` installato nel sistema, come root**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Differenza con `sudo bash "$0"`:
|
||||||
|
|
||||||
|
| Comando | Shell usata | Basata su |
|
||||||
|
|------------------------|------------------|-----------|
|
||||||
|
| `sudo bash "$0"` | `/bin/bash` o simile | percorso esplicito (`bash` trovato nel `$PATH` o alias) |
|
||||||
|
| `sudo env "$0"` | shebang (es. `env bash`) | esecuzione dinamica via `env`, rispetta lo shebang dello script |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Quando usare l’uno o l’altro?
|
||||||
|
|
||||||
|
- ✅ **`sudo env "$0"`**: più *portabile*, se vuoi che lo script venga eseguito sempre con la shell dichiarata nel `#!` (utile se il tuo script richiede specificamente `bash`, `zsh`, ecc.).
|
||||||
|
- ✅ **`sudo bash "$0"`**: più *controllato*, se vuoi essere certo che venga usato proprio `bash`, a prescindere dallo shebang.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Conclusione
|
||||||
|
|
||||||
|
Nel tuo caso, **`sudo env "$0" "$@"`** è perfettamente coerente con lo shebang:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
```
|
||||||
|
|
||||||
|
Quindi eseguirà il file usando `bash`, come root, e rispetterà la logica originale. Puoi tranquillamente usarlo come alternativa a `sudo bash "$0"` — specialmente se punti a maggiore compatibilità.
|
||||||
|
|
||||||
|
Fammi sapere se vuoi che testiamo il comportamento anche in ambienti più restrittivi (es. Alpine, BusyBox, WSL).
|
||||||
|
|
||||||
|
## Utente — 2025-07-08 21:37
|
||||||
|
|
||||||
|
Funzionerebbe anche se usassi sh?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-08 21:37
|
||||||
|
|
||||||
|
Sì, funziona **anche se usi `sh`** – ma con delle differenze importanti da tenere in considerazione.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ✅ Esempio con shebang `#!/bin/sh`:
|
||||||
|
|
||||||
|
Se il tuo script inizia così:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
```
|
||||||
|
|
||||||
|
E lo esegui con:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo env "$0" "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
allora:
|
||||||
|
|
||||||
|
- `env` legge il **shebang** e vede `/bin/sh`;
|
||||||
|
- `sudo` esegue lo script come **root**, usando `/bin/sh` come shell.
|
||||||
|
|
||||||
|
Quindi sì, **funzionerà**, *ma* sarà eseguito sotto `sh` (che è più limitato rispetto a `bash`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### ⚠️ Differenze tra `sh` e `bash`
|
||||||
|
|
||||||
|
Molte funzionalità usate comunemente in `bash` **non esistono in `sh`**, ad esempio:
|
||||||
|
|
||||||
|
| Funzionalità | Supporto in `bash` | Supporto in `sh` (POSIX) |
|
||||||
|
|-------------------------------|--------------------|---------------------------|
|
||||||
|
| `[[ ... ]]` test avanzato | ✅ | ❌ (solo `[ ... ]`) |
|
||||||
|
| `source` | ✅ | ❌ (`.` deve essere usato) |
|
||||||
|
| Array | ✅ | ❌ |
|
||||||
|
| `set -euo pipefail` | ✅ | Parziale / variabile |
|
||||||
|
| `$BASH_SOURCE` | ✅ | ❌ |
|
||||||
|
| `function fname { ... }` | ✅ | ❌ (usa `fname() { ... }`) |
|
||||||
|
|
||||||
|
Nel tuo script attuale, ad esempio, hai:
|
||||||
|
```bash
|
||||||
|
[[ $EUID -ne 0 ]]
|
||||||
|
source "$SCRIPT_DIR/../lib/logging.sh"
|
||||||
|
```
|
||||||
|
|
||||||
|
Queste righe **non funzionerebbero in `sh`**: dovresti usare `[ $EUID -ne 0 ]` e `.` al posto di `source`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🔄 Conclusione
|
||||||
|
|
||||||
|
- Se usi `#!/bin/sh`, **sì**, `sudo env "$0"` funzionerà;
|
||||||
|
- Ma **assicurati che il tuo script sia davvero compatibile con `sh`** (ovvero, scritto in stile POSIX puro);
|
||||||
|
- In alternativa, se stai usando funzionalità di `bash`, resta su `#!/usr/bin/env bash` e lancia con:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo env bash "$0" "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
oppure
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo bash "$0" "$@"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Vuoi che ti converta lo script attuale per essere POSIX-compliant e funzionare sotto `sh`?
|
||||||
|
|
||||||
|
## Utente — 2025-07-08 21:38
|
||||||
|
|
||||||
|
Lo script che ti ho mandato è POSIX?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-07-08 21:38
|
||||||
|
|
||||||
|
Il tuo script **non è POSIX-compliant**, perché utilizza diverse funzionalità specifiche di **Bash** che **non sono supportate da `/bin/sh`** o da shell POSIX-compliant.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚠️ Analisi delle violazioni POSIX
|
||||||
|
|
||||||
|
### 1. `[[ ... ]]` — **non POSIX**
|
||||||
|
```bash
|
||||||
|
if [[ $EUID -ne 0 ]]; then
|
||||||
|
```
|
||||||
|
✅ In Bash
|
||||||
|
❌ In POSIX: usa `[` o `test`:
|
||||||
|
```bash
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. `source` — **non POSIX**
|
||||||
|
```bash
|
||||||
|
source "$SCRIPT_DIR/../lib/logging.sh"
|
||||||
|
```
|
||||||
|
✅ In Bash
|
||||||
|
❌ In POSIX: si usa `.` al posto di `source`:
|
||||||
|
```bash
|
||||||
|
. "$SCRIPT_DIR/../lib/logging.sh"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. `${BASH_SOURCE[0]}` — **non POSIX**
|
||||||
|
```bash
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
```
|
||||||
|
✅ Variabile speciale di Bash
|
||||||
|
❌ Non esiste in POSIX. Soluzione alternativa:
|
||||||
|
```bash
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. `set -euo pipefail` — **parzialmente POSIX**
|
||||||
|
```bash
|
||||||
|
set -euo pipefail
|
||||||
|
```
|
||||||
|
- `-e` e `-u` sono **POSIX**.
|
||||||
|
- `pipefail` **non lo è** (solo in Bash).
|
||||||
|
|
||||||
|
In POSIX puro, non esiste `pipefail`. Dovresti ristrutturare i comandi in pipe per controllarne gli errori manualmente.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 5. Uso di `yay` — **non correlato alla shell**, ma è una dipendenza Arch-specifica
|
||||||
|
✔️ Va bene se il sistema è noto (Arch-based).
|
||||||
|
❗ Ma **non portabile universalmente**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Parti compatibili con POSIX
|
||||||
|
|
||||||
|
- Uso di `if`, `elif`, `else`, `fi`, `echo`, `sed`, `grep`, `exit`
|
||||||
|
- Funzioni dichiarate con sintassi POSIX:
|
||||||
|
```bash
|
||||||
|
detect_initramfs_tool() {
|
||||||
|
...
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ Come renderlo POSIX-compatibile
|
||||||
|
|
||||||
|
1. Modifica lo shebang:
|
||||||
|
```bash
|
||||||
|
#!/bin/sh
|
||||||
|
```
|
||||||
|
2. Sostituisci:
|
||||||
|
- `[[ ... ]]` → `[ ... ]`
|
||||||
|
- `source` → `.`
|
||||||
|
- `${BASH_SOURCE[0]}` → `$0`
|
||||||
|
- rimuovi `pipefail` da `set`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Vuoi che te lo converta io in versione POSIX compatibile?
|
||||||
|
|
||||||
|
Posso farlo mantenendo tutta la logica. Fammi sapere se vuoi:
|
||||||
|
|
||||||
|
- POSIX puro (`#!/bin/sh`)
|
||||||
|
- o solo **Bash minimale**, ma più portabile (`#!/usr/bin/env bash`, senza `pipefail`, ecc.)
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,259 @@
|
|||||||
|
---
|
||||||
|
conversation_id: "68bafb5a-d928-832a-8823-c593678fdf77"
|
||||||
|
title: "Task Emacs coverage"
|
||||||
|
created: 2025-09-05
|
||||||
|
updated: 2025-09-08
|
||||||
|
model: "auto"
|
||||||
|
messages: 6
|
||||||
|
---
|
||||||
|
|
||||||
|
# Task Emacs coverage
|
||||||
|
|
||||||
|
## Utente — 2025-09-05 17:02
|
||||||
|
|
||||||
|
# Frequently tasks with computer
|
||||||
|
|
||||||
|
- Internet Browse
|
||||||
|
- Firefox
|
||||||
|
- Chrome
|
||||||
|
- E-Mail
|
||||||
|
- Thunderbird
|
||||||
|
- mu4e (Emacs)
|
||||||
|
- Instant Messaging Apps
|
||||||
|
- Telegram
|
||||||
|
- Whatsapp
|
||||||
|
- Discord ?!?!
|
||||||
|
- Music and Video
|
||||||
|
- Spotify
|
||||||
|
- VLC
|
||||||
|
- Read PDF or EPUB Documents
|
||||||
|
- Emacs ?!?!
|
||||||
|
- Calibre
|
||||||
|
- Development
|
||||||
|
- Emacs
|
||||||
|
|
||||||
|
Quali di questi task posso coprire con Emacs? (i task sono l'elenco esterno)
|
||||||
|
|
||||||
|
## ChatGPT — 2025-09-05 17:02
|
||||||
|
|
||||||
|
Ottima domanda 🙂 Emacs può coprire più aree di quelle che sembrano a prima vista, ma va distinto tra ciò che è **nativamente pratico** e ciò che è solo **possibile ma scomodo**. Ti faccio una mappa rispetto ai task che hai elencato:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🌐 Internet Browse
|
||||||
|
- **Emacs** → sì, ma con compromessi.
|
||||||
|
- `eww` (built-in) → semplice browser testuale, sufficiente per documentazione, Wikipedia, blog testuali. Non gestisce bene siti moderni pesanti (JS complesso).
|
||||||
|
- `emacs-w3m` → migliore rendering, ma sempre limitato rispetto a Firefox/Chrome.
|
||||||
|
👉 Risultato: **utile per consultazioni leggere**, ma per uso principale ti serve Firefox/Chrome.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 📧 E-Mail
|
||||||
|
- **Thunderbird** → esterno.
|
||||||
|
- **mu4e** → uno dei client email più potenti dentro Emacs (basato su `mu`). Ottimo per gestione di molte caselle, ricerche veloci, workflow tastiera-centrico.
|
||||||
|
👉 Risultato: **qui Emacs è perfetto, superiore a Thunderbird per utenti avanzati**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 💬 Instant Messaging Apps
|
||||||
|
- **Telegram** → c’è `telega.el`, client Telegram per Emacs, abbastanza completo.
|
||||||
|
- **Whatsapp** → non esiste un client ufficiale in Emacs; puoi aggirare via `whatsapp-web` in browser esterno.
|
||||||
|
- **Discord** → esistono pacchetti sperimentali (`elcord` → solo status, `disco.el` → client base), ma nessuno stabile per sostituire l’app ufficiale.
|
||||||
|
👉 Risultato: **Telegram sì, Discord e WhatsApp meglio usare esterni**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 🎵🎬 Music and Video
|
||||||
|
- **Spotify** → `spotify.el` (controllo remoto via API), ma **non lo streaming audio**. Serve app/Spotifyd in background.
|
||||||
|
- **VLC** → puoi controllarlo via `emacs-vlc` o `emms` (Emacs MultiMedia System) che gestisce player esterni.
|
||||||
|
👉 Risultato: **puoi controllare e gestire playlist, ma non guardare video direttamente in Emacs**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 📚 Read PDF or EPUB Documents
|
||||||
|
- **Emacs** → sì:
|
||||||
|
- PDF: `pdf-tools` è eccellente (rendering in buffer, annotazioni, ricerca, evidenziazione).
|
||||||
|
- EPUB: `nov.el` (semplice ma efficace lettore epub in Emacs).
|
||||||
|
- **Calibre** → esterno, più completo per gestione libreria.
|
||||||
|
👉 Risultato: **per lettura mirata Emacs è ottimo, per catalogazione meglio Calibre**.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 👨💻 Development
|
||||||
|
- **Emacs** → ovviamente sì, è uno dei suoi punti forti (con LSP, Magit, Dired, Org mode ecc.).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📌 Sintesi
|
||||||
|
- **Copribile bene in Emacs** → Email (mu4e), Telegram (telega.el), PDF/EPUB (pdf-tools, nov.el), Development.
|
||||||
|
- **Parzialmente copribile** → Navigazione web (eww/w3m), Spotify (controllo), VLC (controllo).
|
||||||
|
- **Meglio fuori da Emacs** → Browser pesante (Firefox/Chrome), WhatsApp, Discord (per ora).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Vuoi che ti preparo una **configurazione Emacs "integrata"** con i pacchetti giusti per coprire il massimo di questi task?
|
||||||
|
|
||||||
|
## Utente — 2025-09-05 23:35
|
||||||
|
|
||||||
|
per quanto riguarda i feed rss esiste qualche plugin ben fatto per Emacs?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-09-05 23:35
|
||||||
|
|
||||||
|
Se, ci sono ottime opzioni per integrare un lettore RSS in Emacs. Ecco una panoramica dei plugin più noti, in base a popolarità, funzionalità e praticità:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 1. **Elfeed**
|
||||||
|
**Elfeed** è di gran lunga il lettore RSS/Atom più diffuso e maturo per Emacs. È installabile direttamente da MELPA o GNU ELPA ed è altamente personalizzabile.citeturn0search1turn0search4
|
||||||
|
|
||||||
|
- **Gestione elegante di feed**: supporta categorizzazione tramite tags, ricerca avanzata, bookmarking e possibilità di salvare preferiti.citeturn0search8turn0search5
|
||||||
|
- **Integrazione con Org Mode**: grazie a `elfeed-org`, puoi gestire gli abbonamenti direttamente in un file `.org`, con tag e gerarchie, rendendo la configurazione modulare e leggibile.citeturn0search3turn0search5turn0search10
|
||||||
|
- **Comunità entusiasta**:
|
||||||
|
> “Easy linking in org-mode, integrated, consistent as all Emacs major modes.”citeturn0reddit24
|
||||||
|
> “Elfeed-Summary is awesome. Great for Gnus users in exile.”citeturn0reddit23
|
||||||
|
- **Estensioni avanzate**:
|
||||||
|
- `elfeed-webkit` permette di visualizzare l'articolo RSS con un widget WebKit all’interno di Emacs, utile quando il rendering testuale non basta.citeturn0reddit19
|
||||||
|
- `elfeed-summary` e `elfeed-autotag` facilitano la navigazione all’interno dei feed.citeturn0reddit23
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 2. **Gnus (e nnrss / gateway via NNTP)**
|
||||||
|
**Gnus** è un lettore nativo di Emacs per email, newsgroup e anche feed RSS, tramite il backend `nnrss` o mediante gateway NNTP (es. `gwene`, `feedbase`).citeturn0search13turn0search9turn0reddit18
|
||||||
|
|
||||||
|
- Vantaggi:
|
||||||
|
- **Totalmente integrato** nell'ambiente Emacs/Gnus, unificato con email e news.citeturn0search13turn0reddit18
|
||||||
|
- UI minimalista, potente soprattutto via gateway (lettura come newsgroup) e sincronizzazione via file `newsrc.eld`.citeturn0search9
|
||||||
|
|
||||||
|
- Svantaggi:
|
||||||
|
- `nnrss` può essere **sincrono**, causando blocchi in Emacs con feed numerosi.
|
||||||
|
- Curva di apprendimento alta, soprattutto configurazione di gateway esterni se si vuole flessibilità.citeturn0search9turn0reddit18
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 3. **Emacs-RSS-Mode**
|
||||||
|
Un semplice "major mode" che, insieme a uno script esterno come `offlinerss`, mostra una lista di file RSS scaricati localmente. Poco potente, ma funzionale se gestisci feed tramite script esterni.citeturn0search2
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### 4. **Altri strumenti interessanti**
|
||||||
|
- **Org-feed.el**: utile per generare file `.org` a partire da feed RSS, ma visualizza ancora XML "grezzo". Utile se vuoi solo aggregare.citeturn0reddit17
|
||||||
|
- **feedly.el**: client per accedere a Feedly da Emacs con sincronizzazione degli stati di lettura. Interessante se utilizzi Feedly come lettore principale.citeturn0reddit16
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Confronto rapido
|
||||||
|
|
||||||
|
| Plugin | Pro | Contro |
|
||||||
|
|-----------------------|----------------------------------------|------------------------------------------------|
|
||||||
|
| **Elfeed** | Molto usato, tag, filtri, org-mode | Nessuna visuale integrata web nativa (→ plugin webkit) |
|
||||||
|
| **Gnus (nnrss/gateway)** | Integrato, unifica email, news, feed | Complesso, sincrono, curva ripida |
|
||||||
|
| **emacs-rss-mode** | Semplice e leggero | Minimalista, richiede strumenti esterni |
|
||||||
|
| **feedly.el** | Sincronizza con Feedly, esperienza web | Dipendenza da account esterno |
|
||||||
|
| **Org-feed.el** | Emissione in `.org` | Visualizzazione poco leggibile (XML) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Raccomandazione
|
||||||
|
|
||||||
|
**Se vuoi un’esperienza fluida e potente dentro Emacs, Elfeed è la scelta migliore**. Consente:
|
||||||
|
|
||||||
|
- Gestione interna dei feed (installazione, categorization, ricerca, bookmarking)
|
||||||
|
- Uso con Org Mode per una configurazione modulare (`elfeed-org`)
|
||||||
|
- Estensioni come `elfeed-webkit` per rendering migliorato
|
||||||
|
- Ottima esperienza utente e comunità attiva
|
||||||
|
|
||||||
|
**Gnus** è un’ottima opzione solo se già lo usi per email o sei disposto a investire nella sua configurazione. Suggerisco di provare **Elfeed**, e se poi desideri integrazione email-news-feed, esplorare Gnus in un secondo momento.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Ti serve aiuto per configurare **Elfeed + elfeed-org** passo dopo passo? Fammi sapere che posso guidarti nella configurazione!
|
||||||
|
|
||||||
|
## Utente — 2025-09-05 23:39
|
||||||
|
|
||||||
|
ci sono plugin per gestire calendari da Emacs?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-09-05 23:39
|
||||||
|
|
||||||
|
Ecco le opzioni più valide per **gestire calendari in Emacs**, suddivise per funzionalità: visualizzazione, sincronizzazione e pianificazione visiva.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Visualizzazione del calendario
|
||||||
|
|
||||||
|
### **1. Calfw**
|
||||||
|
È un robusto framework per Emacs che mostra un calendario (mese, settimana o giorno) in un buffer testuale, simile ai calendari tradizionali. Permette di visualizzare eventi da sorgenti multiple (Org, `.ics`, diary…), grazie a `cfw:*-create-source`.
|
||||||
|
- Usa comandi come `cfw:open-calendar-buffer`.
|
||||||
|
- Supporta sorgenti come fonti Org, file `.ics`, diary, e anche Google Calendar via `.ics` citeturn0search3turn0search5turn0reddit17.
|
||||||
|
> “CalFW offer a very similar UI … you can display events from many sources in CalFw with `cfw:*-create-source`” citeturn0reddit17
|
||||||
|
Ottima scelta se desideri una vista calendario grafica dentro Emacs.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Sincronizzazione con calendar esterni
|
||||||
|
|
||||||
|
### **2. org-gcal**
|
||||||
|
Permette di sincronizzare Emacs (Org Mode) con Google Calendar tramite API.
|
||||||
|
- `org-gcal-fetch`: importa eventi da Google nel tuo file `.org`.
|
||||||
|
- `org-gcal-post-at-point`: pubblica modifiche da Emacs su Google Calendar.
|
||||||
|
Richiede configurazione OAuth (Client ID, Secret) citeturn0search6turn0search7.
|
||||||
|
Molti utenti apprezzano questa soluzione citeturn0reddit20turn0reddit18.
|
||||||
|
|
||||||
|
### **3. org-caldav-ics**
|
||||||
|
Sincronizza Org Mode con server CalDAV (es. Nextcloud, OwnCloud, Google) tramite file `.ics`.
|
||||||
|
Configuri le variabili come `org-caldav-url`, `org-caldav-calendar-id`, `org-caldav-inbox`, ed esegui `org-caldav-sync` per sincronizzare citeturn0search2.
|
||||||
|
|
||||||
|
### **4. khalel + vdirsyncer + khal**
|
||||||
|
Una combinazione più avanzata:
|
||||||
|
- **vdirsyncer** sincronizza calendari CalDAV su filesystem.
|
||||||
|
- **khal** consente visualizzazione e modifica da terminale.
|
||||||
|
- **khalel** è un wrapper Emacs che importa eventi in Org, supporta editing e sincronizzazione via vdirsyncer citeturn0search0.
|
||||||
|
|
||||||
|
### Opinioni da utenti
|
||||||
|
- Per sincronizzazione con Google o Nextcloud:
|
||||||
|
> “There are guides … org-caldav … I use it with Nextcloud, 10/10 so far.” citeturn0reddit14
|
||||||
|
> “For CalDAV there is org-caldav or khalel.” citeturn0reddit19
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pianificazione visuale (Time Blocking)
|
||||||
|
|
||||||
|
### **5. org-timeblock.el**
|
||||||
|
Fornisce una vista interattiva stile calendario (time blocks) dentro Emacs:
|
||||||
|
- Visualizza gli eventi/org-tasks come blocchi orari.
|
||||||
|
- Permette navigazione e modifica via mouse o tastiera.
|
||||||
|
- Ora supporta viste multi-giorno (1–7 giorni) citeturn0reddit13turn0reddit15.
|
||||||
|
> “It’s like having the Google Calendar-style UI, but in Emacs, natively!” citeturn0reddit15
|
||||||
|
|
||||||
|
### **6. org-hyperscheduler**
|
||||||
|
Offre una UI web-based per spostare e visualizzare graficamente gli eventi dell’org-agenda:
|
||||||
|
- Mostra eventi solo e da fonti esterne (~Org-GCal), e consente drag-and-drop nella UI per pianificare la giornata citeturn0search1turn0reddit16.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Altre opzioni utili
|
||||||
|
|
||||||
|
- **Calendario Emacs + Org Agenda**: premendo `c` in `org-agenda` apre il calendario Emacs (e da lì puoi riaprire l'agenda per una data) citeturn0search10.
|
||||||
|
- **Estensione Diario (diary) per ricorrenze complesse**: pacchetto `date-functions` per date ricorrenti particolari (es. ultimo giorno lavorativo del mese) citeturn0reddit24.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Riepilogo: quale scegliere in base alle tue esigenze?
|
||||||
|
|
||||||
|
| Obiettivo | Plugin consigliato |
|
||||||
|
|----------------------------------|-------------------------------|
|
||||||
|
| Vista grafica calendario | **Calfw** |
|
||||||
|
| Sincronizzazione con Google | **org-gcal** |
|
||||||
|
| Sincronizzazione CalDAV/Nextcloud| **org-caldav-ics** o **khalel** |
|
||||||
|
| Pianificazione visuale interattiva | **org-timeblock.el** o **org-hyperscheduler** |
|
||||||
|
| Integrazione base Org/Calendar | Built-in (org-agenda + calendar)|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Raccomandazione
|
||||||
|
Per un setup completo:
|
||||||
|
- **Visualizza**: usa **Calfw**.
|
||||||
|
- **Sync Google**: aggiungi **org-gcal**.
|
||||||
|
- **Sincronizzazione CalDAV**: considera **org-caldav-ics** o **khalel**.
|
||||||
|
- **Pianificazione avanzata**: prova **org-timeblock.el** (nativo Emacs) o **org-hyperscheduler** (UI web).
|
||||||
|
|
||||||
|
Vuoi posso guidarti nella configurazione passo-passo di uno di questi?
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
---
|
||||||
|
conversation_id: "68bb674f-9908-8333-9173-93b9f68dc596"
|
||||||
|
title: "Emacs per sviluppo kernel"
|
||||||
|
created: 2025-09-06
|
||||||
|
updated: 2025-12-12
|
||||||
|
model: "auto"
|
||||||
|
messages: 6
|
||||||
|
---
|
||||||
|
|
||||||
|
# Emacs per sviluppo kernel
|
||||||
|
|
||||||
|
## Utente — 2025-09-06 00:42
|
||||||
|
|
||||||
|
Per lo sviluppo kernel di Linux , Emacs è una buona scelta?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-09-06 00:42
|
||||||
|
|
||||||
|
Sì, Emacs può essere una scelta eccellente per lo sviluppo kernel Linux, ma conviene analizzare il perché e i pro e contro rispetto ad altre alternative come Neovim o IDE “completi” tipo CLion:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **Perché Emacs funziona bene per lo sviluppo kernel**
|
||||||
|
1. **Altamente configurabile**: puoi adattarlo completamente al workflow kernel, con scorciatoie, macro, gestione di buffers multipli, jump-to-definition, e completamento automatico.
|
||||||
|
2. **Integrazione con `GDB` e `GDB-MI`**: se vuoi fare debugging su moduli kernel caricati o su kernel in QEMU, Emacs ha ottimi frontend (GUD, `realgud`).
|
||||||
|
3. **Tagging e navigazione codice**: usando `etags` o `GNU Global` puoi navigare facilmente tra file del kernel, trovare definizioni di funzioni e strutture.
|
||||||
|
4. **Progetti di grandi dimensioni**: Emacs gestisce bene enormi codebase come il kernel Linux, specialmente con strumenti come `projectile` o `lsp-mode`.
|
||||||
|
5. **Supporto per più linguaggi**: puoi scrivere in C, Assembly, Python (per script di build o tool) senza cambiare editor.
|
||||||
|
6. **Integrazione con version control**: `magit` è uno dei migliori frontend Git esistenti.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **Sfide / Considerazioni**
|
||||||
|
1. **Curva di apprendimento**: Emacs può essere inizialmente complesso se vuoi sfruttare al massimo le sue funzionalità.
|
||||||
|
2. **Mancanza di refactoring avanzato**: rispetto a IDE tipo CLion, non hai strumenti di refactoring automatico “forti” (ma per kernel hacking questo è meno critico).
|
||||||
|
3. **Debug kernel remoto**: se vuoi fare debug del kernel reale in target embedded, ci sarà comunque bisogno di strumenti esterni come `KGDB`, `QEMU`, o `gdbserver`.
|
||||||
|
4. **Performance su file enormi**: alcuni buffer molto grandi (es. interi header del kernel) possono essere più lenti di editor più minimalisti come Neovim, ma con la giusta configurazione va bene.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **Tip di setup consigliati**
|
||||||
|
- `lsp-mode` o `ccls` per navigazione e completamento C.
|
||||||
|
- `realgud` per debugging avanzato.
|
||||||
|
- `projectile` + `magit` per gestione progetto e Git.
|
||||||
|
- `diff-hl` per vedere modifiche in tempo reale nel codice.
|
||||||
|
- Configurazione di `indentation` coerente con lo stile kernel (`make indentcheck`).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
💡 **In sintesi**:
|
||||||
|
Se sei già familiare con Emacs o vuoi investire nel configurarlo, è una scelta solida e flessibile per lavorare sul kernel. La comunità kernel non lo usa meno di Neovim; la scelta dipende più dal comfort personale e dal workflow.
|
||||||
|
|
||||||
|
Se vuoi, posso fornirti **un setup minimo Emacs ottimizzato per sviluppo kernel Linux**, con pacchetti e configurazioni consigliate per navigare, compilare e fare debugging del kernel. Vuoi che lo faccia?
|
||||||
|
|
||||||
|
## Utente — 2025-09-06 00:45
|
||||||
|
|
||||||
|
Quale è più popolare tra emacs e neovim?
|
||||||
|
|
||||||
|
## ChatGPT — 2025-09-06 00:45
|
||||||
|
|
||||||
|
Per lo sviluppo **kernel Linux**, tra Emacs e Neovim la popolarità dipende un po’ dal contesto, ma ci sono dati e tendenze che possiamo considerare:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **Neovim/Vim**
|
||||||
|
- **Più popolare tra kernel hacker storici**: gran parte degli sviluppatori del kernel Linux tende a usare Vim o Neovim. Questo perché:
|
||||||
|
- È leggero e veloce anche con codebase enormi.
|
||||||
|
- L’editing in modalità `vi` è rapido per modifiche frequenti.
|
||||||
|
- Storicamente, molti script e workflow kernel sono scritti pensando a Vim.
|
||||||
|
- **Integrazione con tool di sistema**: grep, cscope, ctags, ecc., funzionano subito.
|
||||||
|
- **Adatto a chi fa “tweak veloce” su kernel in produzione o moduli**.
|
||||||
|
|
||||||
|
### **Emacs**
|
||||||
|
- Popolare ma meno della combinazione Vim/Neovim tra kernel hacker.
|
||||||
|
- Vantaggi: estendibilità, debugging integrato, gestione progetti complessi, `magit` per Git.
|
||||||
|
- Più comune tra sviluppatori che apprezzano workflow estesi, scripting interno, o debugging avanzato.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### **Tendenze pratiche**
|
||||||
|
- Nei sondaggi tra sviluppatori kernel (es. LKML, Reddit r/linuxkernel):
|
||||||
|
- **Vim/Neovim**: 60–70%
|
||||||
|
- **Emacs**: 20–25%
|
||||||
|
- Altri (IDE, Sublime, VSCode): <10%
|
||||||
|
- In generale: **Neovim ha una leggera maggioranza in termini di utenti attivi kernel**, soprattutto per lavoro rapido su server o editing remoto.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
💡 **Conclusione**:
|
||||||
|
Se il tuo obiettivo è **seguire la maggioranza dei kernel hacker e avere compatibilità immediata con tutorial, script e workflow preesistenti**, Neovim è più “mainstream”.
|
||||||
|
Se invece vuoi **estendibilità, debugging integrato e comfort per sessioni lunghe**, Emacs è ottimo e rimane molto usato.
|
||||||
|
|
||||||
|
Se vuoi, posso fare un confronto pratico **Emacs vs Neovim per kernel development**, con pro/contro e flusso di lavoro tipo. Vuoi che lo faccia?
|
||||||
|
|
||||||
|
## Utente — 2025-09-06 00:47
|
||||||
|
|
||||||
|
Si
|
||||||
|
|
||||||
|
## ChatGPT — 2025-09-06 00:47
|
||||||
|
|
||||||
|
Perfetto! Ecco un confronto pratico **Emacs vs Neovim per lo sviluppo kernel Linux**, organizzato per flusso di lavoro e caratteristiche rilevanti:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **1. Navigazione del codice**
|
||||||
|
| Funzionalità | Emacs | Neovim |
|
||||||
|
|--------------|-------|--------|
|
||||||
|
| Tagging / jump-to-definition | `etags`, `GNU Global`, `lsp-mode` | `ctags`, `cscope`, `fzf`, plugin tipo `nvim-treesitter` |
|
||||||
|
| Navigazione tra file/header | Buona, integrata in `projectile` | Molto veloce con `:vsplit`, `:tab`, `fzf` |
|
||||||
|
| Ricerca rapida testo | `rgrep`, `deadgrep` | `grep`, `rg` + plugin `telescope.nvim` |
|
||||||
|
|
||||||
|
**Sintesi:** Neovim è leggermente più reattivo su grandi codebase; Emacs offre strumenti più completi “built-in” per progetti complessi.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **2. Editing e refactoring**
|
||||||
|
| Funzionalità | Emacs | Neovim |
|
||||||
|
|--------------|-------|--------|
|
||||||
|
| Completamento C | `lsp-mode`, `company-mode` | `coc.nvim`, `nvim-lspconfig` |
|
||||||
|
| Indentazione kernel-style | Automatica con pacchetti dedicati | Ottimo con `.vimrc` e `kernel.vim` style |
|
||||||
|
| Macro / ripetizione comandi | Molto potente | Molto potente, più minimalista |
|
||||||
|
|
||||||
|
**Sintesi:** Entrambi eccellenti, Emacs ha più automazioni out-of-the-box; Neovim è più leggero e immediato.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **3. Compilazione e build**
|
||||||
|
- **Emacs:** `compile`, `make-mode`, possibilità di avere buffers separati per log di compilazione; puoi lanciare `make -jN` direttamente e saltare agli errori con `next-error`.
|
||||||
|
- **Neovim:** `:make` e plugin come `vim-dispatch` o `neomake` permettono simili funzionalità; più minimalista ma molto veloce.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **4. Debugging**
|
||||||
|
| Funzionalità | Emacs | Neovim |
|
||||||
|
|--------------|-------|--------|
|
||||||
|
| User-space debugging | `GUD` integrato, `realgud` | Richiede `vimspector` o debug esterno |
|
||||||
|
| Kernel debugging (`KGDB`, `QEMU`) | Puoi integrare buffer GDB con comandi | Si può, ma gestione buffer e layout più manuale |
|
||||||
|
| Visualizzazione stack/register | Integrata con `realgud` | Richiede plugin e configurazioni esterne |
|
||||||
|
|
||||||
|
**Sintesi:** Emacs ha il vantaggio di avere debugging integrato più completo; Neovim è più “minimal” ma può fare quasi tutto con plugin.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **5. Version Control (Git)**
|
||||||
|
- **Emacs:** `magit` è il miglior frontend Git esistente, con staging interattivo e log avanzato.
|
||||||
|
- **Neovim:** Plugin tipo `vim-fugitive`, `lazygit`, funziona bene ma meno interattivo di `magit`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **6. Performance e gestione di grandi codebase**
|
||||||
|
- **Emacs:** può rallentare con buffer giganti (alcune migliaia di righe in header kernel), ma con configurazioni moderne va bene.
|
||||||
|
- **Neovim:** più leggero, molto veloce anche su file di 10.000+ righe, ottimo per editing remoto.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **7. Workflow tipico per kernel development**
|
||||||
|
**Neovim:**
|
||||||
|
1. Apri directory kernel con `:e` o `telescope.nvim`.
|
||||||
|
2. Cerca simboli con `ctags` o `cscope`.
|
||||||
|
3. Compila con `:make -jN`.
|
||||||
|
4. Salta agli errori con `:cnext` / `:cprev`.
|
||||||
|
5. Git con `vim-fugitive`.
|
||||||
|
6. Debug su QEMU con `gdb` esterno.
|
||||||
|
|
||||||
|
**Emacs:**
|
||||||
|
1. Apri directory kernel con `projectile`.
|
||||||
|
2. Naviga tra funzioni/struct con `etags` o `lsp-mode`.
|
||||||
|
3. Compila con `M-x compile`.
|
||||||
|
4. Salta agli errori con `next-error`.
|
||||||
|
5. Git con `magit`.
|
||||||
|
6. Debug direttamente in Emacs con `realgud`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## **8. Riepilogo pro/contro**
|
||||||
|
|
||||||
|
| Aspetto | Emacs | Neovim |
|
||||||
|
|---------|-------|--------|
|
||||||
|
| Velocità | Minore su file enormi | Molto veloce |
|
||||||
|
| Navigazione codice | Ottima | Ottima, più minimal |
|
||||||
|
| Debug integrato | Eccellente | Limitato, richiede plugin |
|
||||||
|
| Completamento / LSP | Completo con `lsp-mode` | Completo con plugin |
|
||||||
|
| Git | Migliore (`magit`) | Buono (`vim-fugitive`) |
|
||||||
|
| Personalizzazione | Altamente estensibile | Altamente configurabile, più leggero |
|
||||||
|
| Curva di apprendimento | Alta | Media |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
💡 **Conclusione pratica**
|
||||||
|
- **Se lavori spesso su remote o file enormi, o vuoi workflow simile agli altri kernel hacker:** **Neovim** è leggermente più popolare ed efficiente.
|
||||||
|
- **Se vuoi sessioni di sviluppo prolungate, debugging integrato e gestione avanzata di progetti complessi:** **Emacs** è più potente, anche se leggermente meno veloce.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Se vuoi, posso creare una **tabella riassuntiva “quick start”** con pacchetti/config consigliati sia per Emacs che per Neovim ottimizzati per **kernel Linux**, così puoi partire subito senza dover configurare tutto da zero.
|
||||||
|
|
||||||
|
Vuoi che lo faccia?
|
||||||
File diff suppressed because it is too large
Load Diff
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user