Created
April 3, 2024 01:57
-
-
Save brant-ruan/da7458f623325864a1112abf13b1e46c to your computer and use it in GitHub Desktop.
This file contains 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 | |
if [ "$(id -u)" -ne 0 ]; then | |
echo "This script must be run as root. Please use 'sudo' to run it." | |
exit 1 | |
fi | |
if [ $# -eq 0 ]; then | |
echo "Usage: $0 <version>" | |
exit 1 | |
fi | |
VERSION=$1 | |
LLVM_BIN_PATH="/usr/bin" | |
if [ -f "${LLVM_BIN_PATH}/clang-${VERSION}" ]; then | |
ln -sf "clang-${VERSION}" "${LLVM_BIN_PATH}/clang" | |
else | |
echo "clang-${VERSION} not found." | |
fi | |
for tool in $(ls ${LLVM_BIN_PATH}/llvm-*-${VERSION} 2>/dev/null); do | |
base_tool=$(echo $tool | sed -E "s/-${VERSION}$//") | |
if [ -f "$tool" ]; then | |
ln -sf "$(basename $tool)" "${base_tool}" | |
else | |
echo "$tool not found." | |
fi | |
done | |
echo "Symbolic links have been created for LLVM/Clang version ${VERSION}." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment