forked from atomia/puppet-atomia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_package.sh
executable file
·52 lines (44 loc) · 1.43 KB
/
build_package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
if [ -z "$1" ]; then
echo "usage: $0 version"
exit 1
fi
gem=`whereis gem | head -n 1 | awk '{ print $2 }'`
if [ -z "$gem" ] || [ ! -x "$gem" ]; then
echo "ruby gems not found, assuming fpm isn't installed"
exit 1
fi
ruby=`head -n 1 "$gem" | sed 's/^#!//' | grep ruby`
if [ -z "$ruby" ]; then
echo "$gem isn't ruby gems, assuming fpm isn't installed"
exit 1
fi
fpm=`find /var/lib/gems/ /usr/lib*/ruby/gems/ -path "*/gems/fpm-*/bin/fpm" 2> /dev/null | sort -r | head -n 1`
if [ -z "$fpm" ]; then
echo "didn't find fpm, assuming it isn't installed"
fi
rm -f *.deb *.rpm
distributor=`lsb_release -i | awk '{ print $NF }'`
if [ -z "$distributor" ]; then
echo "lsb_release -i failed to give distro identifier"
exit 1
elif [ x"$distributor" = x"Ubuntu" -o x"$distributor" = x"Debian" ]; then
package_type="deb"
elif [ x"$distributor" = x"RedHatEnterpriseServer" ]; then
package_type="rpm"
fi
$fpm -s dir -t "$package_type" -n atomia-puppetmaster -v "$1" \
--description "Installs and configures a Puppet master for Atomia environments" \
-m "Atomia AB <[email protected]>" --vendor "Atomia AB" --url http://github.com/atomia/puppet-atomia \
--license MIT \
-d puppetmaster \
-d git \
-d apache2-utils \
-d curl \
-d rubygems-integration \
-d build-essential \
-d libmysqlclient-dev \
-d ruby-dev \
--after-install postinstall-info \
examples/=/etc/puppet-atomia/examples \
setup-puppet-atomia=/bin/setup-puppet-atomia