#!/bin/bash LIBVIRT_STPM_GRP="libvirt-tpm" module_init() { groupadd --system "${LIBVIRT_STPM_GRP}" } fetch_source() { autoclone } build() { local SRCDIR_LIB="${MODULE_WORK_DIR}/src/libtpms" local SRCDIR_BIN="${MODULE_WORK_DIR}/src/swtpm" cde "${SRCDIR_LIB}" autoreconf --install --force ./configure \ --prefix="/usr" \ --with-openssl \ --with-tpm2 || perror "'configure' failed." make || perror "'make' failed." make install || perror "'make install' failed." cde "${SRCDIR_BIN}" # Remove usage of /usr/bin/env to avoid PATH manipulation attacks sed -i 's/env //' samples/swtpm-create-tpmca samples/swtpm-create-user-config-files.in autoreconf --install --force # overwrite search path to inject custom pkg-config program ./configure \ --prefix="/usr" \ --with-cuse \ --with-gnutls \ --with-seccomp || perror "'configure' failed." make || perror "'make' failed." make install || perror "'make install' failed." # change group and permissions for libvirt-tpm members chgrp "${LIBVIRT_STPM_GRP}" "/var/lib/swtpm-localca" chmod 775 "/var/lib/swtpm-localca" } post_copy() { : }