From f9edc08d80cae5ea635ba30159133155ecdc23d7 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Sat, 12 Jul 2014 11:56:32 +0200 Subject: [PATCH] Move some of the porterbox schroot logic to the schroot module that is shared with buildd --- modules/porterbox/files/schroot-dsa/fstab | 21 ----------- .../porterbox/files/schroot-dsa/fstab-freebsd | 17 --------- modules/porterbox/manifests/init.pp | 33 ----------------- .../files/schroot-dsa/config | 0 .../99porterbox-extra-apt-options | 0 .../schroot-setup.d/99porterbox-extra-sources | 0 modules/schroot/manifests/init.pp | 37 +++++++++++++++++-- .../templates/default-mirror.erb | 0 .../{etc/schroot => }/mount-defaults.erb | 0 .../schroot/templates/schroot-dsa/fstab.erb | 25 +++++++++++++ 10 files changed, 58 insertions(+), 75 deletions(-) delete mode 100644 modules/porterbox/files/schroot-dsa/fstab delete mode 100644 modules/porterbox/files/schroot-dsa/fstab-freebsd rename modules/{porterbox => schroot}/files/schroot-dsa/config (100%) rename modules/{porterbox => schroot}/files/schroot-setup.d/99porterbox-extra-apt-options (100%) rename modules/{porterbox => schroot}/files/schroot-setup.d/99porterbox-extra-sources (100%) rename modules/{porterbox => schroot}/templates/default-mirror.erb (100%) rename modules/schroot/templates/{etc/schroot => }/mount-defaults.erb (100%) create mode 100644 modules/schroot/templates/schroot-dsa/fstab.erb diff --git a/modules/porterbox/files/schroot-dsa/fstab b/modules/porterbox/files/schroot-dsa/fstab deleted file mode 100644 index d199237cd..000000000 --- a/modules/porterbox/files/schroot-dsa/fstab +++ /dev/null @@ -1,21 +0,0 @@ -# fstab: static file system information for chroots. -# Note that the mount point will be prefixed by the chroot path -# (CHROOT_PATH) -# -# -/proc /proc none rw,bind 0 0 -/sys /sys none rw,bind 0 0 -/dev /dev none rw,bind 0 0 -/dev/pts /dev/pts none rw,bind 0 0 -/home /home none rw,bind 0 0 -/tmp /tmp none rw,bind 0 0 -tmpfs-shm /dev/shm tmpfs defaults,size=64m 0 0 - -# It may be desirable to have access to /run, especially if you wish -# to run additional services in the chroot. However, note that this -# may potentially cause undesirable behaviour on upgrades, such as -# killing services on the host. -#/run /run none rw,bind 0 0 -#/run/lock /run/lock none rw,bind 0 0 -#/dev/shm /dev/shm none rw,bind 0 0 -#/run/shm /run/shm none rw,bind 0 0 diff --git a/modules/porterbox/files/schroot-dsa/fstab-freebsd b/modules/porterbox/files/schroot-dsa/fstab-freebsd deleted file mode 100644 index 61fae346a..000000000 --- a/modules/porterbox/files/schroot-dsa/fstab-freebsd +++ /dev/null @@ -1,17 +0,0 @@ -# fstab: static file system information for chroots. -# Note that the mount point will be prefixed by the chroot path -# (CHROOT_PATH) -# -# -proc /proc linprocfs defaults 0 0 -dev /dev devfs rw,bind 0 0 -dev /dev/fd fdescfs rw,bind 0 0 -/home /home nullfs rw 0 0 -/tmp /tmp nullfs rw 0 0 - -# It may be desirable to have access to /run, especially if you wish -# to run additional services in the chroot. However, note that this -# may potentially cause undesirable behaviour on upgrades, such as -# killing services on the host. -#/run /run nullfs rw 0 0 -#/run/lock /run/lock nullfs rw 0 0 diff --git a/modules/porterbox/manifests/init.pp b/modules/porterbox/manifests/init.pp index 5f3383aee..801798578 100644 --- a/modules/porterbox/manifests/init.pp +++ b/modules/porterbox/manifests/init.pp @@ -1,39 +1,6 @@ class porterbox { include schroot - # FIXME: Refactor this to a common class when something else needs it - package { 'moreutils': - ensure => installed - } - file { '/etc/schroot/dsa': - ensure => directory, - require => Package['schroot'], - } - file { '/etc/schroot/dsa/config': - source => 'puppet:///modules/porterbox/schroot-dsa/config', - } - if ! ($::debarchitecture in ['kfreebsd-amd64', 'kfreebsd-i386']) { - file { '/etc/schroot/dsa/fstab': - source => 'puppet:///modules/porterbox/schroot-dsa/fstab', - } - } else { - file { '/etc/schroot/dsa/fstab': - source => 'puppet:///modules/porterbox/schroot-dsa/fstab-freebsd', - } - } - file { '/etc/schroot/dsa/default-mirror': - content => template('porterbox/default-mirror.erb'), - } - file { '/etc/schroot/setup.d/99porterbox-extra-apt-options': - mode => '0555', - source => 'puppet:///modules/porterbox/schroot-setup.d/99porterbox-extra-apt-options', - require => Package['schroot'], - } - file { '/etc/schroot/setup.d/99porterbox-extra-sources': - mode => '0555', - source => 'puppet:///modules/porterbox/schroot-setup.d/99porterbox-extra-sources', - require => Package['schroot'], - } file { '/usr/local/bin/dd-schroot-cmd': mode => '0555', source => 'puppet:///modules/porterbox/dd-schroot-cmd', diff --git a/modules/porterbox/files/schroot-dsa/config b/modules/schroot/files/schroot-dsa/config similarity index 100% rename from modules/porterbox/files/schroot-dsa/config rename to modules/schroot/files/schroot-dsa/config diff --git a/modules/porterbox/files/schroot-setup.d/99porterbox-extra-apt-options b/modules/schroot/files/schroot-setup.d/99porterbox-extra-apt-options similarity index 100% rename from modules/porterbox/files/schroot-setup.d/99porterbox-extra-apt-options rename to modules/schroot/files/schroot-setup.d/99porterbox-extra-apt-options diff --git a/modules/porterbox/files/schroot-setup.d/99porterbox-extra-sources b/modules/schroot/files/schroot-setup.d/99porterbox-extra-sources similarity index 100% rename from modules/porterbox/files/schroot-setup.d/99porterbox-extra-sources rename to modules/schroot/files/schroot-setup.d/99porterbox-extra-sources diff --git a/modules/schroot/manifests/init.pp b/modules/schroot/manifests/init.pp index e746990fd..2e22db30f 100644 --- a/modules/schroot/manifests/init.pp +++ b/modules/schroot/manifests/init.pp @@ -6,18 +6,47 @@ class schroot { package { 'debootstrap': ensure => installed, } - - file { '/etc/schroot/mount-defaults': - content => template('schroot/etc/schroot/mount-defaults.erb'), - require => Package['schroot'], + package { 'moreutils': + ensure => installed } + file { '/etc/default/schroot': source => 'puppet:///modules/schroot/default-schroot', require => Package['schroot'] } + file { '/etc/schroot/mount-defaults': + content => template('schroot/mount-defaults.erb'), + require => Package['schroot'], + } file { '/etc/schroot/default/nssdatabases': source => 'puppet:///modules/schroot/nssdatabases', require => Package['schroot'] } + + file { '/etc/schroot/setup.d/99porterbox-extra-apt-options': + mode => '0555', + source => 'puppet:///modules/schroot/schroot-setup.d/99porterbox-extra-apt-options', + require => Package['schroot'], + } + file { '/etc/schroot/setup.d/99porterbox-extra-sources': + mode => '0555', + source => 'puppet:///modules/schroot/schroot-setup.d/99porterbox-extra-sources', + require => Package['schroot'], + } + + file { '/etc/schroot/dsa': + ensure => directory, + require => Package['schroot'], + } + file { '/etc/schroot/dsa/default-mirror': + content => template('schroot/default-mirror.erb'), + } + file { '/etc/schroot/dsa/config': + source => 'puppet:///modules/schroot/schroot-dsa/config', + } + file { '/etc/schroot/dsa/fstab': + content => template('schroot/schroot-dsa/fstab.erb'), + require => Package['schroot'], + } } diff --git a/modules/porterbox/templates/default-mirror.erb b/modules/schroot/templates/default-mirror.erb similarity index 100% rename from modules/porterbox/templates/default-mirror.erb rename to modules/schroot/templates/default-mirror.erb diff --git a/modules/schroot/templates/etc/schroot/mount-defaults.erb b/modules/schroot/templates/mount-defaults.erb similarity index 100% rename from modules/schroot/templates/etc/schroot/mount-defaults.erb rename to modules/schroot/templates/mount-defaults.erb diff --git a/modules/schroot/templates/schroot-dsa/fstab.erb b/modules/schroot/templates/schroot-dsa/fstab.erb new file mode 100644 index 000000000..2e2cd1b0a --- /dev/null +++ b/modules/schroot/templates/schroot-dsa/fstab.erb @@ -0,0 +1,25 @@ +# fstab: static file system information for chroots. +# Note that the mount point will be prefixed by the chroot path +# (CHROOT_PATH) +# +# + +<% if scope.lookupvar('site::nodeinfo')['ldap'].has_key?('architecture') and scope.lookupvar('site::nodeinfo')['ldap']['architecture'][0].start_with?('kfreebsd') -%> +# kFreeBSD version +proc /proc linprocfs defaults 0 0 +dev /dev devfs rw,bind 0 0 +dev /dev/fd fdescfs rw,bind 0 0 +/home /home nullfs rw 0 0 +/tmp /tmp nullfs rw 0 0 + +<% else -%> +# Linux version +/proc /proc none rw,bind 0 0 +/sys /sys none rw,bind 0 0 +/dev /dev none rw,bind 0 0 +/dev/pts /dev/pts none rw,bind 0 0 +/home /home none rw,bind 0 0 +/tmp /tmp none rw,bind 0 0 +tmpfs-shm /dev/shm tmpfs defaults,size=64m 0 0 + +<% end %> -- 2.20.1