sysutils/amazon-ssm-plugin: Add new port

This package provides Amazon SSM SessionManager and CLI for managing
shell experience using SSM APIs.

PR:		268142
This commit is contained in:
Norikatsu Shigemura 2023-01-17 18:05:01 +01:00 committed by Mikael Urankar
parent 336db80fc8
commit b3cf3d7a45
7 changed files with 112 additions and 0 deletions

View File

@ -32,6 +32,7 @@
SUBDIR += alfio
SUBDIR += am-utils
SUBDIR += amazon-ssm-agent
SUBDIR += amazon-ssm-plugin
SUBDIR += amdmsrtweaker
SUBDIR += amrstat
SUBDIR += amtc

View File

@ -0,0 +1,57 @@
PORTNAME= amazon-ssm-plugin
DISTVERSION= 1.2.398.0
CATEGORIES= sysutils
MAINTAINER= nork@FreeBSD.org
COMMENT= Amazon AWS Manages shell experience using SSM APIs
WWW= https://github.com/aws/session-manager-plugin/
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
RUN_DEPENDS= aws:devel/py-awscli@${PY_FLAVOR}
USES= go python:env
GO_BUILDFLAGS= -ldflags "-s -w"
GO_TARGET= src/sessionmanagerplugin-main/main.go:${PREFIX}/bin/session-manager-plugin \
src/ssmcli-main/main.go:${PREFIX}/bin/ssmcli
USE_GITHUB= yes
GH_ACCOUNT= aws
GH_PROJECT= session-manager-plugin
GH_TAGNAME= ${DISTVERSION}
GH_SUBDIR= ${GH_PROJECT}
PORTDOCS= NOTICE README.md RELEASENOTES.md THIRD-PARTY VERSION
PLIST_FILES= ${ETCDIR}/sessionmanagerplugin/seelog.xml.template \
${ETCDIR}/SSMCLI/seelog.xml.template \
bin/session-manager-plugin \
bin/ssmcli \
'@dir /var/log/amazon-ssm-plugin'
LOGDIR= ${DESTDIR}/var/log/${PORTNAME}
OPTIONS_DEFINE= DOCS
post-extract:
${MKDIR} ${WRKDIR}/src
${LN} -s ${WRKSRC} ${GO_WRKSRC}
${MKDIR} ${WRKSRC}/vendor/src/github.com/aws/session-manager-plugin
${LN} -s ${WRKSRC}/vendor/src/* ${GO_WRKSRC}/vendor/
${LN} -s ${WRKSRC}/src ${GO_WRKSRC}/vendor/github.com/aws/session-manager-plugin/
post-patch:
${REINPLACE_CMD} -e 's|%%VERSION%%|${DISTVERSION}|' ${WRKSRC}/src/version/version.go
${REINPLACE_CMD} -e 's|%%ETCDIR%%|${ETCDIR}|g; s|%%LOGDIR%%|${LOGDIR}|g' ${WRKSRC}/seelog_unix.xml
${REINPLACE_CMD} -e 's|%%ETCDIR%%|${ETCDIR}|g; s|%%LOGDIR%%|${LOGDIR}|g' ${WRKSRC}/src/log/log_unix.go
post-install:
@${MKDIR} ${STAGEDIR}${LOGDIR} ${STAGEDIR}${ETCDIR}/SSMCLI ${STAGEDIR}${ETCDIR}/sessionmanagerplugin
${INSTALL_DATA} ${WRKSRC}/seelog_unix.xml ${STAGEDIR}${ETCDIR}/SSMCLI/seelog.xml.template
${INSTALL_DATA} ${WRKSRC}/seelog_unix.xml ${STAGEDIR}${ETCDIR}/sessionmanagerplugin/seelog.xml.template
post-install-DOCS-on:
@${MKDIR} ${STAGEDIR}${DOCSDIR}
cd ${WRKSRC} && ${INSTALL_DATA} ${PORTDOCS} ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1673833159
SHA256 (aws-session-manager-plugin-1.2.398.0_GH0.tar.gz) = 85a511b849f480613b9119f4c800c6ae427b366da463714ade1ccf470de43a99
SIZE (aws-session-manager-plugin-1.2.398.0_GH0.tar.gz) = 21657464

View File

@ -0,0 +1,14 @@
--- seelog_unix.xml.orig 2021-08-17 20:31:44 UTC
+++ seelog_unix.xml
@@ -6,9 +6,9 @@
<exception filepattern="test*" minlevel="error"/>
</exceptions>
<outputs formatid="fmtinfo">
- <rollingfile type="size" filename="/usr/local/sessionmanagerplugin/logs/session-manager-plugin.log" maxsize="30000000" maxrolls="5"/>
+ <rollingfile type="size" filename="%%LOGDIR%%/session-manager-plugin.log" maxsize="30000000" maxrolls="5"/>
<filter levels="error,critical" formatid="fmterror">
- <rollingfile type="size" filename="/usr/local/sessionmanagerplugin/logs/errors.log" maxsize="10000000" maxrolls="5"/>
+ <rollingfile type="size" filename="%%LOGDIR%%/session-manager-plugin-errors.log" maxsize="10000000" maxrolls="5"/>
</filter>
</outputs>
<formats>

View File

@ -0,0 +1,22 @@
--- src/log/log_unix.go.orig 2022-06-17 20:08:49 UTC
+++ src/log/log_unix.go
@@ -23,8 +23,8 @@ import (
)
const (
- LogsDirectory = "logs"
- DefaultInstallLocationPrefix = "/usr/local"
+ DefaultLogsDirectory = "%%LOGDIR%%"
+ DefaultInstallLocationPrefix = "%%ETCDIR%%"
)
func getApplicationName(clientName string) string {
@@ -45,7 +45,7 @@ func getLogConfigBytes(clientName string) (logConfigBy
applicationName := getApplicationName(clientName)
DefaultSeelogConfigFilePath = filepath.Join(DefaultInstallLocationPrefix, applicationName, SeelogConfigFileName)
- DefaultLogDir = filepath.Join(DefaultInstallLocationPrefix, applicationName, LogsDirectory)
+ DefaultLogDir = filepath.Join(DefaultLogsDirectory, applicationName)
ApplicationLogFile = fmt.Sprintf("%s%s", clientName, LogFileExtension)
ErrorLogFile = fmt.Sprintf("%s%s", ErrorLogFileSuffix, LogFileExtension)
if logConfigBytes, err = ioutil.ReadFile(DefaultSeelogConfigFilePath); err != nil {

View File

@ -0,0 +1,8 @@
--- src/version/version.go.orig 2022-06-17 20:08:49 UTC
+++ src/version/version.go
@@ -9,4 +9,4 @@
package version
// Version is the version of the CLI
-const Version = "1.2.0.0"
+const Version = "%%VERSION%%"

View File

@ -0,0 +1,7 @@
This package provides Amazon SSM SessionManager and CLI for managing
shell experience using SSM APIs.
HOW TO USE:
aws ssm start-session --target "your instance-id"
SEE ALSO: https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-install-plugin.html