summaryrefslogtreecommitdiff
path: root/manifests/arch_builder.pp
blob: 325ab3f6515d61296d0bf6f5072e9c66a1a92349 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
class profiles::arch_builder (
  Hash $conf,
  Array $package_list,
  String $package_list_file = '/usr/local/aur/aur-packages.yaml',
) {
  include ::profiles::repo
  include ::profiles::sudo

  exec { '/usr/bin/pacman -Syu --noconfirm':
  }

  ensure_packages([
    'base',
    'base-devel',
    'python',
    'python-yaml',
    # Note that auracle git is NOT in the standard repos, and needs to
    # be manually bootstraped to work
    'auracle-git',
  ])

  $aur_builder = 'aur-builder'
  $aur_home = '/usr/local/aur'

  user { $aur_builder:
    system => true,
    home   => $aur_home,
    shell  => '/usr/bin/nologin',
  }

  file { '/etc/sudoers.d/aur_builder':
    content      => "${aur_builder} ALL=(ALL) NOPASSWD: /usr/bin/pacman\n",
    validate_cmd => '/usr/bin/visudo -cf %',
  }

  $conf_override = {
    'package-list' => $package_list_file,
  }

  $yaml_settings = {
    'header' => '# This file is controlled by Puppet',
  }

  file { '/etc/xdg/aur-runner':
    ensure => directory,
  } -> file { '/etc/xdg/aur-runner/config.yaml':
    content => hash2yaml($conf + $conf_override, $yaml_settings),
  }

  file { $package_list_file:
    ensure  => file,
    force   => true,
    content => hash2yaml({ 'packages' => $package_list }, $yaml_settings),
  }


  class { 'pacman::makepkg':
    makeflags => '-j4',
    packager  => 'Hugo Hörnquist (automatically) <>',
  }
}