Installation#
See Bash compatibility for which bash versions are supported, why 3.2 is the floor, and what that rules out.
Options#
- Vendor as a subfolder (recommended for local repos):
- Copy or symlink this folder into your project (e.g.,
scripts/script-helpers). -
Point
SCRIPT_HELPERS_DIRto that folder in your scripts andsource helpers.sh. -
Git submodule (once hosted remotely):
git submodule add -b production <repo-url> scripts/script-helpersgit submodule update --init --recursive- Source as shown in the quick start.
- Create a
scripts/update.shin your repo that runsgit submodule update --init --recursive(seedocs/usage.mdfor a sample). - Add a root-level
./updatesymlink to that script:ln -s ./scripts/update.sh ./update
Loader location#
- The loader resolves its own location automatically when you
source helpers.sh. - You can override the path via
SCRIPT_HELPERS_DIRif needed (e.g., when running from different working directories).
Dependencies#
Core
- A POSIX-ish shell (tested with bash), common coreutils.
Per-module
- logging: none.
- help: none.
- os:
sudofor privileged commands (optional). - env: none.
- file:
curlorwget; optionallydialogfor progress gauge;filefor ISO/checksum checks. - dialog:
dialog,awk,stat,curlorwgetfor downloads. - docker: Docker CLI; either
docker compose(v2) ordocker-compose(v1). - json:
jqfor JSON formatting/extraction. - ports:
lsof/ss/netstat/fuser(uses what is available); may usesudoif allowed. - browser:
xdg-open/open/giodepending on OS;nc/telnetfor port checks. - certs:
openssl; OS tools likeupdate-ca-certificates,security,trustdepending on platform; may usesudo. - hosts:
sudoto append to/etc/hosts. - clipboard:
xclipon Linux orpbcopyon macOS. - traps: none.
- ollama:
curl,git,python3,jq,dialog, and theollamaCLI (installer included for Linux/macOS).
Network and sudo notes#
- Some helpers can use network (e.g., downloads, git clone) or require elevated privileges (e.g., trust store, /etc/hosts). Those functions call out the behavior in their docs and use
run_with_optional_sudowhen appropriate.