2022-10-05 14:35:49 -04:00
|
|
|
include:
|
|
|
|
- chocolatey
|
|
|
|
|
|
|
|
{% import_yaml "./packages.yaml" as packages %}
|
|
|
|
|
|
|
|
# Install packages which are not installed
|
|
|
|
{% set installed_pkg_lines = salt['cmd.run']("if (Get-Command choco -ErrorAction SilentlyContinue) { choco list --local-only -r }", shell="powershell").splitlines() %}
|
|
|
|
{% set installed_pkg = installed_pkg_lines|map('method_call', 'split', '|', 1)|map(attribute=0)|map('lower')|list %}
|
|
|
|
{% for pkg in packages|difference(installed_pkg) %}
|
|
|
|
"install {{ pkg }}":
|
|
|
|
chocolatey.installed:
|
|
|
|
- name: {{ pkg }}
|
2024-03-31 23:37:31 -04:00
|
|
|
{% if pkg in packages and packages[pkg] %}
|
|
|
|
{{ packages[pkg] | dict_to_sls_yaml_params | indent }}
|
|
|
|
{% endif %}
|
2022-10-05 14:35:49 -04:00
|
|
|
- require:
|
|
|
|
- sls: chocolatey
|
|
|
|
{% endfor %}
|
|
|
|
|
|
|
|
# Update only packages that need updating
|
|
|
|
{% set outdated_pkg_lines = salt['cmd.run']("if (Get-Command choco -ErrorAction SilentlyContinue) { choco outdated -r --ignore-unfound }", shell="powershell").splitlines() %}
|
|
|
|
{% set outdated_pkg = outdated_pkg_lines|map('method_call', 'split', '|', 1)|map(attribute=0) %}
|
|
|
|
{% for pkg in outdated_pkg|difference(['chitubox', 'sketchup', 'autodesk-fusion360']) %}
|
|
|
|
"update {{ pkg }}":
|
2024-03-31 23:37:31 -04:00
|
|
|
module.run:
|
|
|
|
- chocolatey.upgrade:
|
|
|
|
- name: "{{ pkg }}"
|
|
|
|
{% if pkg in packages and packages[pkg] %}
|
|
|
|
{{ packages[pkg] | dict_to_sls_yaml_params | indent }}
|
|
|
|
{% endif %}
|
2022-10-05 14:35:49 -04:00
|
|
|
- require:
|
|
|
|
- chocolateyBootstrap
|
|
|
|
{% endfor %}
|