Add self-update, release 1.0.2

nscan update installs the newest release from git.micw.org, nscan
update -c only checks; --update and --check-update work as well. The
download lands next to the running binary, is started once with
--version and only then replaces it.

Once a day an ordinary run asks in the background and mentions a newer
release in the title bar and on stderr, only on a terminal and not with
NSCAN_NO_UPDATE_CHECK set. selfupdate.go is goca's copyable template.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
mikeandClaude Opus 5.5 committed 2026-10-26 16:25:36 +01:00
1 parent 60257239d7
commit c91dbe9f7d
11 files changed
+761 -16

No files matched your search

+26 -1
View File
@@ -59,7 +59,7 @@ Download the file for your system from the
| Linux, ARM64 (e.g. Pi) | `nscan-linux-arm64` |
```sh
curl -fLo nscan https://git.micw.org/mike/nscan/releases/download/1.0.1/nscan-darwin-arm64
curl -fLo nscan https://git.micw.org/mike/nscan/releases/download/1.0.2/nscan-darwin-arm64
chmod +x nscan
sudo mv nscan /usr/local/bin/
```
@@ -78,6 +78,26 @@ cd nscan
go build -o nscan .
```
### Updating
```sh
nscan update # download the newest release and replace the running binary
nscan update -c # only check
```
`--update` and `--check-update` work as well. If nscan lives in a directory you cannot
write to, such as `/usr/local/bin`, run `sudo nscan update`. The new binary is downloaded
next to the old one and started once with `--version` before it replaces the old one,
so a broken download never takes its place.
Once a day, nscan also asks git.micw.org in the background whether there is a newer
release. If so, it says so on the next run: in the title bar of the interface, and as a
line on stderr after a command. Nothing is installed without `nscan update`. The check
stays quiet when stderr is not a terminal (pipes, scripts, cron). Set
`NSCAN_NO_UPDATE_CHECK=1` to turn it off.
Self-update arrived in 1.0.2. Replace older versions by hand once.
## Quick start
```sh
@@ -173,6 +193,7 @@ nscan interfaces list network interfaces
nscan oui update download the vendor database from the IEEE
nscan oui import <file> import oui.csv/oui.txt manually
nscan oui lookup <mac> show the vendor of a MAC address
nscan update [-c] install the newest release (-c: only check)
nscan version print the version
```
@@ -250,6 +271,10 @@ nscan keeps its state in `~/.config/nscan/` (or `$XDG_CONFIG_HOME/nscan`, or
Devices are keyed by MAC address, so a custom name follows a device when its IP address
changes. Exports (<kbd>e</kbd>) go to `nscan-<date>-<time>.json` and `.csv`.
The result of the daily update check is kept in the user cache directory
(`~/Library/Caches/nscan/update.json` on macOS, `~/.cache/nscan/update.json` on Linux).
Losing it only means asking once more.
## Troubleshooting
**Only my own machine shows up (macOS).** Grant your terminal app access under