mirror of
https://github.com/stefanberger/swtpm.git
synced 2025-08-22 19:04:35 +00:00

Adapted from tpm-udev [0] which handles that, but it is not really a hard-requirement for swtpm and TSS_USER is configurable after all (even if that is mostly used for the test system). So, create that user and group if it does not exists to avoid errors and failing installation. [0]: https://salsa.debian.org/debian/tpm-udev/-/blob/master/debian/tpm-udev.postinst Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
37 lines
801 B
Bash
37 lines
801 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
SWTPM_LOCALCA_DIR=@LOCALSTATEDIR@/lib/swtpm-localca
|
|
|
|
case "$1" in
|
|
configure)
|
|
# creating @TSS_USER@ group if he isn't already there
|
|
if ! getent group @TSS_USER@ >/dev/null; then
|
|
addgroup --system @TSS_USER@
|
|
fi
|
|
|
|
# creating @TSS_USER@ user if he isn't already there
|
|
if ! getent passwd @TSS_USER@ >/dev/null; then
|
|
adduser --system --ingroup @TSS_USER@ --shell /bin/false \
|
|
--home /var/lib/tpm --no-create-home \
|
|
--gecos "TPM software stack" \
|
|
@TSS_USER@
|
|
fi
|
|
|
|
if ! [ -d $SWTPM_LOCALCA_DIR ]; then
|
|
mkdir -p $SWTPM_LOCALCA_DIR
|
|
chown @TSS_USER@:root $SWTPM_LOCALCA_DIR
|
|
chmod 0750 $SWTPM_LOCALCA_DIR
|
|
fi
|
|
|
|
;;
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|