Unverified Commit aaec8826 authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #257830 from anthonyroussel/ssm-agent_3.2.1630.0

ssm-agent: 3.2.1478.0 -> 3.2.1630.0
parents debc36a9 4c55c3c8
Loading
Loading
Loading
Loading
+34 −14
Original line number Diff line number Diff line
@@ -5,9 +5,14 @@
, fetchFromGitHub
, coreutils
, nettools
, dmidecode
, busybox
, util-linux
, stdenv
, dmidecode
, bashInteractive
, nix-update-script
, testers
, ssm-agent
, overrideEtc ? true
}:

@@ -27,17 +32,17 @@ let
in
buildGoPackage rec {
  pname = "amazon-ssm-agent";
  version = "3.2.1478.0";
  version = "3.2.1630.0";

  goPackagePath = "github.com/aws/${pname}";

  nativeBuildInputs = [ makeWrapper ];

  src = fetchFromGitHub {
    rev = version;
    rev = "refs/tags/${version}";
    owner = "aws";
    repo = "amazon-ssm-agent";
    hash = "sha256-SS0N3Wcksk2vq52K6GYE9z4hrckXGqiuCuYPHkH4SWc=";
    hash = "sha256-0tN0rBfz2VZ4UkYLFDGg9218O9vyyRT2Lrppu9TETao=";
  };

  patches = [
@@ -49,7 +54,7 @@ buildGoPackage rec {
    ./0002-version-gen-don-t-use-unnecessary-constants.patch
  ];

  # See the list https://github.com/aws/amazon-ssm-agent/blob/3.2.1478.0/makefile#L120-L138
  # See the list https://github.com/aws/amazon-ssm-agent/blob/3.2.1630.0/makefile#L120-L138
  # The updater is not built because it cannot work on NixOS
  subPackages = [
    "core"
@@ -65,7 +70,7 @@ buildGoPackage rec {
    "-w"
  ];

  preConfigure = ''
  postPatch = ''
    printf "#!/bin/sh\ntrue" > ./Tools/src/checkstyle.sh

    substituteInPlace agent/platform/platform_unix.go \
@@ -73,16 +78,19 @@ buildGoPackage rec {
      --replace '"/bin", "hostname"' '"${nettools}/bin/hostname"' \
      --replace '"lsb_release"' '"${fake-lsb-release}/bin/lsb_release"'

    substituteInPlace agent/managedInstances/fingerprint/hardwareInfo_unix.go \
        --replace /usr/sbin/dmidecode ${dmidecode}/bin/dmidecode

    substituteInPlace agent/session/shell/shell_unix.go \
      --replace '"script"' '"${util-linux}/bin/script"'

    substituteInPlace agent/rebooter/rebooter_unix.go \
      --replace "/sbin/shutdown" "shutdown"

    echo "${version}" > VERSION
  '' + lib.optionalString overrideEtc ''
    substituteInPlace agent/appconfig/constants_unix.go \
      --replace '"/etc/amazon/ssm/"' '"${placeholder "out"}/etc/amazon/ssm/"'
  '' + lib.optionalString stdenv.isLinux ''
    substituteInPlace agent/managedInstances/fingerprint/hardwareInfo_unix.go \
      --replace /usr/sbin/dmidecode ${dmidecode}/bin/dmidecode
  '';

  preBuild = ''
@@ -129,11 +137,23 @@ buildGoPackage rec {
    wrapProgram $out/bin/amazon-ssm-agent --prefix PATH : ${bashInteractive}/bin
  '';

  passthru = {
    updateScript = nix-update-script { };
    tests.version = testers.testVersion {
      package = ssm-agent;
      command = "amazon-ssm-agent --version";
    };
  };

  meta = with lib; {
    description = "Agent to enable remote management of your Amazon EC2 instance configuration";
    changelog = "https://github.com/aws/amazon-ssm-agent/releases/tag/${version}";
    homepage = "https://github.com/aws/amazon-ssm-agent";
    license = licenses.asl20;
    platforms = platforms.unix;
    maintainers = with maintainers; [ copumpkin manveru ];
    maintainers = with maintainers; [ copumpkin manveru anthonyroussel ];

    # Darwin support is broken
    broken = stdenv.isDarwin;
  };
}