From 484c32fbf739ab9372baa6ab477876c012564220 Mon Sep 17 00:00:00 2001 From: mmcwilliams Date: Fri, 15 Oct 2021 02:48:50 -0400 Subject: [PATCH] Add a dep.sh file to check whether all required dependencies are installed --- scripts/cores.sh | 11 +++++++++++ scripts/deps.sh | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 scripts/cores.sh create mode 100644 scripts/deps.sh diff --git a/scripts/cores.sh b/scripts/cores.sh new file mode 100644 index 0000000..0bfa6a1 --- /dev/null +++ b/scripts/cores.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +if [[ "$OSTYPE" == "linux-gnu"* ]]; then + CORES=`grep ^cpu\\scores /proc/cpuinfo | uniq | awk '{print $4}'` +elif [[ "$OSTYPE" == "darwin"* ]]; then + CORES=`sysctl -n hw.ncpu` +else + CORES=? +fi + +echo $CORES \ No newline at end of file diff --git a/scripts/deps.sh b/scripts/deps.sh new file mode 100644 index 0000000..df4dc38 --- /dev/null +++ b/scripts/deps.sh @@ -0,0 +1,39 @@ +DEPS=( + echo + git + date + wc + grep + awk + uniq + sha256sum + zip + tar + sqlite3 + admesh + openscad +) + +for dep in ${DEPS[@]}; do + if ! command -v "${dep}" &> /dev/null + then + echo "Application ${dep} could not be found" + echo "Please install ${dep} before running the build script" + if [[ "${dep}" == "admesh" ]]; then + echo "For more information about how to install admesh https://github.com/admesh/admesh" + echo "OR https://www.howtoinstall.me/ubuntu/18-04/admesh/" + fi + echo "Individual .scad files can be compiled directly without this script" + exit 1 + fi +done + +echo "All dependencies are installed" + +VERSION=`bash ./scripts/version.sh` +CPU=`bash ./scripts/cpu.sh` +CORES=`bash ./scripts/cores.sh` + +echo "CPU: (${CORES}x) ${CPU}" +echo "OpenSCAD: ${VERSION}" +