summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpackages/brpm30
-rw-r--r--packages/redhat/cloud-init.spec6
2 files changed, 33 insertions, 3 deletions
diff --git a/packages/brpm b/packages/brpm
index 081d092b..b505e6b4 100755
--- a/packages/brpm
+++ b/packages/brpm
@@ -9,6 +9,8 @@ import sys
import tempfile
import re
+import argparse
+
import tempita
from datetime import datetime
@@ -104,7 +106,7 @@ def warn(msg):
print("WARNING: %s" % (msg))
-def generate_spec_contents(tmpl_fn, revno, version):
+def generate_spec_contents(args, tmpl_fn, revno, version):
# Tmpl params
subs = {}
@@ -172,6 +174,22 @@ def generate_spec_contents(tmpl_fn, revno, version):
'%{_bindir}/*',
'/usr/lib/cloud-init/*',
]
+ # Since setup.py installs them
+ # all, we need to selectively
+ # knock off the wrong ones and
+ # ensure the right one is kept
+ post_remove_keep = {
+ 'initd': '/etc/init.d/',
+ 'systemd': '/etc/systemd/',
+ 'upstart': '/etc/init/',
+ }
+ post_remove = []
+ for (k, v) in post_remove_keep.iteritems():
+ if k != args.boot:
+ post_remove.append(v)
+ else:
+ other_files.append(v)
+ subs['post_remove'] = post_remove
subs['files'] = other_files
with open(tmpl_fn, 'r') as fh:
@@ -188,6 +206,13 @@ def archive_code():
def main():
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-b", "--boot", dest="boot",
+ help="select boot type (default: %(default)s)",
+ metavar="TYPE", default='initd',
+ choices=['upstart', 'initd', 'systemd'])
+ args = parser.parse_args()
# Clean out the root dir and make sure the dirs we want are in place
root_dir = os.path.expanduser("~/rpmbuild")
@@ -207,7 +232,8 @@ def main():
# Form the spec file to be used
tmpl_fn = os.path.join(os.getcwd(), 'redhat', 'cloud-init.spec')
info("Generated spec file from template %r" % (tmpl_fn))
- (base_name, arc_name, contents) = generate_spec_contents(tmpl_fn,
+ (base_name, arc_name, contents) = generate_spec_contents(args,
+ tmpl_fn,
revno, version)
spec_fn = os.path.join(root_dir, 'cloud-init.spec')
with open(spec_fn, 'w') as fh:
diff --git a/packages/redhat/cloud-init.spec b/packages/redhat/cloud-init.spec
index f0c874ee..ddb6617d 100644
--- a/packages/redhat/cloud-init.spec
+++ b/packages/redhat/cloud-init.spec
@@ -37,11 +37,15 @@ ssh keys and to let the user run various scripts.
%build
%{__python} setup.py build
-
%install
rm -rf $RPM_BUILD_ROOT
%{__python} setup.py install -O1 --skip-build --root $RPM_BUILD_ROOT
+# Remove anything after it was installed??
+{{for r in post_remove}}
+rm -rfv $RPM_BUILD_ROOT/{{r}}
+{{endfor}}
+
%clean
rm -rf $RPM_BUILD_ROOT