sow init
sow init turns a directory into a workspace, the home of one or more
standard repositories: it creates the private .sow/ state directory, reads an existing sow.yml or sow.yaml, and writes a default sow.yml if neither configuration file exists. If the configuration already declares
repositories and Dists, it creates the ones that are missing, so you can write sow.yml first (or
keep it in version control) and let init build everything it describes. It is safe to rerun at
any time. To add one repository or Dist to an existing workspace, sow repo new and
sow dist new do the same work for a single object.
Synopsis
DIR defaults to the current directory. init takes the directory as an argument; it does not
accept -C/--workdir. An existing workspace configured with either sow.yml or sow.yaml is accepted.
Options
| Flag | Description | Default |
|---|---|---|
--passfile PATH |
Password file for this invocation | per-key config, then SOW_GPG_PASSFILE |
--json |
Output JSON | false |
-h, --help |
Show help | — |
Examples
Start an empty workspace in the current directory:
.sow/ holds private state, locks, and recovery records, with directory mode 0700. Serve the
repository directories over HTTP, never .sow/.
Then add repositories and Dists by hand:
Or install a configuration kept under version control, initialize everything it declares, and validate it:
Idempotence rules
A new configuration uses schema: sow/v3, the architectures x86_64 and aarch64, and no
repository. An existing configuration is never rewritten: init only creates declared objects
that do not exist yet, and reports zero counters when there is nothing left to create. The
directory does not have to be empty, as long as no existing file collides with a path SOW reserves.
Apply a declared configuration
When sow.yml describes repositories and Dists, init creates their directory trees, SQLite
databases, and empty indexes, and skips objects that already exist. The counters tell you what
this run created:
Each new Dist gets valid empty indexes right away, so clients can be pointed at it before it has
packages: an RPM Dist gets an empty repodata/ in each architecture view, and a DEB Dist gets
empty Packages and Packages.gz, by-hash entries, and a Release file.
A second run changes nothing:
Locking and recovery
init waits for other workspace writers to finish; it has no timeout option. If an init is
interrupted, run it again on the same directory. SOW first completes or rolls back the interrupted
operation, recreates any missing per-repository lock files under .sow/repo-locks/, and then
initializes the remaining declared objects.
If a populated .sow/ has lost .sow/workspace.lock, init stops with an integrity error rather
than guess whether a writer is active. Stop every writer, create an empty .sow/workspace.lock
with mode 0600, and rerun sow init.
Exit codes
| Code | Trigger |
|---|---|
0 |
Workspace initialized, or already initialized (no-op) |
1 |
Runtime I/O error writing the config or state directory |
2 |
Usage error, or an existing sow.yml that fails to parse or validate |
3 |
Partial success — some declared repositories/Dists were committed and at least one failed |
5 |
The workspace journal could not be recovered to a terminal state, or a populated .sow/ lost workspace.lock |
6 |
An existing file collides with a SOW reserved path, or a declared repository database requires sow repo migrate |
See also
- First Standard Repository — the ten-minute guided version
- Standard Repositories — the three-layer model
- sow.yml Reference — every configuration key
- sow repo and sow dist
- Repository Layout — what
.sow/contains