2014-11-25 16:25:26 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Ceph distributed storage system
|
|
|
|
#
|
|
|
|
# Copyright (C) 2014 Red Hat <contact@redhat.com>
|
|
|
|
#
|
|
|
|
# Author: Loic Dachary <loic@dachary.org>
|
|
|
|
#
|
|
|
|
# This library is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU Lesser General Public
|
|
|
|
# License as published by the Free Software Foundation; either
|
|
|
|
# version 2.1 of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
DIR=/tmp/install-deps.$$
|
|
|
|
trap "rm -fr $DIR" EXIT
|
|
|
|
mkdir -p $DIR
|
2014-12-20 17:57:59 +00:00
|
|
|
if test $(id -u) != 0 ; then
|
|
|
|
SUDO=sudo
|
|
|
|
fi
|
2015-01-25 19:45:48 +00:00
|
|
|
export LC_ALL=C # the following is vulnerable to i18n
|
2015-02-03 15:26:17 +00:00
|
|
|
|
|
|
|
if test -f /etc/redhat-release ; then
|
|
|
|
$SUDO yum install -y redhat-lsb-core
|
|
|
|
fi
|
|
|
|
|
2014-11-25 16:25:26 +00:00
|
|
|
case $(lsb_release -si) in
|
|
|
|
Ubuntu|Debian|Devuan)
|
2014-12-20 17:57:59 +00:00
|
|
|
$SUDO apt-get install -y dpkg-dev
|
2014-11-25 16:25:26 +00:00
|
|
|
touch $DIR/status
|
|
|
|
packages=$(dpkg-checkbuilddeps --admindir=$DIR debian/control 2>&1 | \
|
|
|
|
perl -p -e 's/.*Unmet build dependencies: *//;' \
|
|
|
|
-e 's/build-essential:native/build-essential/;' \
|
|
|
|
-e 's/\(.*?\)//g;' \
|
|
|
|
-e 's/ +/\n/g;' | sort)
|
|
|
|
case $(lsb_release -sc) in
|
|
|
|
squeeze)
|
|
|
|
packages=$(echo $packages | perl -pe 's/\w*babeltrace\w*//g')
|
|
|
|
;;
|
|
|
|
esac
|
2014-12-20 17:57:59 +00:00
|
|
|
$SUDO apt-get install -y $packages
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
|
|
|
CentOS|Fedora|SUSE*|RedHatEnterpriseServer)
|
|
|
|
case $(lsb_release -si) in
|
|
|
|
SUSE*)
|
2014-12-20 17:57:59 +00:00
|
|
|
$SUDO zypper -y yum-utils
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
|
|
|
*)
|
2014-12-20 17:57:59 +00:00
|
|
|
$SUDO yum install -y yum-utils
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
|
2014-12-20 17:57:59 +00:00
|
|
|
$SUDO yum-builddep -y $DIR/ceph.spec
|
2014-11-25 16:25:26 +00:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually."
|
|
|
|
;;
|
|
|
|
esac
|