-
-
Save valgur/99533fa92f2c7527a22a3b2ae34fb490 to your computer and use it in GitHub Desktop.
Automatically find and 'update-alternatives --install' installed clang versions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BIN=/usr/bin | |
MAN=/usr/share/man/man1 | |
function register_clang_version { | |
BINV=$1 | |
PRIORITY=`echo $BINV | awk '{print int($1 * 10)}'` | |
update-alternatives --install $BIN/clang clang $BIN/clang-$BINV $PRIORITY \ | |
--slave $BIN/clang++ clang++ $BIN/clang++-$BINV | |
} | |
versions=`compgen -c clang++- | cut -d- -f 2` | |
echo Found clang versions: $versions | |
for version in $versions; do | |
echo Installing $version | |
register_clang_version $version | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment