Skip to content

Commit

Permalink
fix: separate template formula per flavor
Browse files Browse the repository at this point in the history
Default template flavor is Gnome, installing Xfce when requesting the
template formula without flavor causes confusion.
  • Loading branch information
ben-grande committed Jan 12, 2024
1 parent a380aeb commit e2f44fb
Show file tree
Hide file tree
Showing 20 changed files with 360 additions and 2 deletions.
34 changes: 34 additions & 0 deletions salt/debian-xfce/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# debian

Debian Xfce Template in Qubes OS.

## Table of Contents

* [Description](#description)
* [Installation](#installation)
* [Usage](#usage)

## Description

Creates the Debian Xfce Template as well as a Disposable Template based on it.

## Installation

- Top:
```sh
qubesctl top.enable debian-xfce
qubesctl --targets=debian-12-xfce state.apply
qubesctl top.disable debian-xfce
```

- State:
<!-- pkg:begin:post-install -->
```sh
qubesctl state.apply debian-xfce.create
qubesctl --skip-dom0 --targets=debian-12-xfce state.apply debian-xfce.install
```
<!-- pkg:end:post-install -->

## Usage

AppVMs and StandaloneVMs can be based on this template.
12 changes: 12 additions & 0 deletions salt/debian-xfce/clone.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{%- import slsdotpath ~ "/template.jinja" as template -%}
"{{ template.template }}-template-installed":
qvm.template_installed:
- name: {{ template.template }}
- fromrepo: {{ template.repo }}
10 changes: 10 additions & 0 deletions salt/debian-xfce/clone.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'dom0':
- match: nodegroup
- debian-xfce.clone
62 changes: 62 additions & 0 deletions salt/debian-xfce/create.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{%- from "qvm/template.jinja" import load -%}
{%- import slsdotpath ~ "/template.jinja" as template -%}
include:
- .clone
"dvm-{{ template.template }}-absent":
qvm.absent:
- names:
- {{ template.template_clean }}-dvm
- {{ template.template }}-dvm
{% load_yaml as defaults -%}
name: dvm-{{ template.template_clean }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- template: {{ template.template }}
- label: red
prefs:
- template: {{ template.template }}
- label: red
- memory: 300
- maxmem: 800
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
{% load_yaml as defaults -%}
name: {{ template.template }}
force: True
require:
- sls: {{ slsdotpath }}.clone
present:
- label: black
prefs:
- label: black
- memory: 300
- maxmem: 600
- vcpus: 1
- include_in_backups: False
features:
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
- default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
10 changes: 10 additions & 0 deletions salt/debian-xfce/create.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'dom0':
- match: nodegroup
- debian-xfce.create
13 changes: 13 additions & 0 deletions salt/debian-xfce/init.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'dom0':
- match: nodegroup
- debian-xfce.create
'I@qubes:type:template and E@^debian-[0-9][0-9]-xfce$':
- match: compound
- debian-xfce.install
13 changes: 13 additions & 0 deletions salt/debian-xfce/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% if grains['nodename'] != 'dom0' -%}

"{{ slsdotpath }}-updated":
pkg.uptodate:
- refresh: True

{% endif %}
10 changes: 10 additions & 0 deletions salt/debian-xfce/install.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'I@qubes:type:template and E@^debian-[0-9][0-9]-xfce$':
- match: compound
- debian-xfce.install
15 changes: 15 additions & 0 deletions salt/debian-xfce/template.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% set base = 'debian' -%}
{% set version = salt['pillar.get']('qvm:debian:version', '12') -%}
{% set flavor = 'xfce' -%}
{% set repo = salt['pillar.get']('qvm:debian:repo', 'qubes-templates-itl') -%}
{% if flavor -%}
{% set flavor = '-' ~ flavor -%}
{% endif -%}
{% set template = base ~ '-' ~ version ~ flavor -%}
{% set template_clean = base ~ flavor -%}
2 changes: 1 addition & 1 deletion salt/debian/template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later

{% set base = 'debian' -%}
{% set version = salt['pillar.get']('qvm:debian:version', '12') -%}
{% set flavor = salt['pillar.get']('qvm:debian:flavor', 'xfce') -%}
{% set flavor = '' -%}
{% set repo = salt['pillar.get']('qvm:debian:repo', 'qubes-templates-itl') -%}
{% if flavor -%}
{% set flavor = '-' ~ flavor -%}
Expand Down
34 changes: 34 additions & 0 deletions salt/fedora-xfce/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# fedora

Fedora Xfce Template in Qubes OS.

## Table of Contents

* [Description](#description)
* [Installation](#installation)
* [Usage](#usage)

## Description

Creates the Fedora Xfce template as well as a Disposable Template based on it.

## Installation

- Top:
```sh
qubesctl top.enable fedora-xfce
qubesctl --targets=fedora-38-xfce state.apply
qubesctl top.disable fedora-xfce
```

- State:
<!-- pkg:begin:post-install -->
```sh
qubesctl state.apply fedora-xfce.create
qubesctl --skip-dom0 --targets=fedora-38-xfce state.apply fedora-xfce.install
```
<!-- pkg:end:post-install -->

## Usage

AppVMs and StandaloneVMs can be based on this template.
12 changes: 12 additions & 0 deletions salt/fedora-xfce/clone.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{%- import slsdotpath ~ "/template.jinja" as template -%}
"{{ template.template }}-template-installed":
qvm.template_installed:
- name: {{ template.template }}
- fromrepo: {{ template.repo }}
10 changes: 10 additions & 0 deletions salt/fedora-xfce/clone.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'dom0':
- match: nodegroup
- fedora-xfce.clone
62 changes: 62 additions & 0 deletions salt/fedora-xfce/create.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{%- from "qvm/template.jinja" import load -%}
{%- import slsdotpath ~ "/template.jinja" as template -%}
include:
- .clone
"dvm-{{ template.template }}-absent":
qvm.absent:
- names:
- {{ template.template_clean }}-dvm
- {{ template.template }}-dvm
{% load_yaml as defaults -%}
name: dvm-{{ template.template_clean }}
force: True
require:
- sls: {{ template.template_clean }}.clone
present:
- template: {{ template.template }}
- label: red
prefs:
- template: {{ template.template }}
- label: red
- memory: 300
- maxmem: 400
- vcpus: 1
- template_for_dispvms: True
- include_in_backups: False
features:
- enable:
- appmenus-dispvm
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
{% load_yaml as defaults -%}
name: {{ template.template }}
force: True
require:
- sls: {{ template.template_clean }}.clone
present:
- label: black
prefs:
- label: black
- memory: 300
- maxmem: 600
- vcpus: 1
- include_in_backups: False
features:
- set:
- menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
- default-menu-items: "qubes-open-file-manager.desktop qubes-run-terminal.desktop qubes-start.desktop"
{%- endload %}
{{ load(defaults) }}
10 changes: 10 additions & 0 deletions salt/fedora-xfce/create.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'dom0':
- match: nodegroup
- fedora-xfce.create
13 changes: 13 additions & 0 deletions salt/fedora-xfce/init.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'dom0':
- match: nodegroup
- fedora-xfce.create
'I@qubes:type:template and E@^fedora-[0-9][0-9]-xfce$':
- match: compound
- fedora-xfce.install
13 changes: 13 additions & 0 deletions salt/fedora-xfce/install.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% if grains['nodename'] != 'dom0' -%}

"{{ slsdotpath }}-updated":
pkg.uptodate:
- refresh: True

{% endif %}
10 changes: 10 additions & 0 deletions salt/fedora-xfce/install.top
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>

SPDX-License-Identifier: AGPL-3.0-or-later
#}

base:
'I@qubes:type:template and E@^fedora-[0-9][0-9]-xfce$':
- match: compound
- fedora-xfce.install
15 changes: 15 additions & 0 deletions salt/fedora-xfce/template.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{#
SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
SPDX-License-Identifier: AGPL-3.0-or-later
#}

{% set base = 'fedora' -%}
{% set version = salt['pillar.get']('qvm:fedora:version', '38') -%}
{% set flavor = 'xfce' -%}
{% set repo = salt['pillar.get']('qvm:fedora:repo', 'qubes-templates-itl') -%}
{% if flavor -%}
{% set flavor = '-' ~ flavor -%}
{% endif -%}
{% set template = base ~ '-' ~ version ~ flavor -%}
{% set template_clean = base ~ flavor -%}
2 changes: 1 addition & 1 deletion salt/fedora/template.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later

{% set base = 'fedora' -%}
{% set version = salt['pillar.get']('qvm:fedora:version', '38') -%}
{% set flavor = salt['pillar.get']('qvm:fedora:flavor', 'xfce') -%}
{% set flavor = '' -%}
{% set repo = salt['pillar.get']('qvm:fedora:repo', 'qubes-templates-itl') -%}
{% if flavor -%}
{% set flavor = '-' ~ flavor -%}
Expand Down

0 comments on commit e2f44fb

Please sign in to comment.