mirror of
https://github.com/saltstack-formulas/packages-formula.git
synced 2025-04-17 10:10:27 +00:00
Merge pull request #13 from noelmcloughlin/snapd_support
Add support for snapd package manager
This commit is contained in:
commit
0bea34be1a
7 changed files with 127 additions and 1 deletions
11
.kitchen.yml
11
.kitchen.yml
|
@ -9,11 +9,22 @@ driver_config:
|
|||
|
||||
platforms:
|
||||
- name: debian-9
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
provision_command:
|
||||
- apt-get install udev -y
|
||||
- name: ubuntu-17.10
|
||||
driver_config:
|
||||
run_command: /lib/systemd/systemd
|
||||
provision_command:
|
||||
- apt-get install udev -y
|
||||
- name: fedora-27
|
||||
driver_config:
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
- name: centos-7
|
||||
driver_config:
|
||||
image: saltstack/centos-7-minimal
|
||||
run_command: /usr/lib/systemd/systemd
|
||||
|
||||
provisioner:
|
||||
name: salt_solo
|
||||
|
|
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,13 @@ packages:
|
|||
required:
|
||||
states: []
|
||||
pkgs: []
|
||||
snaps:
|
||||
package: snapd
|
||||
collides: []
|
||||
symlink: False
|
||||
service: ['snapd',]
|
||||
wanted: []
|
||||
unwanted: []
|
||||
required:
|
||||
states: []
|
||||
pkgs: []
|
||||
|
|
|
@ -6,3 +6,4 @@ include:
|
|||
- packages.remote_pkgs
|
||||
- packages.pips
|
||||
- packages.gems
|
||||
- packages.snaps
|
||||
|
|
|
@ -10,4 +10,6 @@ Fedora:
|
|||
- gcc
|
||||
- python2-pip
|
||||
- python2-devel
|
||||
|
||||
snaps:
|
||||
collides: ['snap',]
|
||||
symlink: True
|
||||
|
|
84
packages/snaps.sls
Normal file
84
packages/snaps.sls
Normal file
|
@ -0,0 +1,84 @@
|
|||
# -*- 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 %}
|
||||
|
||||
{% if packages.snaps.wanted or packages.snaps.unwanted %}
|
||||
|
||||
### REQ PKGS (without this, SNAPS can 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 %}
|
||||
|
||||
{% if packages.snaps.symlink %}
|
||||
{# classic confinement requires snaps under /snap or symlink from #}
|
||||
{# /snap to /var/lib/snapd/snap #}
|
||||
packages-snap-classic-symlink:
|
||||
file.symlink:
|
||||
- name: /snap
|
||||
- target: /var/lib/snapd/snap
|
||||
- unless: test -d /snap
|
||||
- require:
|
||||
- pkg: pkg_req_pkgs
|
||||
- pkg: unwanted_pkgs
|
||||
{% 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 %}
|
||||
|
||||
{% endif %}
|
|
@ -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