diff options
author | Ben Sima <ben@bsima.me> | 2019-11-02 15:54:20 -0700 |
---|---|---|
committer | Ben Sima <ben@bsima.me> | 2019-11-02 17:13:04 -0700 |
commit | ed4e214d481f67f796014aa80731b6d273618b6c (patch) | |
tree | f44cd4b80de8b624f38f7637f4615b79517ee993 /chip/push | |
parent | 9d114cfc773171b0a95bd4d2c39f1bb0eb783c8d (diff) |
add common scripts, remove old scripts, update readme
Diffstat (limited to 'chip/push')
-rwxr-xr-x | chip/push | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/chip/push b/chip/push deleted file mode 100755 index f7114ed..0000000 --- a/chip/push +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env python3 - -import argparse -import os -import subprocess -import tempfile -import importlib.util -import sys - -def shell(*args): - "Run a shell command and capture the output." - try: - proc = subprocess.run(args, check=True, capture_output=True) - except subprocess.CalledProcessError as e: - print(f'! fail {e.returncode}') - print(f'! {" ".join(e.cmd)}') - print(f'! {e.stderr.strip().decode("utf8")}') - sys.exit(1) - return proc.stdout.strip().decode('utf8') - -cli = argparse.ArgumentParser(description='deploy a thing') -cli.add_argument('depo', type=str, - help='the depo roun to deploy') - -args = cli.parse_args() - -cwd = os.getcwd() -bild_dir = f"{cwd}/bild" - -src = f"{cwd}/depo/{args.depo}" -out = f"{bild_dir}/{args.depo}" - - -# bild -shell("nix-build", "-A", f"depo.{args.depo}", "--out-link", out) -print("+ bilt") - -# push -shell("nix", "copy", "--to", f"ssh://root@{args.depo}", f"{out}") -print("+ sent") - -# switch -shell("ssh", f"root@{args.depo}", "sudo", - f"{os.readlink(out)}/bin/switch-to-configuration", - "switch") -print("+ switched") - -print(f"+ pushed {args.depo}") |