mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-16 09:40:23 +00:00
Add support for snapd package manager
This commit is contained in:
parent
4a404cb6e8
commit
4816786311
5 changed files with 96 additions and 0 deletions
12
README.rst
12
README.rst
|
@ -127,6 +127,18 @@ You can specify:
|
|||
* ``required states`` on which any of the ``wanted`` packages depend for their
|
||||
correct installation (ie, ``epel`` for RedHat families).
|
||||
|
||||
``packages.snaps``
|
||||
-----------------
|
||||
|
||||
You can specify:
|
||||
|
||||
* ``wanted`` snapd packages, which will be installed using snap.
|
||||
* ``unwanted`` snapd packages, which will be uninstalled using snap.
|
||||
* ``required system packages`` on which any of the ``wanted`` snapd packages
|
||||
depend for their correct installation.
|
||||
* ``required states`` on which any of the ``wanted`` packages depend for their
|
||||
correct installation (ie, ``epel`` for RedHat families).
|
||||
|
||||
``packages.remote_pkgs``
|
||||
------------------------
|
||||
|
||||
|
|
|
@ -21,3 +21,12 @@ packages:
|
|||
required:
|
||||
states: []
|
||||
pkgs: []
|
||||
snaps:
|
||||
package: snapd
|
||||
collides: ['snap',]
|
||||
service: ['snapd.service', 'snapd.socket',]
|
||||
wanted: []
|
||||
unwanted: []
|
||||
required:
|
||||
states: []
|
||||
pkgs: []
|
||||
|
|
|
@ -6,3 +6,4 @@ include:
|
|||
- packages.remote_pkgs
|
||||
- packages.pips
|
||||
- packages.gems
|
||||
- packages.snaps
|
||||
|
|
68
packages/snaps.sls
Normal file
68
packages/snaps.sls
Normal file
|
@ -0,0 +1,68 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# vim: ft=sls
|
||||
{% from "packages/map.jinja" import packages with context %}
|
||||
|
||||
{% set req_states = packages.snaps.required.states %}
|
||||
{% set wanted_snaps = packages.snaps.wanted %}
|
||||
{% set unwanted_snaps = packages.snaps.unwanted %}
|
||||
|
||||
### REQ PKGS (without these, some WANTED SNAPS fail to install/uninstall)
|
||||
include:
|
||||
- packages.pkgs
|
||||
|
||||
extend:
|
||||
unwanted_pkgs:
|
||||
pkg.removed:
|
||||
- pkgs: {{ packages.snaps.collides }}
|
||||
{% if req_states %}
|
||||
- require:
|
||||
{% for dep in req_states %}
|
||||
- sls: {{ dep }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
pkg_req_pkgs:
|
||||
pkg.installed:
|
||||
- pkgs: [ {{ packages.snaps.package }}, ]
|
||||
{% if req_states %}
|
||||
- require:
|
||||
{% for dep in req_states %}
|
||||
- sls: {{ dep }}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% for snap in packages.snaps.service %}
|
||||
packages-{{ snap }}-service:
|
||||
service.running:
|
||||
- name: {{ snap }}
|
||||
- enable: true
|
||||
- require:
|
||||
- pkg: pkg_req_pkgs
|
||||
- pkg: unwanted_pkgs
|
||||
{% endfor %}
|
||||
|
||||
### SNAPS to install
|
||||
|
||||
{% for snap in wanted_snaps %}
|
||||
packages-snapd-{{ snap }}-wanted:
|
||||
cmd.run:
|
||||
- name: snap install {{ snap }}
|
||||
- unless: snap list {{ snap }}
|
||||
- output_loglevel: quiet
|
||||
- require:
|
||||
- pkg: pkg_req_pkgs
|
||||
- pkg: unwanted_pkgs
|
||||
{% endfor %}
|
||||
|
||||
### SNAPS to uninstall
|
||||
|
||||
{% for snap in unwanted_snaps %}
|
||||
packages-snapd-{{ snap }}-unwanted:
|
||||
cmd.run:
|
||||
- name: snap remove {{ snap }}
|
||||
- onlyif: snap list {{ snap }}
|
||||
- output_loglevel: quiet
|
||||
- require:
|
||||
- pkg: pkg_req_pkgs
|
||||
- pkg: unwanted_pkgs
|
||||
{% endfor %}
|
||||
|
|
@ -38,6 +38,12 @@ packages:
|
|||
- diff-lcs
|
||||
- kitchen-vagrant
|
||||
- kwalify
|
||||
snaps:
|
||||
wanted:
|
||||
- hello-world
|
||||
unwanted:
|
||||
- goodbye-world
|
||||
|
||||
remote_pkgs:
|
||||
zoom: 'https://zoom.us/client/latest/zoom_amd64.deb'
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue