diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-03-21 15:51:15 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2023-03-21 16:32:22 +0100 |
commit | 8efb70c84346a3c1ea2e0582321760bad96da423 (patch) | |
tree | e3c473246f04c4a4297343e05c10c6f3aa557423 | |
parent | Basically rewrote everything. (diff) | |
download | pacman-8efb70c84346a3c1ea2e0582321760bad96da423.tar.gz pacman-8efb70c84346a3c1ea2e0582321760bad96da423.tar.xz |
Introduce include_default.
-rw-r--r-- | manifests/init.pp | 15 | ||||
-rw-r--r-- | manifests/repo.pp | 2 | ||||
-rw-r--r-- | manifests/setup.pp | 9 |
3 files changed, 20 insertions, 6 deletions
diff --git a/manifests/init.pp b/manifests/init.pp index 4deaf9a..9b65050 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,6 +9,8 @@ # @param mirrorlist # @param update # Should 'pacman -Sy' be run after changes to the configuration? +# @param include_default +# Should Archlinux' regular repositories be included class pacman ( String $hooks_path = '/etc/pacman.d/hooks-puppet', String $conf_path = '/etc/pacman.conf', @@ -16,6 +18,7 @@ class pacman ( Optional[Integer] $parallel_downloads = undef, String $mirrorlist = "puppet:///modules/${module_name}/mirrorlist", Boolean $update = false, + Boolean $include_default = true, ) { $hooks_ = [$hooks_path] $parallel_downloads_ = if versioncmp($facts['pacman-version'], '6.0.0') != -1 { @@ -24,11 +27,7 @@ class pacman ( false } - concat { $conf_path: - ensure => present, - order => 'numeric', - backup => true, - } + include pacman::setup if $update { exec { 'pacman -Sy': @@ -61,4 +60,10 @@ class pacman ( backup => true, source => $mirrorlist, } + + if $include_default { + pacman::repo { ['core', 'extra', 'community']: + include => '/etc/pacman.d/mirrorlist', + } + } } diff --git a/manifests/repo.pp b/manifests/repo.pp index 8607853..e2ee780 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -25,7 +25,7 @@ define pacman::repo ( Optional[String] $server = undef, Optional[Array[String,1]] $source = undef, ) { - require pacman + require pacman::setup if $repo_name == 'local' { fail('Repo name "local" is reserved by Pacman') diff --git a/manifests/setup.pp b/manifests/setup.pp new file mode 100644 index 0000000..3f8a31c --- /dev/null +++ b/manifests/setup.pp @@ -0,0 +1,9 @@ +# @api private +class pacman::setup ( +) { + concat { $pacman::conf_path: + ensure => present, + order => 'numeric', + backup => true, + } +} |