Unverified Commit aaac31c8 authored by Mogeko's avatar Mogeko
Browse files

rke2: include killall script in the bin

Add `fix-systemd-unit-name.patch` to patch the killall script
parent 3ed0e682
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -7,6 +7,9 @@ lib: { rke2Version, rke2RepoSha256, rke2VendorHash, updateScript
# Runtime dependencies
, procps, coreutils, util-linux, ethtool, socat, iptables, bridge-utils, iproute2, kmod, lvm2

# Killall Script dependencies
, systemd, gnugrep, gnused

# Testing dependencies
, nixosTests, testers, rke2
}:
@@ -41,6 +44,9 @@ buildGoModule rec {
    lvm2 # dmsetup
  ];

  # Patch the systemd unit name to be `rke2.service`.
  patches = [ ./fix-systemd-unit-name.patch ];

  # See: https://github.com/rancher/rke2/blob/e7f87c6dd56fdd76a7dab58900aeea8946b2c008/scripts/build-binary#L27-L38
  ldflags = [
    "-w"
@@ -72,6 +78,11 @@ buildGoModule rec {
    install -D $GOPATH/bin/rke2 $out/bin/rke2
    wrapProgram $out/bin/rke2 \
      --prefix PATH : ${lib.makeBinPath buildInputs}

    install -D ./bundle/bin/rke2-killall.sh $out/bin/rke2-killall.sh
    wrapProgram $out/bin/rke2-killall.sh \
      --prefix PATH : ${lib.makeBinPath [ systemd gnugrep gnused ]} \
      --prefix PATH : ${lib.makeBinPath buildInputs}
  '';

  doCheck = false;
+14 −0
Original line number Diff line number Diff line
diff --git a/bundle/bin/rke2-killall.sh b/bundle/bin/rke2-killall.sh
index 1099ad90..db8a7ea9 100755
--- a/bundle/bin/rke2-killall.sh
+++ b/bundle/bin/rke2-killall.sh
@@ -54,8 +54,7 @@ export PATH=$PATH:/var/lib/rancher/rke2/bin
 
 set -x
 
-systemctl stop rke2-server.service || true
-systemctl stop rke2-agent.service || true
+systemctl stop rke2.service || true
 
 killtree $({ set +x; } 2>/dev/null; getshims; set -x)