diff options
| -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):" |
