#!/usr/bin/env bash # # learn-clone.sh — clone roli-software for the Learn team. # # Skips the large submodules the Learn team doesn't need (unused sound packs + # desktop-product trees) while keeping soundware/equator/samples that the Lumi # build requires, AND does a blobless partial clone (--filter=blob:none) so git # skips downloading old file revisions you never need. Together that cuts tens of # GB. Only touches YOUR local clone; Create unaffected. # # Usage: # curl -fsSL https://clone.roli-learn.com | bash # # or, after downloading: # ./learn.sh [target-dir] # # Tip: open this URL in a browser first to read exactly what it does. # Requires: git + SSH access to WeAreROLI on GitHub. set -euo pipefail REPO="git@github.com:WeAreROLI/roli-software.git" # Target dir: # - explicit arg wins; # - else if the current dir is empty (ignoring .DS_Store), clone right here; # - else nest in ./roli-software. if [ -n "${1:-}" ]; then DIR="$1" elif [ -z "$(ls -A . 2>/dev/null | grep -v '^\.DS_Store$')" ]; then DIR="." else DIR="roli-software" fi if [ "$DIR" != "." ] && [ -e "$DIR" ]; then echo "✗ '$DIR' already exists — remove it or pass a different target dir." >&2 exit 1 fi # Make sure macOS's .DS_Store is ignored globally, so Finder dropping one inside # a submodule never shows up as a phantom "modified submodule". Idempotent, and # respects any global excludes file you already have. (A repo-local ignore can't # do this — it wouldn't apply inside submodule working trees.) echo "→ Ensuring .DS_Store is globally git-ignored…" excludes_file="$(git config --global --get core.excludesfile || true)" if [ -z "$excludes_file" ]; then excludes_file="$HOME/.gitignore_global" git config --global core.excludesfile "$excludes_file" fi excludes_file="${excludes_file/#\~/$HOME}" # expand a leading ~ if present mkdir -p "$(dirname "$excludes_file")" touch "$excludes_file" grep -qxF '.DS_Store' "$excludes_file" || echo '.DS_Store' >> "$excludes_file" echo "→ Cloning roli-software (main repo only, blobless, no submodules yet)…" # --filter=blob:none = partial clone: full history + current files, but old file # revisions are fetched on demand instead of all up front. git clone --filter=blob:none "$REPO" "$DIR" echo "→ Configuring the Learn submodule set…" # Exclude-only pathspecs: everything NOT listed here stays included. # These submodules aren't used by the Lumi build, so Learn skips them (~29 GB). # # IMPORTANT: soundware/equator/samples is deliberately KEPT — Lumi's # `rake generateSoundpacks` (LumiAppSoundPacks:Factory) builds the app's # Factory soundpack from it. The Lumi .jucer only enables Equator # (MULTISYNTH/STROBE2/CYPHER2/SWAM plugins = 0), and the items below are # desktop-product / premium-pack trees the Lumi build never references. git -C "$DIR" config --unset-all submodule.active 2>/dev/null || true for sm in \ "soundware/multisynth/samples" \ "soundware/equator2/samples" \ "soundware/equator2/samples_core" \ "soundware/equator2/equator1-legacy-samples" \ "soundware/airwaveplayer/samples/Default" \ "3rd_party/swam-resources" \ "software/airwave/player/WebGL" \ "software/roli_studio/desktop/player/resources/rsp-additional-resources"; do git -C "$DIR" config --add submodule.active ":(exclude)$sm" done echo "→ Fetching submodules (blobless)…" git -C "$DIR" submodule update --init --recursive --filter=blob:none echo "" echo "✓ Done — Learn-ready clone at: $(cd "$DIR" && pwd)" echo " Unused submodules were skipped and old file revisions are fetched on demand." echo " Future 'git pull' / submodule updates keep skipping the excluded ones" echo " (the exclusion is saved in .git/config)."