]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: initial distro detection based on /etc/os-release
authorJan Fajerski <jfajerski@suse.com>
Wed, 29 Jun 2016 07:40:07 +0000 (09:40 +0200)
committerJan Fajerski <jfajerski@suse.com>
Thu, 15 Dec 2016 21:02:29 +0000 (22:02 +0100)
This avoids initial distribution detection (before lsb_release is available)
based on the presence of a specific package manager. This caused an
issue with openSUSE Tumbleweed before since both zypper and apt-get are
available.

Signed-off-by: Jan Fajerski <jfajerski@suse.com>
(cherry picked from commit 85a370e35fc42031a7f7e24dea9e50a649c0f309)

install-deps.sh

index 129178fd0be612142f5a2dba941968b7c18b316e..6ea1178bf2bb5b1415b93d709f9617c8cd74d870 100755 (executable)
@@ -19,21 +19,12 @@ if test $(id -u) != 0 ; then
 fi
 export LC_ALL=C # the following is vulnerable to i18n
 
-if test -f /etc/redhat-release ; then
-    $SUDO yum install -y redhat-lsb-core
-fi
-
-if type apt-get > /dev/null 2>&1 ; then
-    $SUDO apt-get install -y lsb-release devscripts equivs
-fi
-
-if type zypper > /dev/null 2>&1 ; then
-    $SUDO zypper --gpg-auto-import-keys --non-interactive install lsb-release systemd-rpm-macros
-fi
-
-case $(lsb_release -si) in
-Ubuntu|Debian|Devuan)
-        $SUDO apt-get install -y dpkg-dev
+DISTRO=$(grep  "^ID=" /etc/os-release | sed "s/ID=//")
+case $DISTRO in
+debian|ubuntu|devuan)
+        echo "Using apt-get to install dependencies"
+        $SUDO apt-get install -y lsb-release devscripts equivs
+        $SUDO apt-get install -y dpkg-dev gcc
         if ! test -r debian/control ; then
             echo debian/control is not a readable file
             exit 1
@@ -57,7 +48,9 @@ Ubuntu|Debian|Devuan)
        $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove ceph-build-deps
        if [ -n "$backports" ] ; then rm $control; fi
         ;;
-CentOS|Fedora|RedHatEnterpriseServer)
+    centos|fedora|rhel)
+        echo "Using yum to install dependencies"
+        $SUDO yum install -y redhat-lsb-core
         case $(lsb_release -si) in
             Fedora)
                 $SUDO yum install -y yum-utils
@@ -82,12 +75,14 @@ CentOS|Fedora|RedHatEnterpriseServer)
         $SUDO yum-builddep -y $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out
         ! grep -q -i error: $DIR/yum-builddep.out || exit 1
         ;;
-*SUSE*)
+    opensuse|suse)
+        echo "Using zypper to install dependencies"
+        $SUDO zypper --gpg-auto-import-keys --non-interactive install lsb-release systemd-rpm-macros
         sed -e 's/@//g' < ceph.spec.in > $DIR/ceph.spec
         $SUDO zypper --non-interactive install $(rpmspec -q --buildrequires $DIR/ceph.spec) || exit 1
         ;;
-*)
-        echo "$(lsb_release -si) is unknown, dependencies will have to be installed manually."
+    *)
+        echo "$DISTRO is unknown, dependencies will have to be installed manually."
         ;;
 esac