]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
build/ops: fix /etc/os-release parsing in install-deps.sh
authorNathan Cutler <ncutler@suse.com>
Mon, 5 Sep 2016 13:40:33 +0000 (15:40 +0200)
committerJan Fajerski <jfajerski@suse.com>
Thu, 15 Dec 2016 21:02:29 +0000 (22:02 +0100)
85a370e35fc42031a7f7e24dea9e50a649c0f309 introduced the DISTRO variable whose
value was obtained by parsing /etc/os-release like this:

DISTRO=$(grep  "^ID=" /etc/os-release | sed "s/ID=//")

This unfortunately picks up the double-quotes, so on a CentOS system DISTRO
will be equal to '"centos"'.

Signed-off-by: Nathan Cutler <ncutler@suse.com>
(cherry picked from commit fd37e87f6de0b8e272a2859ec52d6ceab277db7a)

install-deps.sh

index 6ea1178bf2bb5b1415b93d709f9617c8cd74d870..abb2beba01600dffa0ff9d73f90703b820ec449d 100755 (executable)
@@ -19,8 +19,8 @@ if test $(id -u) != 0 ; then
 fi
 export LC_ALL=C # the following is vulnerable to i18n
 
-DISTRO=$(grep  "^ID=" /etc/os-release | sed "s/ID=//")
-case $DISTRO in
+source /etc/os-release
+case $ID in
 debian|ubuntu|devuan)
         echo "Using apt-get to install dependencies"
         $SUDO apt-get install -y lsb-release devscripts equivs
@@ -48,7 +48,7 @@ debian|ubuntu|devuan)
        $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -y remove ceph-build-deps
        if [ -n "$backports" ] ; then rm $control; fi
         ;;
-    centos|fedora|rhel)
+centos|fedora|rhel)
         echo "Using yum to install dependencies"
         $SUDO yum install -y redhat-lsb-core
         case $(lsb_release -si) in
@@ -75,14 +75,14 @@ debian|ubuntu|devuan)
         $SUDO yum-builddep -y $DIR/ceph.spec 2>&1 | tee $DIR/yum-builddep.out
         ! grep -q -i error: $DIR/yum-builddep.out || exit 1
         ;;
-    opensuse|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 "$DISTRO is unknown, dependencies will have to be installed manually."
+*)
+        echo "$ID is unknown, dependencies will have to be installed manually."
         ;;
 esac