blob: 6c7d96e613a0197504ea822e91f8e5aa0dd0f3e6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
#!/bin/bash
#
# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# 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. 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
# ./install.sh --uninstall remove it
set -euo pipefail
PROJECT_VERSION="1.0.0" # bump via sed across all scripts; see CLAUDE.md Releases
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"
case "${1:-}" in
-V|--version) echo "install.sh $PROJECT_VERSION"; exit 0 ;;
--uninstall)
rm -f "$BINDIR/$PROG" && echo "removed $BINDIR/$PROG"
exit 0 ;;
esac
[[ -f "$HERE/$PROG" ]] || { echo "$PROG not found in $HERE" >&2; exit 1; }
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):"
echo " export PATH=\"$BINDIR:\$PATH\"" ;;
esac
|