New VMs should come up with tmux session persistence ready instead of requiring per-VM plugin setup, and rebuilt images should stop carrying stale Docker installer scraps. Configure both image build paths to install TPM, tmux-resurrect, and tmux-continuum for root, manage a marked /root/.tmux.conf block with autosave enabled and restore left manual, and remove legacy get-docker helper files during provisioning. Update the README and repo guidance to document the rebuilt-image behavior. Verified with bash -n customize.sh, GOCACHE=/tmp/banger-gocache go test ./internal/daemon -run TestBuildProvisionScriptInstallsDefaultTools, and GOCACHE=/tmp/banger-gocache make build.
35 lines
1.5 KiB
Go
35 lines
1.5 KiB
Go
package daemon
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestBuildProvisionScriptInstallsDefaultTools(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
script := buildProvisionScript("devbox", "1.1.1.1", []string{"git", "curl"}, false)
|
|
for _, snippet := range []string{
|
|
"curl -fsSL https://mise.run | MISE_INSTALL_PATH='/usr/local/bin/mise' MISE_VERSION='v2025.12.0' sh",
|
|
"'/usr/local/bin/mise' use -g 'github:anomalyco/opencode'",
|
|
"cat > /etc/profile.d/mise.sh <<'EOF'",
|
|
"if [ -n \"${BASH_VERSION:-}\" ] && [ -x '/usr/local/bin/mise' ]; then",
|
|
`eval "$(/usr/local/bin/mise activate bash)"`,
|
|
`if ! grep -Fqx 'eval "$(/usr/local/bin/mise activate bash)"' '/etc/bash.bashrc'; then`,
|
|
`git clone --depth 1 'https://github.com/tmux-plugins/tpm' "$TMUX_PLUGIN_DIR/tpm"`,
|
|
`git clone --depth 1 'https://github.com/tmux-plugins/tmux-resurrect' "$TMUX_PLUGIN_DIR/tmux-resurrect"`,
|
|
`git clone --depth 1 'https://github.com/tmux-plugins/tmux-continuum' "$TMUX_PLUGIN_DIR/tmux-continuum"`,
|
|
"# >>> banger tmux plugins >>>",
|
|
"set -g @plugin 'tmux-plugins/tmux-resurrect'",
|
|
"set -g @plugin 'tmux-plugins/tmux-continuum'",
|
|
"set -g @continuum-save-interval '15'",
|
|
"set -g @continuum-restore 'off'",
|
|
"set -g @resurrect-dir '/root/.tmux/resurrect'",
|
|
"run '~/.tmux/plugins/tpm/tpm'",
|
|
"rm -f /root/get-docker /root/get-docker.sh /tmp/get-docker /tmp/get-docker.sh",
|
|
} {
|
|
if !strings.Contains(script, snippet) {
|
|
t.Fatalf("buildProvisionScript missing snippet %q\nscript:\n%s", snippet, script)
|
|
}
|
|
}
|
|
}
|