GPLv3's "How to Apply These Terms" asks for a notice in each source file; this is the modern two-line SPDX form of it rather than the full paragraph. 82 files, including tests. The blank line after the header is load-bearing. In Go a comment block immediately preceding `package X` becomes the package doc comment, so without the separator the SPDX lines would be absorbed into the doc for the eleven packages whose doc.go (or main.go) opens with one, and `go doc` would print them. Verified it doesn't.
52 lines
1.3 KiB
Go
52 lines
1.3 KiB
Go
// SPDX-FileCopyrightText: 2026 LINUXexpert-org
|
|
// 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 "run":
|
|
err = runRun(os.Args[2:])
|
|
case "status":
|
|
err = runStatus(os.Args[2:])
|
|
case "report":
|
|
err = fmt.Errorf("not implemented yet: see internal/validate")
|
|
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
|
|
run --dry-run: simulate and validate against a sandbox (real cutover isn't implemented yet)
|
|
status show the state of an in-progress or completed run
|
|
report print the validation report for a run`)
|
|
}
|