From ef1f2a3caf9f2224bf5dddd04bd0c70e299db5e2 Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 21 Jan 2025 05:15:06 -0500 Subject: Switch inside a systemd-run on push This guards against network failures that may put the system in an unusable state. It's included in nixos-rebuild, so I should include it here in some form too. https://github.com/NixOS/nixpkgs/pull/258571 --- Omni/Ide/push.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'Omni/Ide/push.sh') diff --git a/Omni/Ide/push.sh b/Omni/Ide/push.sh index e16b26a..5c22e07 100755 --- a/Omni/Ide/push.sh +++ b/Omni/Ide/push.sh @@ -16,5 +16,19 @@ where=$(rg --only-matching --replace '$2' --regexp '(domainname ")(.*)(")' \ "$what/etc/systemd/system/domainname.service") nix copy --to ssh://"$USER"@"$where" "$what" ssh "$USER"@"$where" sudo nix-env --profile /nix/var/nix/profiles/system --set "$what" -ssh "$USER"@"$where" sudo "$what"/bin/switch-to-configuration switch +switch_cmd=( + systemd-run + -E LOCALE_ARCHIVE + --collect + --no-ask-password + --pipe + --quiet + --service-type=exec + --unit=push-switch-to-configuration + --wait + "$what/bin/switch-to-configuration" + "switch" +) +# shellcheck disable=SC2029 +ssh "$USER"@"$where" sudo "${switch_cmd[@]}" echo "${GRN}good: push: $target${NC}" -- cgit v1.2.3