# @summary Configures the Pacman package manager # @param hooks_path # Path for puppet added hooks # @param conf_path # Path for pacman configuration # @param ilovecandy # It's a secret to everybody. # @param parallel_downloads # @param mirrorlist_source # Contents of default mirrorlist file. # Mutually exclusive with $mirrorlist_content. # @param mirrorlist_content # Source url of default mirrorlist file. # Mutually exclusive with $mirrorlist_source. # @param mirrorlist_file # Path to default mirrorlist file. # @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', Boolean $ilovecandy = false, Optional[Integer] $parallel_downloads = undef, Optional[String] $mirrorlist_source = undef, Optional[String] $mirrorlist_content = undef, String $mirrorlist_file = '/etc/pacman.d/mirrorlist', Boolean $update = false, Boolean $include_default = true, ) { $hooks_ = [$hooks_path] $parallel_downloads_ = if versioncmp($facts['pacman-version'], '6.0.0') != -1 { $parallel_downloads } else { false } include pacman::setup if $update { exec { 'pacman -Sy': command => ['pacman', '-Sy'], path => ['/bin', '/usr/bin'], refreshonly => true, subscribe => Concat[$conf_path], } } concat::fragment { 'pacman.conf header': target => $conf_path, source => "puppet:///modules/${module_name}/header", order => 0, } concat::fragment { 'pacman.conf options': target => $conf_path, order => 1, content => epp("${module_name}/pacman.conf.epp"), } file { $hooks_path: ensure => directory, recurse => true, purge => true, } if $mirrorlist_source == undef and $mirrorlist_content == undef { file { $mirrorlist_file: backup => true, source => "puppet:///modules/${module_name}/mirrorlist", } } else { file { $mirrorlist_file: backup => true, source => $mirrorlist_source, content => $mirrorlist_content, } } if $include_default { pacman::repo { ['core', 'extra', 'community']: include => $mirrorlist_file, } } }