summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-12-14 00:58:22 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-12-14 02:16:16 +0100
commit179d21eec5e150b110196059a3ca80e7497e984b (patch)
tree15ea92424644cf797dc35d536a17003205e7c63b
parentPacman hook paths shouldn't start with '/'. (diff)
downloadpacman-179d21eec5e150b110196059a3ca80e7497e984b.tar.gz
pacman-179d21eec5e150b110196059a3ca80e7497e984b.tar.xz
Migrate stuff from ansible.
-rw-r--r--files/mirrorlist6
-rw-r--r--manifests/init.pp26
-rw-r--r--manifests/repo.pp24
3 files changed, 55 insertions, 1 deletions
diff --git a/files/mirrorlist b/files/mirrorlist
new file mode 100644
index 0000000..4ea5d0e
--- /dev/null
+++ b/files/mirrorlist
@@ -0,0 +1,6 @@
+# File managed by puppet, local changes WILL be overwritten
+
+Server = https://ftp.lysator.liu.se/pub/archlinux/$repo/os/$arch
+Server = http://ftp.lysator.liu.se/pub/archlinux/$repo/os/$arch
+Server = https://ftp.acc.umu.se/mirror/archlinux/$repo/os/$arch
+Server = http://ftp.acc.umu.se/mirror/archlinux/$repo/os/$arch
diff --git a/manifests/init.pp b/manifests/init.pp
index eadc1c2..fb23328 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -1,9 +1,9 @@
class pacman (
String $hooks_path = '/etc/pacman.d/hooks-puppet',
String $conf_path = '/etc/pacman.conf',
+ Boolean $ilovecandy = false,
) {
- # TODO ability to set multiple settings
ini_setting { 'Pacman HookDir':
path => $conf_path,
section => 'options',
@@ -12,9 +12,33 @@ class pacman (
}
+ ini_setting { 'Pacman ILoveCandy':
+ ensure => if ($ilovecandy) { present } else { absent },
+ path => '/etc/pacman.conf',
+ section => 'options',
+ setting => 'ILoveCandy',
+ key_val_separator => '',
+ value => '',
+ }
+
+ if versioncmp($facts['pacman-version'], '6.0.0') >= 0 {
+ ini_setting { 'Pacman parallel downloads':
+ path => '/etc/pacman.conf',
+ section => 'options',
+ setting => 'ParallelDownloads',
+ value => 8,
+ }
+ }
+
file { $hooks_path:
ensure => directory,
recurse => true,
purge => true,
}
+
+ file { '/etc/pacman.d/mirrorlist':
+ ensure => present,
+ backup => true,
+ source => 'puppet:///modules/pacman/mirrorlist',
+ }
}
diff --git a/manifests/repo.pp b/manifests/repo.pp
new file mode 100644
index 0000000..28f92b0
--- /dev/null
+++ b/manifests/repo.pp
@@ -0,0 +1,24 @@
+define pacman::repo (
+ Enum['present', 'absent'] $ensure = 'present',
+ String $repo_name = $name,
+ # String $include,
+ String $server,
+ String $sig_level,
+) {
+
+ ini_setting {
+ default:
+ ensure => $ensure,
+ path => $::pacman::conf_path,
+ section => $repo_name ,
+ ;
+ "Pacman repo [${repo_name}] server":
+ setting => 'Server',
+ value => $server ,
+ ;
+ "Pacman repo [${repo_name}] SigLevel":
+ setting => 'SigLevel',
+ value => $sig_level ,
+ ;
+ }
+}