Update install.sh

This commit is contained in:
colin 2024-12-12 12:31:57 -05:00
parent 158552a2d4
commit f0348415df
1 changed files with 32 additions and 14 deletions

View File

@ -1,4 +1,5 @@
#!/bin/bash
#!/bin/zsh
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew is not installed. Please install Homebrew first: https://brew.sh/"
exit 1
@ -14,21 +15,36 @@ fi
cd ~/Documents/OpenSCAD/libraries/
declare -A libraries=(
["BOSL2"]="https://github.com/BelfrySCAD/BOSL2.git"
["BOSL"]="https://github.com/revarbat/BOSL.git"
["MCAD"]="https://github.com/openscad/MCAD.git"
["nutsnbolts"]="https://github.com/JohK/nutsnbolts.git"
["openscad-fillets"]="https://github.com/jfhbrook/openscad-fillets.git"
["openscad-model-library"]="https://github.com/cznewt/openscad-model-library.git"
["OpenSCAD-Arduino-Mounting-Library"]="https://github.com/kellyegan/OpenSCAD-Arduino-Mounting-Library.git"
["BezierScad"]="https://github.com/chadkirby/BezierScad.git"
["Chamfers-for-OpenSCAD"]="https://github.com/SebiTimeWaster/Chamfers-for-OpenSCAD.git"
# Separate arrays for library names and their corresponding URLs
library_names=(
"BOSL2"
"BOSL"
"MCAD"
"nutsnbolts"
"openscad-fillets"
"openscad-model-library"
"OpenSCAD-Arduino-Mounting-Library"
"BezierScad"
"Chamfers-for-OpenSCAD"
)
library_urls=(
"https://github.com/BelfrySCAD/BOSL2.git"
"https://github.com/revarbat/BOSL.git"
"https://github.com/openscad/MCAD.git"
"https://github.com/JohK/nutsnbolts.git"
"https://github.com/jfhbrook/openscad-fillets.git"
"https://github.com/cznewt/openscad-model-library.git"
"https://github.com/kellyegan/OpenSCAD-Arduino-Mounting-Library.git"
"https://github.com/chadkirby/BezierScad.git"
"https://github.com/SebiTimeWaster/Chamfers-for-OpenSCAD.git"
)
for lib in "${!libraries[@]}"; do
# Clone or update each library
for i in {1..${#library_names[@]}}; do
lib="${library_names[$i]}"
url="${library_urls[$i]}"
if ! [ -d "$lib" ]; then
git clone "${libraries[$lib]}"
git clone "$url" "$lib"
else
cd "$lib"
git pull
@ -36,12 +52,14 @@ for lib in "${!libraries[@]}"; do
fi
done
# Verify OpenSCAD installation
if ! command -v openscad >/dev/null 2>&1; then
echo "OpenSCAD installation failed. Please verify your Homebrew setup."
exit 1
fi
for lib in "${!libraries[@]}"; do
# Verify library setup
for lib in $library_names; do
if [ ! -d "$lib" ]; then
echo "Library $lib setup failed. Verify git and directory permissions."
exit 1