diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-14 17:26:57 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-14 17:26:57 +0200 |
| commit | 15ec43e46c94adac00a92099f324f74e16ae36b4 (patch) | |
| tree | b1e260ab0bdc8fbdb8f13bcc5eb132a9efd7bfc6 | |
| parent | 3cd610c212076d438f2d1103e0fc584a310011d5 (diff) | |
| download | sbo-dockerbuild-15ec43e46c94adac00a92099f324f74e16ae36b4.tar.gz sbo-dockerbuild-15ec43e46c94adac00a92099f324f74e16ae36b4.zip | |
install.sh: seed config and overrides from examples
Install ~/.config/sbo-testbuild/{config,overrides} from the example files
on first install, skipping either if it already exists so user edits are
never clobbered. Uninstall leaves them in place (user data).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| -rwxr-xr-x | install.sh | 24 |
1 files changed, 22 insertions, 2 deletions
@@ -12,8 +12,10 @@ # GNU General Public License for more details. # # Install the test-build CLI into ~/bin (override with BINDIR=...). Copies the -# file, so re-run after editing. The image-builder scripts are NOT installed: -# they run on the docker host from their own checkout. +# file, so re-run after editing. Also seeds ~/.config/sbo-testbuild/{config, +# overrides} from the examples, but only if absent (never clobbers your edits). +# The image-builder scripts are NOT installed: they run on the docker host from +# their own checkout. # # ./install.sh install to ~/bin # BINDIR=/usr/local/bin ./install.sh @@ -23,6 +25,9 @@ set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" BINDIR="${BINDIR:-$HOME/bin}" PROG=test-build +CONFDIR="${XDG_CONFIG_HOME:-$HOME/.config}/sbo-testbuild" +CONF="$CONFDIR/config" +OVERRIDES="$CONFDIR/overrides" if [[ "${1:-}" == "--uninstall" ]]; then rm -f "$BINDIR/$PROG" && echo "removed $BINDIR/$PROG" @@ -34,6 +39,21 @@ mkdir -p "$BINDIR" install -m 0755 "$HERE/$PROG" "$BINDIR/$PROG" echo "installed $BINDIR/$PROG" +# Config + overrides: install example only if absent, never clobber user edits. +mkdir -p "$CONFDIR" +if [[ -e "$CONF" ]]; then + echo "kept existing $CONF" +else + install -m 0644 "$HERE/test-build-config.example" "$CONF" + echo "installed $CONF (edit it)" +fi +if [[ -e "$OVERRIDES" ]]; then + echo "kept existing $OVERRIDES" +else + install -m 0644 "$HERE/overrides.example" "$OVERRIDES" + echo "installed $OVERRIDES (edit it)" +fi + case ":$PATH:" in *":$BINDIR:"*) ;; *) echo "note: $BINDIR is not in \$PATH; add it (e.g. in ~/.bashrc):" |
