aboutsummaryrefslogtreecommitdiffstats
path: root/pkgs/populate/README.md
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-14 04:18:14 +0000
committertv <tv@krebsco.de>2026-11-14 04:18:14 +0000
commitee3a91eada2e863a192980df1f15dedd9f397f1c (patch)
tree56794bf9ea9635dedaafa63d89838f6e3d8b1a77 /pkgs/populate/README.md
parenta9ad68526998290bf8203008d6db710727953d20 (diff)
populate: populate shell, running shell code on a target
populate shell [OPTION]... TARGET SCRIPT runs SCRIPT with /bin/sh on TARGET, reached like populate reaches it, deciding whether it's local when it runs, with local or remote as $1, so SCRIPT can tell. It takes populate's target options but --path, and --tty, giving SCRIPT a terminal on a remote target, and --local-only, failing before connecting unless the target is local. It replaces itself with the command running SCRIPT, so the exit status, the terminal, and signals are SCRIPT's. krops can run nixos-rebuild with it, which needs whether the target is local, unless it decides that during evaluation, which pure evaluation can't. The command line's parsing is shared between populate and populate shell.
Diffstat (limited to 'pkgs/populate/README.md')
-rw-r--r--pkgs/populate/README.md29
1 files changed, 29 insertions, 0 deletions
diff --git a/pkgs/populate/README.md b/pkgs/populate/README.md
index e85b502..e0015fa 100644
--- a/pkgs/populate/README.md
+++ b/pkgs/populate/README.md
@@ -86,6 +86,35 @@ Exit status:
or aren't sources.
- 129, 130, 143: populate got SIGHUP, SIGINT, or SIGTERM, and stopped.
+### populate shell
+
+```
+populate shell [OPTION]... TARGET SCRIPT
+```
+
+`populate shell` runs the shell code `SCRIPT` with `/bin/sh` on `TARGET`,
+reached like populate reaches it: directly if it's local, else via ssh.
+`SCRIPT` gets `local` or `remote` as `$1`, telling which, e.g. for using
+something on the local machine. `TARGET`'s path is unused. krops runs
+`nixos-rebuild` on targets with it.
+
+| Option | Meaning |
+|-------------------|---------------------------------------------------------|
+| `--sudo` | Run `SCRIPT` as root, via sudo on the target. |
+| `--ssh-arg ARG` | Pass `ARG` to ssh; repeatable. |
+| `--user USER` | The target's user; empty for ssh's default. |
+| `--host HOST` | The target's host. |
+| `--port PORT` | The port ssh connects to. |
+| `--local` | The target is the machine populate runs on. |
+| `--remote` | The target isn't, even if it looks so. |
+| `--tty` | Give `SCRIPT` a terminal, if the target is remote. |
+| `--local-only` | Fail, without running `SCRIPT`, unless it's local. |
+| `-h`, `--help` | Print the usage and exit. |
+
+The exit status is `SCRIPT`'s, or ssh's, if ssh fails, 1 if
+`--local-only` fails, and 2 if the command line is wrong. A file of
+sources named `shell` needs another name for populate, e.g. `./shell`.
+
## Sources