From 2ea6e2a4dd2f3d3e7720675c69ecf2a8d08407ae Mon Sep 17 00:00:00 2001 From: Nick Timkovich Date: Sun, 12 Oct 2025 12:24:38 -0500 Subject: [PATCH 1/2] Add 'get_bosl2.sh' cloner/updater. --- get_bosl2.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 get_bosl2.sh diff --git a/get_bosl2.sh b/get_bosl2.sh new file mode 100644 index 00000000..9a00fcdc --- /dev/null +++ b/get_bosl2.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -o errexit +set -o nounset + +repo_url="https://github.com/BelfrySCAD/BOSL2.git" +lib_target_dirname="BOSL2" + +# determine lib dir +if command -v openscad &> /dev/null 2>&1; then + libdir="$(openscad --info 2>/dev/null | grep "OpenSCAD library path:" -A1 | tail -n1 | xargs)" + if [ -z "$libdir" ]; then + echo "ABORT: Could not determine OpenSCAD library path from 'openscad --info'" + exit 1 + fi + echo "OpenSCAD library path determined from 'openscad --info': $libdir" + if [ ! -d "$libdir" ]; then + echo "ABORT: Library folder does not exist." + exit 1 + fi + if [ ! -x "$libdir" ] || [ ! -w "$libdir" ]; then + echo "ABORT: Library folder is not accessible (write+execute)." + exit 1 + fi + +else + echo "Could not find 'openscad' command. Guessing library path based on OS." + + uname_out="$(uname -s)" + case "${uname_out}" in + Linux*) machine="Linux";; + Darwin*) machine="Mac";; + *) machine="UNKNOWN:${uname_out}" + esac + + if [ "$machine" == "Mac" ]; then + libdir="$HOME/Documents/OpenSCAD/libraries" + elif [ "$machine" == "Linux" ]; then + libdir="$HOME/.local/share/OpenSCAD/libraries" + else + echo "WARNING: running on an unknown system: ${machine}." + libdir="$HOME/.local/share/OpenSCAD/libraries" + fi + + if [ ! -d "$libdir" ]; then + echo "ABORT: Assumed OpenSCAD library folder '$libdir' does not exist" + exit 1 + fi +fi + +if ! command -v git &> /dev/null 2>&1; then + echo "ABORT: Git is missing. Please install git." + exit 1 +fi + +# clone or update +if [ -d "$libdir/$lib_target_dirname" ]; then + echo "Updating BOSL2 library in $libdir/$lib_target_dirname" + git -C "$libdir/$lib_target_dirname" pull +else + echo "New installation into $libdir/$lib_target_dirname" + git clone "$repo_url" "$libdir/$lib_target_dirname" +fi From bb6325384a895053f5c38ab8f857fa61c56f1954 Mon Sep 17 00:00:00 2001 From: Nick Timkovich Date: Sun, 12 Oct 2025 12:32:25 -0500 Subject: [PATCH 2/2] Update README.md --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cf2ba905..cc8f2436 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,12 @@ The BOSL2 library is an enormous library that provides many different kinds of c You can find the full BOSL2 library documentation at: https://github.com/BelfrySCAD/BOSL2/wiki -## Installation +## Automated Install/Update with Git + +`curl -sSL https://raw.githubusercontent.com/BelfrySCAD/BOSL2/refs/heads/master/get_bosl2.sh | bash` + + +## Manual Installation 1. Download the .zip or .tar.gz release file for this library. Currently you should be able to find this at https://github.com/BelfrySCAD/BOSL2/archive/refs/heads/master.zip 2. Unpack it. Make sure that you unpack the whole file structure. Some zipfile unpackers call this option "Use folder names". It should create either a `BOSL-v2.0` or `BOSL2-master` directory with the library files within it. You should see "examples", "scripts", "tests", and other subdirectories.