From c4ab7b8bc788fc8bd053baac9a6402315ab41418 Mon Sep 17 00:00:00 2001 From: Greg Burri Date: Wed, 12 Mar 2025 23:44:34 +0100 Subject: [PATCH] Update nushell script --- deploy.nu | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/deploy.nu b/deploy.nu index a30499b..6505c47 100644 --- a/deploy.nu +++ b/deploy.nu @@ -1,14 +1,11 @@ -# 'zigbuild' is needed to build for target 'x86_64-unknown-linux-gnu' on linux: -# https://github.com/rust-cross/cargo-zigbuild - def main [host: string, destination: string, ssh_key: path] { let ssh_args = [-i $ssh_key $host] let scp_args = [-r -i $ssh_key] - let target = "x86_64-unknown-linux-gnu" + let target = "x86_64-unknown-linux-musl" let app_name = "rpi_keep_alive" let build = "release" # "debug" or "release". - def invoke_ssh [command: string] { + def invoke_ssh [command: list] { let args = $ssh_args ++ $command print $"Executing: ssh ($args)" ssh ...$args @@ -22,14 +19,14 @@ def main [host: string, destination: string, ssh_key: path] { # Don't know how to dynamically pass variable arguments. if $build == "release" { - cargo zigbuild --target $target --release + cargo build --target $target --release } else { - cargo zigbuild --target $target + cargo build --target $target } - # invoke_ssh $"systemctl stop ($app_name)" + invoke_ssh [sudo systemctl stop ($app_name)] copy_ssh ./target/($target)/($build)/($app_name) $destination - invoke_ssh $"chmod u+x ($destination)/($app_name)" - # invoke_ssh $"systemctl start ($app_name)" + invoke_ssh [chmod u+x $"($destination)/($app_name)"] + invoke_ssh [sudo systemctl start ($app_name)] print "Deployment finished" } \ No newline at end of file -- 2.49.0