]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts/build_utils: remove duplicated get_rpm_dist()
authorKefu Chai <kchai@redhat.com>
Thu, 1 Oct 2020 10:33:02 +0000 (18:33 +0800)
committerKefu Chai <kchai@redhat.com>
Thu, 1 Oct 2020 12:16:57 +0000 (20:16 +0800)
Signed-off-by: Kefu Chai <kchai@redhat.com>
scripts/build_utils.sh

index be52ace981993fddf58bf2b3491f825c0f96c322..463ce76954240d4a1693a640ad6b69e2ec3dd5cd 100644 (file)
@@ -239,25 +239,29 @@ get_rpm_dist() {
 
     case $ID in
     RedHatEnterpriseServer)
-        DISTRO_VERSION=`$LSB_RELEASE --short --release | cut -d. -f1`
+        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
+        DIST=rhel$RELEASE
         DISTRO=rhel
         ;;
     CentOS)
-        DISTRO_VERSION=`$LSB_RELEASE --short --release | cut -d. -f1`
+        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
+        DIST=el$RELEASE
         DISTRO=centos
         ;;
     Fedora)
-        DISTRO_VERSION=`$LSB_RELEASE --short --release`
+        RELEASE=`$LSB_RELEASE --short --release`
         DISTRO=fedora
         ;;
     SUSE\ LINUX|openSUSE)
         DESC=`$LSB_RELEASE --short --description`
-        DISTRO_VERSION=`$LSB_RELEASE --short --release`
+        RELEASE=`$LSB_RELEASE --short --release`
         case $DESC in
         *openSUSE*)
+                DIST=opensuse$RELEASE
                 DISTRO=opensuse
             ;;
         *Enterprise*)
+                DIST=sles$RELEASE
                 DISTRO=sles
                 ;;
             esac
@@ -267,7 +271,8 @@ get_rpm_dist() {
         DISTRO=unknown
         ;;
     esac
-
+    DISTRO_VERSION=$RELEASE
+    echo $DIST
 }
 
 check_binary_existence () {
@@ -1088,51 +1093,6 @@ maybe_reset_ci_container() {
     fi
 }
 
-get_rpm_dist() {
-    LSB_RELEASE=/usr/bin/lsb_release
-    [ ! -x $LSB_RELEASE ] && echo unknown && exit
-
-    ID=`$LSB_RELEASE --short --id`
-
-    case $ID in
-    RedHatEnterpriseServer)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=rhel$RELEASE
-        DISTRO=rhel
-        ;;
-    CentOS)
-        RELEASE=`$LSB_RELEASE --short --release | cut -d. -f1`
-        DIST=el$RELEASE
-        DISTRO=centos
-        ;;
-    Fedora)
-        RELEASE=`$LSB_RELEASE --short --release`
-        DIST=fc$RELEASE
-        DISTRO=fedora
-        ;;
-    SUSE\ LINUX)
-        DESC=`$LSB_RELEASE --short --description`
-        RELEASE=`$LSB_RELEASE --short --release`
-        case $DESC in
-        *openSUSE*)
-                DIST=opensuse$RELEASE
-                DISTRO=opensuse
-            ;;
-        *Enterprise*)
-                DIST=sles$RELEASE
-                DISTRO=sles
-                ;;
-            esac
-        ;;
-    *)
-        DIST=unknown
-        DISTRO=unknown
-        ;;
-    esac
-
-    echo $DIST
-}
-
 setup_rpm_build_deps() {
     $SUDO yum install -y yum-utils
     if [ "$RELEASE" = 7 ]; then