From a35e7dd2981cefbde9266d5a272a7996cce0db04 Mon Sep 17 00:00:00 2001 From: Paul Lecuq Date: Sat, 27 Apr 2024 18:26:21 +0200 Subject: [PATCH] added thunderbird state --- states/thunderbird/defaults.yaml | 10 ++++ states/thunderbird/init.sls | 3 ++ states/thunderbird/install.sls | 53 +++++++++++++++++++ states/thunderbird/map.jinja | 5 ++ .../templates/thunderbird.desktop.j2 | 13 +++++ 5 files changed, 84 insertions(+) create mode 100644 states/thunderbird/defaults.yaml create mode 100644 states/thunderbird/init.sls create mode 100644 states/thunderbird/install.sls create mode 100644 states/thunderbird/map.jinja create mode 100644 states/thunderbird/templates/thunderbird.desktop.j2 diff --git a/states/thunderbird/defaults.yaml b/states/thunderbird/defaults.yaml new file mode 100644 index 0000000..a53bc9b --- /dev/null +++ b/states/thunderbird/defaults.yaml @@ -0,0 +1,10 @@ +--- +thunderbird: + enabled: true + mirror: "https://ftp.mozilla.org/pub/thunderbird/releases" + install_dir: "/usr/local/apps" + release_dir: "/usr/local/apps/releases" + dest_path: "/usr/local/apps/thunderbird-" + version: "125.0" + platform: "linux-x86_64" + lang: "en-GB" diff --git a/states/thunderbird/init.sls b/states/thunderbird/init.sls new file mode 100644 index 0000000..e39dc86 --- /dev/null +++ b/states/thunderbird/init.sls @@ -0,0 +1,3 @@ +--- +include: + - .install diff --git a/states/thunderbird/install.sls b/states/thunderbird/install.sls new file mode 100644 index 0000000..e446809 --- /dev/null +++ b/states/thunderbird/install.sls @@ -0,0 +1,53 @@ +--- +{%- from "thunderbird/map.jinja" import thunderbird with context %} +thunderbird-archive-extract: + archive.extracted: + - name: {{ thunderbird.release_dir }}/thunderbird-{{ thunderbird.version }} + - source: {{ thunderbird.mirror }}/{{ thunderbird.version }}/{{ thunderbird.platform }}/{{ thunderbird.lang }}/thunderbird-{{ thunderbird.version }}.tar.bz2 + - skip_verify: true + - archive_format: tar + - enforce_toplevel: false + - options: --strip 1 + - keep: true + - if_missing: {{ thunderbird.release_dir }}/thunderbird-{{ thunderbird.version }}/thunderbird + +thunderbird-symlink: + file.symlink: + - name: {{ thunderbird.install_dir }}/thunderbird + - target: {{ thunderbird.release_dir }}/thunderbird-{{ thunderbird.version }} + - force: true + - require: + - archive: thunderbird-archive-extract + +thunderbird-bin-symlink: + file.symlink: + - name: /usr/bin/thunderbird + - target: {{ thunderbird.install_dir }}/thunderbird/thunderbird + - force: true + - require: + - archive: thunderbird-archive-extract + +thunderbird-shortcut: + file.managed: + - name: /usr/share/applications/thunderbird.desktop + - source: salt://thunderbird/templates/thunderbird.desktop.j2 + - user: root + - group: root + - mode: 644 + - template: jinja + - require: + - archive: thunderbird-archive-extract + +thunderbird-icon: + file.managed: + - name: /usr/share/icons/thunderbird.png + - source: /usr/local/apps/thunderbird/chrome/icons/default/default128.png + - user: root + - group: root + - mode: 644 + +thunderbird-cleanup: + software.cleanup: + - name: thunderbird + - path: {{ thunderbird.release_dir }} + - version: "{{ thunderbird.version }}" diff --git a/states/thunderbird/map.jinja b/states/thunderbird/map.jinja new file mode 100644 index 0000000..8d1b87d --- /dev/null +++ b/states/thunderbird/map.jinja @@ -0,0 +1,5 @@ +{%- import_yaml "thunderbird/defaults.yaml" as default_settings -%} + +{%- set defaults = salt['grains.filter_by'](default_settings, default='thunderbird') -%} + +{%- set thunderbird = salt['pillar.get']('thunderbird', default=defaults, merge=True) -%} diff --git a/states/thunderbird/templates/thunderbird.desktop.j2 b/states/thunderbird/templates/thunderbird.desktop.j2 new file mode 100644 index 0000000..f001e5a --- /dev/null +++ b/states/thunderbird/templates/thunderbird.desktop.j2 @@ -0,0 +1,13 @@ +## Managed by PaulBSD Salt (https://git.paulbsd.com/paulbsd/paulbsd-salt) +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Name=Thunderbird +Comment=Thunderbird mail client +Exec=/usr/local/apps/releases/thunderbird/thunderbird +Icon=/usr/local/apps/releases/thunderbird/chrome/icons/default/default128.png +Terminal=false +StartupWMClass=Thunderbird +Type=Application +Categories=Network; +X-Desktop-File-Install-Version=0.22