Import amazon-ssm-agent-1.2.290.0.

The Amazon EC2 Simple Systems Manager (SSM) Agent is software developed for the
Simple Systems Manager Service. The SSM Agent is the primary component of a
feature called Run Command.
<...>

ok robert@
This commit is contained in:
ajacoutot 2017-01-04 09:05:40 +00:00
parent 148371cc4e
commit df4c19de3c
12 changed files with 277 additions and 0 deletions

View File

@ -0,0 +1,47 @@
# $OpenBSD: Makefile,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
COMMENT= AWS SSM agent
GH_TAGNAME= v1.2.290.0
GH_ACCOUNT= aws
GH_PROJECT= amazon-ssm-agent
CATEGORIES= sysutils
HOMEPAGE= https://aws.amazon.com/cli/
MAINTAINER= Antoine Jacoutot <ajacoutot@openbsd.org>
# Amazon Software License
PERMIT_PACKAGE_CDROM= Yes
WANTLIB += c pthread
BUILD_DEPENDS= lang/go
NO_TEST= Yes
ALL_TARGET= build-openbsd
INSTALL_TARGET= install-openbsd
USE_GMAKE= Yes
MAKE_ENV= SKIP_CHECKSTYLE=Yes
MAKE_FILE= makefile
FAKE_FLAGS= DESTDIR=${WRKINST} \
PREFIX=${TRUEPREFIX} \
SYSCONFDIR=${PREFIX}/share/examples/amazon-ssm-agent
WRKSRC= ${WRKDIR}/src/github.com/aws/amazon-ssm-agent
pre-configure:
rmdir ${WRKSRC}
mv ${WRKDIR}/${DISTNAME} ${WRKSRC}
${SUBST_CMD} ${WRKSRC}/agent/appconfig/constants_unix.go \
${WRKSRC}/agent/log/log_unix.go
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/doc/amazon-ssm-agent/
${INSTALL_DATA} ${WRKSRC}/Tools/src/LICENSE \
${PREFIX}/share/doc/amazon-ssm-agent/
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (amazon-ssm-agent-1.2.290.0.tar.gz) = UJP1ti1QRxVC7dHPfzvR51Lew8ABxxzIhmOJcYHYfLE=
SIZE (amazon-ssm-agent-1.2.290.0.tar.gz) = 4567635

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-agent_appconfig_constants_unix_go,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
--- agent/appconfig/constants_unix.go.orig Tue Jan 3 10:38:59 2017
+++ agent/appconfig/constants_unix.go Tue Jan 3 10:39:24 2017
@@ -18,7 +18,7 @@ package appconfig
const (
// Program Folder
- DefaultProgramFolder = "/etc/amazon/ssm/"
+ DefaultProgramFolder = "${SYSCONFDIR}/amazon/ssm/"
// AppConfig Path
AppConfigPath = DefaultProgramFolder + AppConfigFileName
@@ -27,10 +27,10 @@ const (
DownloadRoot = "/var/log/amazon/ssm/download/"
// DefaultDataStorePath represents the directory for storing system data
- DefaultDataStorePath = "/var/lib/amazon/ssm/"
+ DefaultDataStorePath = "/var/db/amazon/ssm/"
// UpdaterArtifactsRoot represents the directory for storing update related information
- UpdaterArtifactsRoot = "/var/lib/amazon/ssm/update/"
+ UpdaterArtifactsRoot = "/var/db/amazon/ssm/update/"
// List all plugin names, unfortunately golang doesn't support const arrays of strings

View File

@ -0,0 +1,21 @@
$OpenBSD: patch-agent_fileutil_fileutil_unix_go,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
--- agent/fileutil/fileutil_unix.go.orig Tue Jan 3 10:22:57 2017
+++ agent/fileutil/fileutil_unix.go Tue Jan 3 10:23:50 2017
@@ -81,13 +81,13 @@ func GetDiskSpaceInfo() (diskSpaceInfo DiskSpaceInfo,
syscall.Statfs(wd, &stat)
// get block size
- bSize := uint64(stat.Bsize)
+ bSize := uint64(stat.F_bsize)
// return DiskSpaceInfo with calculated bytes
return DiskSpaceInfo{
- AvailBytes: (int64)(stat.Bavail * bSize), // available space = # of available blocks * block size
- FreeBytes: (int64)(stat.Bfree * bSize), // free space = # of free blocks * block size
- TotalBytes: (int64)(stat.Blocks * bSize), // total space = # of total blocks * block size
+ AvailBytes: (int64)((uint64)(stat.F_bavail) * bSize), // available space = # of available blocks * block size
+ FreeBytes: (int64)(stat.F_bfree * bSize), // free space = # of free blocks * block size
+ TotalBytes: (int64)(stat.F_blocks * bSize), // total space = # of total blocks * block size
}, nil
}

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-agent_log_log_unix_go,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
--- agent/log/log_unix.go.orig Tue Jan 3 10:39:41 2017
+++ agent/log/log_unix.go Tue Jan 3 10:39:57 2017
@@ -24,7 +24,7 @@ const (
// DefaultSeelogConfigFilePath specifies the default seelog location
// The underlying logger is based of https://github.com/cihub/seelog
// See Seelog documentation to customize the logger
- DefaultSeelogConfigFilePath = "/etc/amazon/ssm/seelog.xml"
+ DefaultSeelogConfigFilePath = "${SYSCONFDIR}/amazon/ssm/seelog.xml"
DefaultLogDir = "/var/log/amazon/ssm"
)

View File

@ -0,0 +1,18 @@
$OpenBSD: patch-agent_managedInstances_sharedCredentials_shared_Credentials_go,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
From db97edec4adcb2310dbb0b787bfa8dac80474fa5 Mon Sep 17 00:00:00 2001
From: Melonia Mendonca <meloniam@amazon.com>
Date: Thu, 21 Jul 2016 15:22:01 -0700
Subject: [PATCH] Minor bug fixes and addition of 'quick-test'
--- agent/managedInstances/sharedCredentials/shared_Credentials.go.orig Mon Jan 2 19:32:24 2017
+++ agent/managedInstances/sharedCredentials/shared_Credentials.go Mon Jan 2 19:32:36 2017
@@ -21,7 +21,7 @@ import (
"github.com/aws/amazon-ssm-agent/agent/fileutil"
"github.com/aws/aws-sdk-go/aws/awserr"
- "github.com/aws/aws-sdk-go/vendor/github.com/go-ini/ini"
+ "github.com/go-ini/ini"
)
const (

View File

@ -0,0 +1,38 @@
$OpenBSD: patch-agent_platform_platform_unix_go,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
--- agent/platform/platform_unix.go.orig Wed Jul 20 20:08:03 2016
+++ agent/platform/platform_unix.go Mon Jan 2 18:32:50 2017
@@ -20,6 +20,7 @@ import (
"os"
"os/exec"
"path/filepath"
+ "runtime"
"strings"
"github.com/aws/amazon-ssm-agent/agent/fileutil"
@@ -29,6 +30,7 @@ import (
const (
systemReleaseCommand = "/etc/system-release"
redhatReleaseCommand = "/etc/redhat-release"
+ unameCommand = "/usr/bin/uname"
lsbReleaseCommand = "lsb_release"
fetchingDetailsMessage = "fetching platform details from %v"
errorOccurredMessage = "There was an error running %v, err: %v"
@@ -94,6 +96,18 @@ func getPlatformDetails(log log.T) (name string, versi
versionData := strings.Split(data[1], "(")
version = strings.TrimSpace(versionData[0])
}
+ } else if runtime.GOOS == "openbsd" {
+ log.Debugf(fetchingDetailsMessage, unameCommand)
+
+ if contentsBytes, err = exec.Command(unameCommand, "-sr").Output(); err != nil {
+ log.Debugf(fetchingDetailsMessage, unameCommand, err)
+ return
+ }
+ log.Debugf(commandOutputMessage, contentsBytes)
+
+ data := strings.Split(string(contentsBytes), " ")
+ name = strings.TrimSpace(data[0])
+ version = strings.TrimSpace(data[1])
} else {
log.Debugf(fetchingDetailsMessage, lsbReleaseCommand)

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-agent_ssm_service_go,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
--- agent/ssm/service.go.orig Wed Jul 20 20:08:03 2016
+++ agent/ssm/service.go Mon Jan 2 18:32:52 2017
@@ -128,6 +128,8 @@ func (svc *sdkService) UpdateInstanceInformation(
params.PlatformType = aws.String(ssm.PlatformTypeWindows)
case "linux":
params.PlatformType = aws.String(ssm.PlatformTypeLinux)
+ case "openbsd":
+ params.PlatformType = aws.String(ssm.PlatformTypeLinux)
default:
return nil, fmt.Errorf("Cannot report platform type of unrecognized OS. %v", goOS)
}

View File

@ -0,0 +1,67 @@
$OpenBSD: patch-makefile,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
From f5807f6ca41abe547d1e84f835965ca5f526c5d4 Mon Sep 17 00:00:00 2001
From: Melonia Mendonca <meloniam@amazon.com>
Date: Thu, 21 Jul 2016 17:29:07 -0700
Subject: [PATCH] Copying version files only if build file path exists
--- makefile.orig Wed Jul 20 20:08:03 2016
+++ makefile Tue Jan 3 12:58:11 2017
@@ -6,6 +6,7 @@ ifneq ("$(wildcard $(BUILDFILE_PATH))","")
GOTEMPPATH := $(BGO_SPACE)/build/private
GOTEMPCOPYPATH := $(GOTEMPPATH)/src/github.com/aws/amazon-ssm-agent
GOPATH := $(GOTEMPPATH):$(BGO_SPACE)/vendor:$(GOPATH)
+ TEMPVERSIONPATH := $(GOTEMPCOPYPATH)/agent/version
FINALIZE := $(shell command -v bgo-final 2>/dev/null)
else
@@ -27,12 +28,12 @@ export GOPATH
checkstyle::
# Run checkstyle script
- $(BGO_SPACE)/Tools/src/checkstyle.sh
+# $(BGO_SPACE)/Tools/src/checkstyle.sh
coverage:: build-linux
$(BGO_SPACE)/Tools/src/coverage.sh github.com/aws/amazon-ssm-agent/agent/...
-build:: build-linux build-windows build-linux-386 build-windows-386
+build:: build-linux build-openbsd build-windows build-linux-386 build-windows-386
prepack:: prepack-linux prepack-linux-386 prepack-windows prepack-windows-386
@@ -63,9 +64,12 @@ pre-build:
cp $(BGO_SPACE)/seelog_windows.xml.template $(BGO_SPACE)/bin/
cp $(BGO_SPACE)/VERSION $(BGO_SPACE)/bin/
cp $(BGO_SPACE)/agent/integration-cli/integration-cli.json $(BGO_SPACE)/bin/
- # Copying the version files that were generated in pre-build
+ifneq ("$(wildcard $(BUILDFILE_PATH))","")
+ @echo "Copying version files generated in pre-build "
+ mkdir -p $(TEMPVERSIONPATH)
cp $(BGO_SPACE)/VERSION $(GOTEMPCOPYPATH)
- cp $(BGO_SPACE)/agent/version/version.go $(GOTEMPCOPYPATH)/agent/version/
+ cp $(BGO_SPACE)/agent/version/version.go $(TEMPVERSIONPATH)
+endif
exit 0
.PHONY: build-linux
@@ -75,6 +79,19 @@ build-linux: checkstyle copy-src pre-build
$(BGO_SPACE)/agent/agent.go $(BGO_SPACE)/agent/agent_unix.go $(BGO_SPACE)/agent/agent_parser.go
GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o $(BGO_SPACE)/bin/linux_amd64/updater -v \
$(BGO_SPACE)/agent/update/updater/updater.go $(BGO_SPACE)/agent/update/updater/updater_unix.go
+
+.PHONY: build-openbsd
+build-openbsd: checkstyle copy-src pre-build
+ @echo "Build for openbsd agent"
+ GOOS=openbsd GOARCH=amd64 go build -ldflags "-s -w" -o $(BGO_SPACE)/bin/openbsd_amd64/amazon-ssm-agent -v \
+ $(BGO_SPACE)/agent/agent.go $(BGO_SPACE)/agent/agent_unix.go $(BGO_SPACE)/agent/agent_parser.go
+
+install-openbsd:
+ @echo "Install for openbsd agent"
+ install -m 555 $(BGO_SPACE)/bin/openbsd_amd64/amazon-ssm-agent $(DESTDIR)$(PREFIX)/sbin/
+ mkdir -p $(DESTDIR)$(SYSCONFDIR)/amazon/ssm
+ install -m 644 $(BGO_SPACE)/bin/amazon-ssm-agent.json.template $(DESTDIR)$(SYSCONFDIR)/amazon/ssm
+ install -m 644 $(BGO_SPACE)/bin/seelog_unix.xml $(DESTDIR)$(SYSCONFDIR)/amazon/ssm/seelog_unix.xml.template
.PHONY: build-darwin
build-darwin: checkstyle copy-src pre-build

View File

@ -0,0 +1,8 @@
The Amazon EC2 Simple Systems Manager (SSM) Agent is software developed for the
Simple Systems Manager Service. The SSM Agent is the primary component of a
feature called Run Command.
The SSM Agent runs on EC2 instances and enables you to quickly and easily
execute remote commands or scripts against one or more instances. The agent uses
SSM. When you execute a command, the agent on the instance processes the
document and configures the instance as specified.

View File

@ -0,0 +1,15 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
@extraunexec rm -rf /var/db/amazon /var/log/amazon
@bin sbin/amazon-ssm-agent
share/doc/amazon-ssm-agent/
share/doc/amazon-ssm-agent/LICENSE
share/examples/amazon-ssm-agent/
share/examples/amazon-ssm-agent/amazon/
@sample ${SYSCONFDIR}/amazon/
share/examples/amazon-ssm-agent/amazon/ssm/
@sample ${SYSCONFDIR}/amazon/ssm/
share/examples/amazon-ssm-agent/amazon/ssm/amazon-ssm-agent.json.template
@sample ${SYSCONFDIR}/amazon/ssm/amazon-ssm-agent.json
share/examples/amazon-ssm-agent/amazon/ssm/seelog_unix.xml.template
@sample ${SYSCONFDIR}/amazon/ssm/seelog.xml
@rcscript ${RCDIR}/amazon_ssm_agent

View File

@ -0,0 +1,12 @@
#!/bin/sh
#
# $OpenBSD: amazon_ssm_agent.rc,v 1.1.1.1 2017/01/04 09:05:40 ajacoutot Exp $
daemon="${TRUEPREFIX}/sbin/amazon-ssm-agent"
. /etc/rc.d/rc.subr
rc_bg=YES
rc_reload=NO
rc_cmd $1