Last active
March 15, 2024 23:16
-
-
Save martinheidegger/40ca1a2c5fa40a5cf2718459de8ae7b4 to your computer and use it in GitHub Desktop.
OWDDM / KWDDM - 2024/03/16 - Installation Check script
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 | |
# | |
# Mac OS Test Script | |
# | |
# 1. Download to your computer as "check.sh" | |
# 2. Run in terminal using "bash check.sh" | |
# | |
set -e | |
check () { | |
if eval $1 > /dev/null; then | |
msg="installed" | |
if [[ $4 ]]; then | |
msg="$msg: $(eval $4)" | |
fi | |
echo "✅ $2 ${msg}" | |
return 0 | |
else | |
msg="" | |
if [[ "$3" ]]; then | |
msg="$msg is missing, install using: $3" | |
fi | |
echo "❌ $2${msg}" | |
return 1 | |
fi | |
} | |
qcheck () { | |
check "$1" "$2" "$3" "$4" || true | |
} | |
semver () { | |
if ! which npx >> /dev/null; then | |
return | |
fi | |
if [ "1" == "$(npx --quiet --no-install --yes git+https://github.com/Ariel-Rodriguez/sh-semversion-2.git $1 $2)" ]; then | |
check true "${3}" "$4" "echo \"${1} > ${2}\"" || true | |
else | |
check false "${3} ${1} installed but ${2} required" "${4}" || false | |
fi | |
} | |
qsemver () { | |
semver "$1" "$2" "$3" "$4" || true | |
} | |
qcheck "xcode-select -p" "XCode command line tools" "xcode-select --install" | |
qcheck "which git" "GIT" "Should have been installed with xcode-tools" "git -v" | |
if check "which node" "Node.js" "curl https://get.volta.sh | bash; volta install node"; then | |
qsemver "$(node -v)" "v18.0.0" "Node.js" "volta install latest" | |
qsemver "v$(npm -v)" "v10.0.0" "NPM" "npm i npm@latest -g" | |
fi | |
if check "which python3" "Python" "brew install python"; then | |
python_version=`python3 --version` | |
qsemver "v${python_version:7}" "v3.11.0" "Python" "brew install python" | |
fi | |
qcheck "python3 -m pip" "Pip" "python -m ensurepip --upgrade" | |
qcheck "python3 -m venv -h" "Venv" "python -m pip install --user virtualenv" | |
if check "which cmake" "CMake" "brew install cmake"; then | |
cmake_version=`cmake --version | head -n 1` | |
qsemver "v${cmake_version:14}" "v3.16" "CMake" "brew install --upgrade cmake" | |
fi | |
qcheck "which gcc" "GCC" "Install with xcode" "clang --version | head -n 1" | |
qcheck "which rustc" "Rust" "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh" "rustc --version" | |
echo "" | |
download_path="~/Downloads/notus-7b-v1.Q4_K_M.gguf" | |
read -p "Download the model file to ${download_path} (? (yes/no): " do_download | |
echo "" | |
if [ "$do_download" == "yes" ]; then | |
curl \ | |
-L \ | |
-o ~/Downloads/notus-7b-v1.Q4_K_M.gguf \ | |
"https://huggingface.co/TheBloke/notus-7B-v1-GGUF/resolve/main/notus-7b-v1.Q4_K_M.gguf?download=true" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment