]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
install-deps.sh: readlink /usr/bin/gcc not /usr/bin/x86_64-linux-gnu-gcc
authorKefu Chai <kchai@redhat.com>
Thu, 14 Dec 2017 13:01:43 +0000 (21:01 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 25 Dec 2017 17:12:45 +0000 (01:12 +0800)
See: http://tracker.ceph.com/issues/22220
Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 5be6ff11e536cb492dd50dedf8a04fb9acc1222e)

install-deps.sh

index 14d0470c13d18ec6bb22c88226bad2aea91213ec..59ad87a0abdb07b6006afb984a77ba3166980921 100755 (executable)
@@ -26,15 +26,19 @@ function munge_ceph_spec_in {
 
 function ensure_decent_gcc_on_deb {
     # point gcc to the one offered by distro if the used one is different
-    local old=$(readlink -e /usr/bin/x86_64-linux-gnu-gcc | cut -d'-' -f2)
+    local old=$(readlink -e /usr/bin/gcc | cut -d'-' -f2)
     local new=$1
-    if dpkg --compare-versions $old eq $new; then
+    if [ ! -f /usr/bin/gcc-${old} ]; then
+        $SUDO rm -f /usr/bin/gcc-${old}
+        $SUDO ln -sf /usr/bin/gcc-${new} /usr/bin/gcc
+        return
+    elif dpkg --compare-versions $old eq $new; then
            return
     fi
 
     cat <<EOF
-/usr/bin/x86_64-linux-gnu-gcc now points to gcc-$old, which is not the version
-shipped with the distro: gcc-$new. Reverting...
+/usr/bin/gcc now points to gcc-$old, which is not the version shipped with the
+distro: gcc-$new. Reverting...
 EOF
 
     $SUDO update-alternatives \