Created
June 5, 2015 07:18
-
-
Save vinzent/57c1448403e68aaf1650 to your computer and use it in GitHub Desktop.
Howto: easily create rpms from ruby gems for use with puppet-agent AIO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Author: Thomas Mueller <thomas@chaschperli.ch> | |
# Date: 2015-06-05 | |
# enable to exit on first error | |
# set -e | |
# list gem's to create rpm's seperated by space | |
# example for 2 gems: gem_list="r10k trocla" | |
gem_list="r10k" | |
export PATH="/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin:$PATH" | |
# requires the IMHO nice packaging tool fpm | |
# (https://github.com/jordansissel/fpm) | |
# try to install fpm if not found | |
which fpm >/dev/null || gem install fpm | |
# install gem's to a temp directory | |
gem install --no-ri --no-rdoc --install-dir /tmp/gems $gem_list | |
timestamp=$(date +%Y%m%d%H%M%S) | |
pkg_path="/tmp/gems/pkg_${timestamp}" | |
mkdir -p "$pkg_path" | |
cd "$pkg_path" | |
# gem v.1.2.0 fpm produces dependency to exact version 1.2 (without .0) | |
# use gem-disable-dependency to disable this one | |
find /tmp/gems/cache -name '*.gem' | \ | |
xargs -rn1 \ | |
fpm \ | |
--depends 'puppet-agent >= 1.0.0' \ | |
--iteration 0.el6 \ | |
--epoch 0 \ | |
--gem-package-name-prefix puppet-agent-rubygem \ | |
--gem-disable-dependency colored \ | |
-s gem \ | |
-t rpm | |
echo "RPM's are in folder: ${pkg_path}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment