openwrt fixes
This commit is contained in:
1 parent
e3866d75a9
commit
96efbd3bc9
5 files changed
+9
-6
No files matched your search
+5
-2
@@ -300,10 +300,11 @@ export def "skyg openwrt" [
|
|||||||
--dry-run # Render configs to .tmp/openwrt-<router>/ without touching the router
|
--dry-run # Render configs to .tmp/openwrt-<router>/ without touching the router
|
||||||
] {
|
] {
|
||||||
cd $REPO_ROOT
|
cd $REPO_ROOT
|
||||||
|
let decrypted_file = skyg decrypt $"($router).json"
|
||||||
if $dry_run {
|
if $dry_run {
|
||||||
bash -c $"export SKYG_ROUTER=($router); age -d -i ~/.ssh/id_ed25519 secrets/($router).json.age | nix run .#openwrt-($router)-dry-run"
|
^cat $decrypted_file | nix run .#openwrt-($router)-dry-run -- ($router)
|
||||||
} else {
|
} else {
|
||||||
bash -c $"age -d -i ~/.ssh/id_ed25519 secrets/($router).json.age | nix run .#openwrt-($router)"
|
^cat $decrypted_file | nix run .#openwrt-($router)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,6 +338,7 @@ export def "skyg decrypt" [secret: string@secret-names] {
|
|||||||
let dest = $".tmp/unencrypted-($secret)"
|
let dest = $".tmp/unencrypted-($secret)"
|
||||||
agenix -d $src | save -f $dest
|
agenix -d $src | save -f $dest
|
||||||
print $"Decrypted to ($dest)"
|
print $"Decrypted to ($dest)"
|
||||||
|
return $dest
|
||||||
}
|
}
|
||||||
|
|
||||||
# Encrypt a file to secrets/ folder (re-encrypts using agenix)
|
# Encrypt a file to secrets/ folder (re-encrypts using agenix)
|
||||||
@@ -355,6 +357,7 @@ export def "skyg encrypt" [secret: string@secret-names, source?: string] {
|
|||||||
let dest = $"secrets/($secret).age"
|
let dest = $"secrets/($secret).age"
|
||||||
cat $src | EDITOR="cp /dev/stdin" agenix -e $dest
|
cat $src | EDITOR="cp /dev/stdin" agenix -e $dest
|
||||||
print $"Encrypted ($dest)"
|
print $"Encrypted ($dest)"
|
||||||
|
return $dest
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compare unencrypted local version with encrypted version of a secret
|
# Compare unencrypted local version with encrypted version of a secret
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
mandatoryFeatures = [ ];
|
mandatoryFeatures = [ ];
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
hostName = "root@hl-fwdesk.lab.internal";
|
hostName = "root@fwdesk.lab.internal";
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
protocol = "ssh-ng";
|
protocol = "ssh-ng";
|
||||||
maxJobs = 4;
|
maxJobs = 4;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ age -d secrets/glmain.json.age | openwrt-deploy
|
|||||||
|
|
||||||
`openwrt-dry-run` renders the same three configs **locally** and writes them to
|
`openwrt-dry-run` renders the same three configs **locally** and writes them to
|
||||||
`.tmp/openwrt-<router>/` for review — no SSH, no `uci`, no confirm prompt. The router name
|
`.tmp/openwrt-<router>/` for review — no SSH, no `uci`, no confirm prompt. The router name
|
||||||
comes from the `SKYG_ROUTER` env var (default `glmain`).
|
is passed as a command-line argument (default `glmain`).
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
skyg openwrt --dry-run
|
skyg openwrt --dry-run
|
||||||
|
|||||||
@@ -118,10 +118,10 @@ let
|
|||||||
|
|
||||||
# Dry-run: render the configs locally and write them to .tmp/openwrt-<router>/
|
# Dry-run: render the configs locally and write them to .tmp/openwrt-<router>/
|
||||||
# for review. No SSH, no uci, no router changes. Run from the repo root.
|
# for review. No SSH, no uci, no router changes. Run from the repo root.
|
||||||
# The router name is taken from $SKYG_ROUTER (default glmain).
|
# The router name is passed as $1 (defaults to glmain).
|
||||||
dryRunScript = pkgs.writeShellScriptBin "openwrt-dry-run" ''
|
dryRunScript = pkgs.writeShellScriptBin "openwrt-dry-run" ''
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
ROUTER="$'{SKYG_ROUTER:-glmain}"
|
if [ $# -ge 1 ]; then ROUTER="$1"; else ROUTER=glmain; fi
|
||||||
OUTDIR=".tmp/openwrt-$ROUTER"
|
OUTDIR=".tmp/openwrt-$ROUTER"
|
||||||
mkdir -p "$OUTDIR"
|
mkdir -p "$OUTDIR"
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in new issue
Block a user