Skip to content

Commit

Permalink
Remove unexpected files in /etc/apt/sources.list.d
Browse files Browse the repository at this point in the history
https://salsa.debian.org/cloud-team/debian-cloud-images/-/merge_requests/279
made cloud images use a file in that directory instead of
/etc/apt/sources.list for normal system sources.
  • Loading branch information
dseomn committed Sep 30, 2023
1 parent 06942cc commit 5265509
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
20 changes: 14 additions & 6 deletions salt/file/debian/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,20 @@ preferences:
- source: salt://debian/preferences.jinja
- template: jinja

sources.list:
apt_update:
cmd.run:
- name: apt-get update

/etc/apt/sources.list:
file.managed:
- name: /etc/apt/sources.list
- source: salt://debian/sources.list.jinja
- template: jinja
cmd.run:
- name: apt-get update
- onchanges:
- file: sources.list
- onchanges_in:
- apt_update

/etc/apt/sources.list.d is clean:
file.directory:
- name: /etc/apt/sources.list.d
- clean: true
- onchanges_in:
- apt_update
16 changes: 13 additions & 3 deletions salt/file/google/chrome.sls
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,28 @@


include:
- debian
- google.repo_key

{% if grains.os_family == 'Debian' and grains.osarch == 'amd64' %}
chrome:
pkgrepo.managed:
- name: |
file.managed:
- name: /etc/apt/sources.list.d/google-chrome.list
- contents: |
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main
- file: /etc/apt/sources.list.d/google-chrome.list
- require:
- sls: google.repo_key
- require_in:
- /etc/apt/sources.list.d is clean
- onchanges_in:
- apt_update
pkg.installed:
- name: google-chrome-stable
- require:
- file: chrome
- apt_update
{% else %}
error:
cmd.run:
Expand Down
13 changes: 9 additions & 4 deletions salt/file/gvisor/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ error:
include:
- debian
- grub
Expand All @@ -32,14 +33,18 @@ include:
- source: https://gvisor.dev/archive.key
- source_hash: 14f9edb6a623b335f29d26a11e7a458652c252bce0e1f15fcc8bdf02f97283c2e2eb2de89e65cfc6088d90cf5d7410bd9dde9a2821b0beb014e7500356a0c4fc
gvisor_repo:
pkgrepo.managed:
- name: |-
file.managed:
- name: /etc/apt/sources.list.d/gvisor.list
- contents: |
deb [signed-by=/etc/apt/keyrings/gvisor.asc] https://storage.googleapis.com/gvisor/releases release main
- file: /etc/apt/sources.list.d/gvisor.list
- clean_file: true
- require:
- /etc/apt/keyrings/gvisor.asc
- require_in:
- /etc/apt/sources.list.d is clean
- onchanges_in:
- apt_update
runsc:
pkg.installed:
- require:
- gvisor_repo
- apt_update

0 comments on commit 5265509

Please sign in to comment.