OpenSCAD/install.sh

43 lines
975 B
Bash

#!/bin/bash
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew is not installed. Please install Homebrew first: https://brew.sh/"
exit 1
fi
if ! brew list openscad >/dev/null 2>&1; then
brew install openscad
fi
if ! [ -d ~/Documents/OpenSCAD/libraries/ ]; then
mkdir -p ~/Documents/OpenSCAD/libraries/
fi
cd ~/Documents/OpenSCAD/libraries/
if ! [ -d "BOSL2" ]; then
git clone https://github.com/BelfrySCAD/BOSL2.git
else
cd BOSL2
git pull
cd ..
fi
if ! [ -d "BOSL" ]; then
git clone https://github.com/revarbat/BOSL.git
else
cd BOSL
git pull
cd ..
fi
if ! command -v openscad >/dev/null 2>&1; then
echo "OpenSCAD installation failed. Please verify your Homebrew setup."
exit 1
fi
if [ ! -d ~/Documents/OpenSCAD/libraries/BOSL2 ] || [ ! -d ~/Documents/OpenSCAD/libraries/BOSL ]; then
echo "Library setup failed. Verify git and directory permissions."
exit 1
fi
echo "OpenSCAD and libraries successfully installed and configured."