Mark Johnston 60334f0779 sysutils/amazon-ssm-agent: Use pw(8)'s new metalog feature
This allows the ssm-agent user to be created when installing as an
unprivileged user.  That is, if the package is installed with pkg(8)'s
METALOG option set, the home directory for ssm-agent will be added to
the metalog.

PR:		290080
Approved by:	cperciva (maintainer)
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
2025-10-09 13:46:47 +00:00

11 lines
290 B
Bash

#!/bin/sh
if [ "$2" = "POST-INSTALL" ]; then
echo "Creating ssm-user for SSM Agent Sessions"
if [ -n "${PKG_METALOG}" ] && \
pw useradd --help 2>&1 | grep -q -F -- '-M metalog'; then
METALOG="-M ${PKG_METALOG}"
fi
pw ${METALOG} -R ${PKG_ROOTDIR} useradd ssm-user -G wheel -m
fi