Skip to content

Commit

Permalink
install-deps.sh: install new gcc as the default the right way
Browse files Browse the repository at this point in the history
* should install software-properties-common beforehand, otherwise
  the `add-apt-repository` command will not be available.
* the update-alternative commandline were copied from ceph-build,
  should remove the escape characters.

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Dec 9, 2017
1 parent 74a132d commit 3882dea
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ function ensure_decent_gcc_on_deb {
fi

$SUDO update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-\${new} 20 \
--slave /usr/bin/g++ g++ /usr/bin/g++-\${new}
--install /usr/bin/gcc gcc /usr/bin/gcc-${new} 20 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${new}

$SUDO update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-\${old} 10 \
--slave /usr/bin/g++ g++ /usr/bin/g++-\${old}
--install /usr/bin/gcc gcc /usr/bin/gcc-${old} 10 \
--slave /usr/bin/g++ g++ /usr/bin/g++-${old}

$SUDO update-alternatives --auto gcc

Expand Down Expand Up @@ -140,9 +140,10 @@ else
$SUDO apt-get install -y dpkg-dev
case "$VERSION" in
*Trusty*)
$SUDO apt-get install -y software-properties-common
$SUDO add-apt-repository ppa:ubuntu-toolchain-r/test
$SUDO apt-get update
$SUDO apt-get install -y gcc-7
$SUDO apt-get install -y g++-7
ensure_decent_gcc_on_deb 7
;;
*)
Expand Down

0 comments on commit 3882dea

Please sign in to comment.