diff options
-rw-r--r-- | README | 19 | ||||
-rw-r--r-- | manifests/init.pp | 47 | ||||
-rw-r--r-- | templates/distributions.erb | 6 | ||||
-rw-r--r-- | templates/reprepro-export-key.sh.erb | 7 |
4 files changed, 68 insertions, 11 deletions
@@ -0,0 +1,19 @@ +Variables +========= + +$reprepro_manage_distributions_conf, $reprepro_manage_incoming_conf +------------------------------------------------------------------- + +If true, the content of -respectively- the conf/distributions and +conf/incoming files is managed by this module. Else, only the +existence, ownership and permissions are. + +Default: true. + +$reprepro_incoming_mode +----------------------- + +This module manages the reprepro incoming directory and sets its +permissions to $reprepro_incoming_mode. + +Default: 1777 diff --git a/manifests/init.pp b/manifests/init.pp index 2d2aa30..bbeb17c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -1,5 +1,13 @@ class reprepro { + case $reprepro_manage_distributions_conf { + '': { $reprepro_manage_distributions_conf = true } + } + + case $reprepro_manage_incoming_conf { + '': { $reprepro_manage_incoming_conf = true } + } + case $reprepro_origin { '': { $reprepro_origin = $domain } } @@ -17,17 +25,20 @@ class reprepro { etch: { package { "reprepro": ensure => '3.9.2-1~bpo40+1'; - "inoticoming": ensure => '0.2.0-1~bpo40+1'; } } default: { package { "reprepro": ensure => 'installed'; - "inoticoming": ensure => 'installed'; } } } + $incoming_mode = $reprepro_incoming_mode ? { + '' => 1777, + default => $reprepro_incoming_mode, + } + user { "reprepro": ensure => "present", home => "$basedir", @@ -66,7 +77,7 @@ class reprepro { "$basedir/incoming": ensure => directory, - mode => 1777, owner => reprepro, group => reprepro; + mode => $incoming_mode, owner => reprepro, group => reprepro; "$basedir/logs": ensure => directory, @@ -77,16 +88,14 @@ class reprepro { mode => 0775, owner => reprepro, group => reprepro; "$basedir/conf/distributions": - mode => 0664, owner => root, group => reprepro, - content => template("reprepro/distributions.erb"); + mode => 0664, owner => root, group => reprepro; "$basedir/conf/uploaders": mode => 0660, owner => root, group => reprepro, content => template("reprepro/uploaders.erb"); "$basedir/conf/incoming": - mode => 0664, owner => root, group => reprepro, - source => "puppet://$server/modules/reprepro/incoming"; + mode => 0664, owner => root, group => reprepro; "$basedir/index.html": mode => 0664, owner => root, group => reprepro, @@ -108,6 +117,18 @@ class reprepro { mode => 755, } + if $reprepro_manage_distributions_conf { + File["$basedir/conf/distributions"] { + content => template("reprepro/distributions.erb") + } + } + + if $reprepro_manage_incoming_conf { + File["$basedir/conf/incoming"] { + source => "puppet://$server/modules/reprepro/incoming" + } + } + exec { "reprepro -b $basedir createsymlinks": refreshonly => true, @@ -140,6 +161,18 @@ class reprepro::cron inherits reprepro { } class reprepro::inotify inherits reprepro { + case $lsbdistcodename { + etch: { + package { + "inoticoming": ensure => '0.2.0-1~bpo40+1'; + } + } + default: { + package { + "inoticoming": ensure => 'installed'; + } + } + } file { "/etc/init.d/reprepro": owner => root, group => root, mode => 0755, source => "puppet://$server/modules/reprepro/inoticoming.init"; diff --git a/templates/distributions.erb b/templates/distributions.erb index e004778..233f2b9 100644 --- a/templates/distributions.erb +++ b/templates/distributions.erb @@ -29,12 +29,12 @@ Codename: squeeze Version: 6.0 Architectures: i386 amd64 source kfreebsd-amd64 kfreebsd-i386 Components: main non-free contrib -Description: koumbit specific (or backported) packages +Description: <%= reprepro_origin %> specific (or backported) packages SignWith: yes Uploaders: uploaders -Origin: koumbit -Label: koumbit +Origin: <%= reprepro_origin %> +Label: <%= reprepro_origin %> Suite: testing Pull: unstable Codename: wheezy diff --git a/templates/reprepro-export-key.sh.erb b/templates/reprepro-export-key.sh.erb index c99f06b..2b97585 100644 --- a/templates/reprepro-export-key.sh.erb +++ b/templates/reprepro-export-key.sh.erb @@ -3,5 +3,10 @@ KEY="`gpg --homedir <%= basedir %>/.gnupg --with-colon --list-secret-keys | cut -d : -f 5 | head -n 1`" if [ ! -z "$KEY" ]; then - gpg --homedir <%= basedir %>/.gnupg --export --armor $KEY > <%= basedir %>/key.asc + tempfile=$(mktemp) + destfile=<%= basedir %>/key.asc + gpg --homedir <%= basedir %>/.gnupg --export --armor $KEY > "$tempfile" + mv "$tempfile" "$destfile" + chown reprepro:reprepro "$destfile" + chmod 0664 "$destfile" fi |