added firefox state

This commit is contained in:
Paul 2022-05-26 13:25:33 +02:00
parent 8e3bed525b
commit 2b1faf1daa
5 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,10 @@
---
firefox:
enabled: true
mirror: "https://ftp.mozilla.org/pub/firefox/releases"
install_dir: "/usr/local/apps"
release_dir: "/usr/local/apps/releases"
dest_path: "/usr/local/apps/firefox-"
version: "100.0"
platform: "linux-x86_64"
lang: "en-GB"

View File

@ -0,0 +1,14 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "firefox/map.jinja" import firefox with context %}
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Name=Firefox Web browser
Comment=Firefox Web browser
Exec=/usr/bin/firefox
Icon={{ firefox.install_dir }}/firefox/browser/chrome/icons/default/default128.png
Terminal=false
StartupWMClass=firefox
Type=Application
Categories=Network;WebBrowser;
MimeType=application/pdf;application/rdf+xml;application/rss+xml;application/xhtml+xml;application/xhtml_xml;application/xml;image/gif;image/jpeg;image/png;image/webp;text/html;text/xml;x-scheme-handler/http;x-scheme-handler/https;

3
states/firefox/init.sls Normal file
View File

@ -0,0 +1,3 @@
---
include:
- .install

View File

@ -0,0 +1,45 @@
---
{%- from "firefox/map.jinja" import firefox with context %}
firefox-archive-extract:
archive.extracted:
- name: {{ firefox.release_dir }}/firefox-{{ firefox.version }}
- source: {{ firefox.mirror }}/{{ firefox.version }}/{{ firefox.platform }}/{{ firefox.lang }}/firefox-{{ firefox.version }}.tar.bz2
- skip_verify: true
- archive_format: tar
- enforce_toplevel: false
- options: --strip 1
- keep: true
- if_missing: {{ firefox.release_dir }}/firefox-{{ firefox.version }}/firefox
firefox-symlink:
file.symlink:
- name: {{ firefox.install_dir }}/firefox
- target: {{ firefox.release_dir }}/firefox-{{ firefox.version }}
- force: true
- require:
- archive: firefox-archive-extract
firefox-bin-symlink:
file.symlink:
- name: /usr/bin/firefox
- target: {{ firefox.install_dir }}/firefox/firefox
- force: true
- require:
- archive: firefox-archive-extract
firefox-shortcut:
file.managed:
- name: /usr/share/applications/firefox.desktop
- source: salt://firefox/firefox.desktop.j2
- user: root
- group: root
- mode: 644
- template: jinja
- require:
- archive: firefox-archive-extract
firefox-cleanup:
software.cleanup:
- name: firefox
- path: {{ firefox.release_dir }}
- version: "{{ firefox.version }}"

5
states/firefox/map.jinja Normal file
View File

@ -0,0 +1,5 @@
{%- import_yaml "firefox/defaults.yaml" as default_settings -%}
{%- set defaults = salt['grains.filter_by'](default_settings, default='firefox') -%}
{%- set firefox = salt['pillar.get']('firefox', default=defaults, merge=True) -%}