diff --git a/states/nextcloud_desktop/defaults.yaml b/states/nextcloud_desktop/defaults.yaml new file mode 100644 index 0000000..8d9cc5a --- /dev/null +++ b/states/nextcloud_desktop/defaults.yaml @@ -0,0 +1,5 @@ +--- +nextcloud_desktop: + url: https://download.nextcloud.com/desktop/releases/Linux + dest_path: /usr/bin/nextcloud + version: 3.0.1 \ No newline at end of file diff --git a/states/nextcloud_desktop/init.sls b/states/nextcloud_desktop/init.sls index b2040a2..e3429a4 100644 --- a/states/nextcloud_desktop/init.sls +++ b/states/nextcloud_desktop/init.sls @@ -1,16 +1,23 @@ --- -{%- if not salt['file.file_exists']( salt['pillar.get']('nextcloud_desktop:dest_path') ) or not salt['file.check_hash']( salt['pillar.get']('nextcloud_desktop:dest_path'), salt['pillar.get']('nextcloud_desktop:file_sha256sum') ) %} -nextcloud-install: +{%- from "nextcloud_desktop/map.jinja" import nextcloud_desktop with context %} + +nextcloud-appimage: file.managed: - - name: {{ salt['pillar.get']('nextcloud_desktop:dest_path') }} - - source: {{ salt['pillar.get']('nextcloud_desktop:url') }}/Nextcloud-{{ salt['pillar.get']('nextcloud_desktop:version') }}-x86_64.AppImage - - source_hash: sha256={{ salt['pillar.get']('nextcloud_desktop:file_sha256sum') }} + - name: {{ nextcloud_desktop.dest_path }} + - source: {{ nextcloud_desktop.url }}/Nextcloud-{{ nextcloud_desktop.version }}-x86_64.AppImage + - skip_verify: True - user: root - group: root - mode: 755 -{%- endif %} + - if_missing: {{ nextcloud_desktop.dest_path }}-{{ netxcloud.version }} -nextcloud-icon: +nextcloud-install-link: + file.symlink: + - name: {{ nextcloud_desktop.dest_path }} + - target: {{ nextcloud_desktop.dest_path }}/{{ nextcloud.version }} + - force: True + +nextcloud-desktop-icon: file.managed: - name: /usr/share/icons/nextcloud.png - source: salt://nextcloud_desktop/nextcloud.png @@ -18,7 +25,7 @@ nextcloud-icon: - group: root - mode: 644 -nextcloud-desktop-entry: +nextcloud-desktop-icon-entry: file.managed: - name: /usr/share/applications/nextcloud.desktop - source: salt://nextcloud_desktop/nextcloud.desktop diff --git a/states/nextcloud_desktop/map.jinja b/states/nextcloud_desktop/map.jinja new file mode 100644 index 0000000..19a4e12 --- /dev/null +++ b/states/nextcloud_desktop/map.jinja @@ -0,0 +1,5 @@ +{%- import_yaml "nextcloud_desktop/defaults.yaml" as default_settings -%} + +{%- set defaults = salt['grains.filter_by'](default_settings, default='nextcloud_desktop') -%} + +{%- set nextcloud_desktop = salt['pillar.get']('nextcloud_desktop', default=defaults, merge=True) -%} \ No newline at end of file