Files
stalwart-migrator/cmd/stalwart-migrate/main.go
T
jcoffey-dev 77e80cb9f2 Change the copyright holder to Coffey Labs
119 SPDX-FileCopyrightText headers and the README's licence line.

The distinction that matters here: LINUXexpert-org appears in this repository
in two completely different roles. As a copyright holder in the SPDX headers,
which is what changes, and as the GitHub organisation in the module path and 64
import statements, which does not -- the repository still lives at
github.com/LINUXexpert-org/stalwart-migrator, and rewriting that would not be a
licence change, it would break the build.

Both replacements are anchored to their copyright forms, so an import path
cannot match either. Import count is 64 before and after, and go.mod is
untouched.

LICENSE untouched: the FSF's copyright on the GPL text and the "<name of
author>" placeholders are not ours to edit.

go vet, go build and go test all clean.
2026-08-30 01:28:23 -07:00

58 lines
1.5 KiB
Go

// SPDX-FileCopyrightText: 2026 Coffey Labs
// SPDX-License-Identifier: GPL-3.0-or-later
// Command stalwart-migrate drives an in-place Stalwart Mail Server upgrade
// (0.15.5 -> latest) through preflight checks, a defense-in-depth backup,
// a checkpointed migration, and post-migration validation. Recovery from a
// failed migration is the operator's own snapshot or backup and is out of
// scope for this tool - see ARCHITECTURE.md §4.8.
package main
import (
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 {
usage()
os.Exit(1)
}
var err error
switch os.Args[1] {
case "preflight":
err = runPreflight(os.Args[2:])
case "rehearse":
err = runRehearse(os.Args[2:])
case "run":
err = runRun(os.Args[2:])
case "tenants":
err = runTenants(os.Args[2:])
case "status":
err = runStatus(os.Args[2:])
case "report":
err = runReport(os.Args[2:])
default:
usage()
os.Exit(1)
}
if err != nil {
fmt.Fprintln(os.Stderr, "stalwart-migrate:", err)
os.Exit(1)
}
}
func usage() {
fmt.Fprintln(os.Stderr, `usage: stalwart-migrate <command> [flags]
commands:
preflight run read-only checks and print the migration plan
rehearse convert this instance's settings and report what will NOT carry over (read-only)
run perform the migration (needs --yes and --recovery-point-confirmed)
tenants show which tenant owns which domain, and what blocks a migration (read-only)
status show the state of an in-progress or completed run
report print the validation report for a run`)
}