Release 1.3.2
Interactive installer: prompt before replacing an existing install or overwriting an existing config, reading answers from /dev/tty so it works under 'curl ... | sh'. Falls back to the prior non-interactive contract when no terminal is available. MOVE_FORCE=1 skips all prompts; new MOVE_RESEED_CONFIG=1 reseeds the config unattended (old file kept as .bak). Fix: install.sh no longer wipes a working install before downloading. The tree is built in a staging dir and swapped into place only once complete, so a failed download/extract/build leaves the existing install intact.
This commit is contained in:
@@ -33,14 +33,38 @@ The installer respects the XDG Base Directory Specification:
|
||||
`XDG_BIN_HOME` is the widely-recognized de facto convention; XDG itself
|
||||
doesn't standardize a user bin dir.
|
||||
|
||||
### Reinstalling over an existing install
|
||||
|
||||
The installer never replaces an existing install silently. When it finds
|
||||
one and it can reach a terminal, it tells you what's there and asks:
|
||||
|
||||
```
|
||||
==> Found an existing move install (v1.2.0) at /home/you/.local/share/move
|
||||
Replace it with master? [Y/n]
|
||||
```
|
||||
|
||||
If a config file already exists, it asks separately whether to overwrite
|
||||
it with the shipped defaults (default: no). Both questions come *before*
|
||||
anything is downloaded or deleted, so declining costs you nothing.
|
||||
|
||||
This works under `curl ... | sh` too: the prompts read from `/dev/tty`
|
||||
rather than stdin, which the piped script itself occupies.
|
||||
|
||||
With no terminal available — CI, cron, a container build — there's nobody
|
||||
to ask, so the installer falls back to its long-standing behavior: an
|
||||
identical version is a no-op, a different version is replaced, and your
|
||||
config is left alone. Use the env vars below to drive it explicitly.
|
||||
|
||||
Env vars (all optional):
|
||||
|
||||
| Var | Default | Purpose |
|
||||
| --- | ------- | ------- |
|
||||
| `MOVE_VERSION` | `master` | Branch or tag to install. Pin with e.g. `v1.0.0`. |
|
||||
| `MOVE_FORCE` | unset | Set to `1` to reinstall when the same version is already present. |
|
||||
| `MOVE_FORCE` | unset | Set to `1` to skip every prompt and reinstall unconditionally. Never touches your config. |
|
||||
| `MOVE_RESEED_CONFIG` | unset | Set to `1` to overwrite your config with the shipped defaults without asking. The old file is kept as `config.json.bak`. |
|
||||
| `XDG_DATA_HOME` | `$HOME/.local/share` | Where the source tree is installed (under `move/`). |
|
||||
| `XDG_BIN_HOME` | `$HOME/.local/bin` | Where the `move` wrapper is placed. |
|
||||
| `XDG_CONFIG_HOME` | `$HOME/.config` | Where the config file lives (under `move/`). |
|
||||
|
||||
Bun must already be installed; the installer fails with a clear pointer
|
||||
to <https://bun.sh> if it isn't.
|
||||
@@ -123,11 +147,14 @@ ${XDG_CONFIG_HOME:-$HOME/.config}/move/config.json
|
||||
```
|
||||
|
||||
The installer seeds this file with the default values on a fresh install,
|
||||
**only if no file already exists at that path**. Existing configs — yours
|
||||
or from a previous install — are never overwritten. If you remove the
|
||||
file later, `move` still works: missing defaults fall back to the values
|
||||
baked into the binary (which match what was seeded, since both come from
|
||||
`scripts/config.default.json`).
|
||||
**only if no file already exists at that path**. An existing config —
|
||||
yours or from a previous install — is never overwritten silently: the
|
||||
installer asks first, and replaces it only if you say yes (or if you set
|
||||
`MOVE_RESEED_CONFIG=1`), keeping the old file as `config.json.bak` either
|
||||
way. `MOVE_FORCE=1` reinstalls the software but leaves your config alone.
|
||||
If you remove the file later, `move` still works: missing defaults fall
|
||||
back to the values baked into the binary (which match what was seeded,
|
||||
since both come from `scripts/config.default.json`).
|
||||
|
||||
Pass `-C` / `--config <path>` to point at a different file; in that mode
|
||||
the file must exist.
|
||||
|
||||
Reference in New Issue
Block a user