From f0348415df889432ec8d7862b74b3e8822eaa4c8 Mon Sep 17 00:00:00 2001 From: colin Date: Thu, 12 Dec 2024 12:31:57 -0500 Subject: [PATCH] Update install.sh --- install.sh | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/install.sh b/install.sh index 19cf4a4..f1891a2 100644 --- a/install.sh +++ b/install.sh @@ -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