qusal/salt/utils/macros/update-admin.sls
Ben Grande f933523e10
feat: bump Fedora version
- Update to Fedora 41;
- Change default Fedora template to Xfce variant;
- Enforce Fedora based formulas to depend on a chain that always has the
  correct management disposable set. For 'qubes-builder,' it requires
  'mgmt', which requires 'fedora-minimal', which requires 'fedora-xfce';
- Cleanup salt patch necessary on version 39 and 40.
- Update base templates when stale before being cloned to derivative
  templates.
- Remove non-essential bootstrap formulas from requirements. Dom0 was
  never required, but very recommended, templates were required because
  it was best to update them on their formula before generating outdated
  clones of it.

Fix: https://github.com/ben-grande/qusal/issues/108
Fix: https://github.com/ben-grande/qusal/issues/57
2025-04-14 15:25:57 +02:00

49 lines
1.3 KiB
Plaintext

{#
SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}
{#
Usage:
1: Import this template:
{% from 'utils/macros/update-admin.sls' import update_admin -%}
2: Set template base to update and the reason for it:
{{ update_admin('fedora-minimal', 'tpl-sys-pgp') }}
The 'reason' is only used for creating a globally unique ID.
#}
{% macro update_admin(source, reason, shutdown=True, include_create=False) -%}
{% import source ~ "/template.jinja" as template -%}
{% import "dom0/gui-user.jinja" as gui_user -%}
{% if include_create -%}
include:
- {{ source }}.create
{% endif -%}
"{{ reason }}-{{ source }}-update-admin":
cmd.run:
- require:
- sls: {{ source }}.create
- name: qubes-vm-update --no-progress --show-output --targets={{ template.template }}
- runas: {{ gui_user.gui_user }}
{% if shutdown -%}
{#
Shutdown is necessary for cloned templates to have the newer state.
Even if 'qubes-vm-update' tries to shutdown a qube that was not previously
running, it does not wait for the shutdown to complete:
https://github.com/qubesos/qubes-issues/issues/9814
#}
"{{ reason }}-{{ source }}-update-admin-shutdown":
qvm.shutdown:
- name: {{ template.template }}
- flags:
- wait
{% endif -%}
{% endmacro -%}