diff --git a/sysutils/Makefile b/sysutils/Makefile index eaaefae400a7..411ea575708f 100644 --- a/sysutils/Makefile +++ b/sysutils/Makefile @@ -32,6 +32,7 @@ SUBDIR += alfio SUBDIR += am-utils SUBDIR += amazon-ssm-agent + SUBDIR += amazon-ssm-plugin SUBDIR += amdmsrtweaker SUBDIR += amrstat SUBDIR += amtc diff --git a/sysutils/amazon-ssm-plugin/Makefile b/sysutils/amazon-ssm-plugin/Makefile new file mode 100644 index 000000000000..bd7a8e47ace0 --- /dev/null +++ b/sysutils/amazon-ssm-plugin/Makefile @@ -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 diff --git a/sysutils/amazon-ssm-plugin/distinfo b/sysutils/amazon-ssm-plugin/distinfo new file mode 100644 index 000000000000..738797c65d70 --- /dev/null +++ b/sysutils/amazon-ssm-plugin/distinfo @@ -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 diff --git a/sysutils/amazon-ssm-plugin/files/patch-seelog__unix.xml b/sysutils/amazon-ssm-plugin/files/patch-seelog__unix.xml new file mode 100644 index 000000000000..457193587a5b --- /dev/null +++ b/sysutils/amazon-ssm-plugin/files/patch-seelog__unix.xml @@ -0,0 +1,14 @@ +--- seelog_unix.xml.orig 2021-08-17 20:31:44 UTC ++++ seelog_unix.xml +@@ -6,9 +6,9 @@ + + + +- ++ + +- ++ + + + diff --git a/sysutils/amazon-ssm-plugin/files/patch-src_log_log__unix.go b/sysutils/amazon-ssm-plugin/files/patch-src_log_log__unix.go new file mode 100644 index 000000000000..b31d3f95cf82 --- /dev/null +++ b/sysutils/amazon-ssm-plugin/files/patch-src_log_log__unix.go @@ -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 { diff --git a/sysutils/amazon-ssm-plugin/files/patch-src_version_version.go b/sysutils/amazon-ssm-plugin/files/patch-src_version_version.go new file mode 100644 index 000000000000..cf5b8d5233cb --- /dev/null +++ b/sysutils/amazon-ssm-plugin/files/patch-src_version_version.go @@ -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%%" diff --git a/sysutils/amazon-ssm-plugin/pkg-descr b/sysutils/amazon-ssm-plugin/pkg-descr new file mode 100644 index 000000000000..3c7d2b64bfdf --- /dev/null +++ b/sysutils/amazon-ssm-plugin/pkg-descr @@ -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