From 97107ce5ec43d580455ccae1d96e64ee56f20754 Mon Sep 17 00:00:00 2001
From: Ian Wienand <iwienand@redhat.com>
Date: Tue, 8 Dec 2015 10:08:42 +1100
Subject: [PATCH] Comment out /run/systemd confine for Fedora puppet

Upstream puppet has a constraint on matching systemd that /run/systemd
has to be around; this fails when building with dib in a chroot where
we're not actually running.

A full solution has to take into account Debian and multiple init
systems (see linked issues).  For the moment, just comment it out.

Change-Id: I6e4832caf6162a67408c34151b6e1d641a75fb8b
---
 install_puppet.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/install_puppet.sh b/install_puppet.sh
index 17d75f4aea..8972fbcef0 100755
--- a/install_puppet.sh
+++ b/install_puppet.sh
@@ -84,6 +84,16 @@ function setup_puppet_fedora {
     ln -fs /usr/bin/pip /usr/bin/pip-python
     # Wipe out templatedir so we don't get warnings about it
     sed -i '/templatedir/d' /etc/puppet/puppet.conf
+
+    # upstream is currently looking for /run/systemd files to check
+    # for systemd.  This fails in a chroot where /run isn't mounted
+    # (like when using dib).  Comment out this confine as fedora
+    # always has systemd
+    #  see
+    #   https://github.com/puppetlabs/puppet/pull/4481
+    #   https://bugzilla.redhat.com/show_bug.cgi?id=1254616
+    sudo sed -i.bak  '/^[^#].*/ s|\(^.*confine :exists => \"/run/systemd/system\".*$\)|#\ \1|' \
+        /usr/share/ruby/vendor_ruby/puppet/provider/service/systemd.rb
 }
 
 function setup_puppet_rhel7 {