X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=modules%2Fbuildd%2Fmanifests%2Finit.pp;h=8f68e6905f2469c46074cd49e9a011a58b8965c5;hb=2b8edf8c18ee9f106c6007e6e00b18377cbe56ed;hp=5436b72803380d72b4f3942783fe03c077bf2bcd;hpb=a996917ed2d40e53699a6eb1a0f80e1c0c65d079;p=mirror%2Fdsa-puppet.git diff --git a/modules/buildd/manifests/init.pp b/modules/buildd/manifests/init.pp index 5436b7280..a58d1f360 100644 --- a/modules/buildd/manifests/init.pp +++ b/modules/buildd/manifests/init.pp @@ -1,41 +1,184 @@ -class buildd { - package { - "sbuild": ensure => installed; - "buildd": ensure => installed; - "buildd-builder-meta": ensure => installed; - "apt-transport-https": ensure => installed; - } - - file { - "/etc/apt/sources.list.d/buildd.list": - source => "puppet:///files/etc/apt/sources.list.d/buildd.list", - require => Package["apt-transport-https"], - } - -# THIS IS NOT READY YET -# also needs: -# apt key on the system: -# -----BEGIN PGP PUBLIC KEY BLOCK----- -# Version: GnuPG v1.4.9 (GNU/Linux) -# -# mQENBEm1IOQBCAC2D/Q3tcB+/zRx8/O4ry4hvP3JTLB+zCXcyAcIyzPdgmxNXQUZ -# IOPSIMluiJfh9Dbgwjxm9oWTkP2LobcfVzIlHA9nVonW42rhhaYJd7yQ8xQ6u15g -# 7SPNO8b8yinqm+140Sh32PZj/5YGdFf1YpJ82la8PmNFkpLQlP+Kv2hzusun1/fQ -# Ui8g81gHq+vO5XTKW06yMk87a4SHeSFEtxjIpivAx9iIpQCF8RmPs7+EbGpG1xpn -# pjD8QMzmls8yPFl/0+xh+tvIZoGogIJHDo3I1vDEUuEMqoISnBB+BjWRrcJylQW0 -# mbNyiv2AJmNEZLZG3+0KdT9txs7ZKQfsSU6VABEBAAG0J2J1aWxkZC5kZWJpYW4u -# b3JnIGFyY2hpdmUga2V5IDIwMDkvMjAxMIkBPAQTAQIAJgUCSbUg5AIbAwUJA8Jn -# AAYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEHxDG3/7kJSE/4gIAJXwWs1IaOVf -# qkQpx+ijdyLqoZWpOYeX3Vo9FF2Lk/3+tBol8QFoQoSvrQWg+aP+SXlL1PzpEOvs -# 87uqRzPvwK7B7eHlzY0mGpshXEGniHNVK4ZBh3svrVN3LwqV6lgHkNWZkBczDfvi -# E8du/UXOL7lCADqjZCPRuwGPwkWp32MbZzwRHP0pRyXttRXTDUQXwM6TUhGaHxsB -# A4K5AUsooz4PCpIiUwVmle7kGz+NrI+bbyFNJBGnSxwluxGsJayX9kaqbq9JDhsM -# i+nhFOCOXomKSbJAaoQZnpGY4fFhk14UdM7EQ9CsEpvBu2CeZu2CibmDR8hPuGMV -# duy/LOSZsT0= -# =680o -# -----END PGP PUBLIC KEY BLOCK----- -# +class buildd ($ensure=present) { + include schroot + package { 'sbuild': + ensure => installed, + tag => extra_repo, + } + package { 'libsbuild-perl': + ensure => installed, + tag => extra_repo, + before => Package['sbuild'] + } + package { 'apt-transport-https': + ensure => installed, + } + if $ensure == present { + package { 'dupload': + ensure => installed, + } + file { '/etc/dupload.conf': + source => 'puppet:///modules/buildd/dupload.conf', + require => Package['dupload'], + } + site::linux_module { 'dm_snapshot': } + include ferm::ftp_conntrack + } + + site::aptrepo { 'buildd': + ensure => absent, + } + + $suite = $::lsbdistcodename ? { + squeeze => $::lsbdistcodename, + wheezy => $::lsbdistcodename, + jessie => $::lsbdistcodename, + undef => 'squeeze', + default => 'wheezy' + } + + site::aptrepo { 'buildd.debian.org': + key => 'puppet:///modules/buildd/buildd.debian.org.gpg', + url => 'https://buildd.debian.org/apt/', + suite => $suite, + components => 'main', + require => Package['apt-transport-https'], + } + + $buildd_prop_ensure = $::hostname ? { + /^(alkman|brahms|porpora|zandonai)$/ => 'present', + default => 'absent', + } + + if ($::lsbmajdistrelease >= 8) { + file { '/etc/apt/apt.conf.d/puppet-https-buildd': + content => "Acquire::https::buildd.debian.org::CaInfo \"/etc/ssl/ca-debian/ca-certificates.crt\";\n", + } + } else { + file { '/etc/apt/apt.conf.d/puppet-https-buildd': + content => "Acquire::https::buildd.debian.org::CaInfo \"/etc/ssl/servicecerts/buildd.debian.org.crt\";\n", + } + } + site::aptrepo { 'buildd.debian.org-proposed': + ensure => $buildd_prop_ensure, + url => 'https://buildd.debian.org/apt/', + suite => "${suite}-proposed", + components => 'main', + require => [ Package['apt-transport-https'], + File['/etc/apt/apt.conf.d/puppet-https-buildd'] ], + } + + # 'bad' extension + file { '/etc/apt/preferences.d/buildd.debian.org': + ensure => absent, + } + file { '/etc/apt/preferences.d/buildd': + ensure => absent, + } + file { '/etc/cron.d/dsa-buildd': + source => 'puppet:///modules/buildd/cron.d-dsa-buildd', + require => Package['debian.org'] + } + + if ($::lsbmajdistrelease >= 7 and $::kernel == 'Linux') { + package { 'python-psutil': + ensure => installed, + } + if ($::lsbmajdistrelease >= 8) { + file { '/usr/local/sbin/buildd-schroot-aptitude-kill': + source => 'puppet:///modules/buildd/buildd-schroot-aptitude-kill', + mode => '0555', + } + } else { + file { '/usr/local/sbin/buildd-schroot-aptitude-kill': + source => 'puppet:///modules/buildd/buildd-schroot-aptitude-kill.wheezy', + mode => '0555', + } + } + } else { + file { '/usr/local/sbin/buildd-schroot-aptitude-kill': + source => 'puppet:///modules/buildd/buildd-schroot-aptitude-kill.squeeze', + mode => '0555', + } + } + file { '/etc/cron.d/puppet-buildd-aptitude': + content => "*/5 * * * * root /usr/local/sbin/buildd-schroot-aptitude-kill\n", + } + + if $has_srv_buildd { + file { '/etc/cron.d/puppet-update-buildd-schroots': + content => "13 21 * * 0 root PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin setup-all-dchroots buildd\n", + } + } + + file { '/home/buildd': + ensure => directory, + mode => '2755', + group => buildd, + owner => buildd, + } + file { '/home/buildd/build': + ensure => directory, + mode => '2750', + group => buildd, + owner => buildd, + } + file { '/home/buildd/logs': + ensure => directory, + mode => '2750', + group => buildd, + owner => buildd, + } + file { '/home/buildd/old-logs': + ensure => directory, + mode => '2750', + group => buildd, + owner => buildd, + } + file { '/home/buildd/upload-security': + ensure => directory, + mode => '2750', + group => buildd, + owner => buildd, + } + file { '/home/buildd/stats': + ensure => directory, + mode => '2755', + group => buildd, + owner => buildd, + } + file { '/home/buildd/stats/graphs': + ensure => directory, + mode => '2755', + group => buildd, + owner => buildd, + } + file { '/home/buildd/upload': + ensure => directory, + mode => '2755', + group => buildd, + owner => buildd, + } + file { '/home/buildd/.forward': + content => "|/usr/bin/buildd-mail\n", + group => buildd, + owner => buildd, + } + + if ! $::buildd_key { + exec { 'create-buildd-key': + command => '/bin/su - buildd -c \'mkdir -p -m 02700 .ssh && ssh-keygen -C "`whoami`@`hostname` (`date +%Y-%m-%d`)" -P "" -f .ssh/id_rsa -q\'', + onlyif => '/usr/bin/getent passwd buildd > /dev/null && ! [ -e /home/buildd/.ssh/id_rsa ]' + } + } + + + if $::buildd_user_exists { + exec { 'add-buildd-user-to-sbuild': + command => 'adduser buildd sbuild', + onlyif => "getent group sbuild > /dev/null && ! getent group sbuild | grep '\\' > /dev/null" + } + } }