aboutsummaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/swtpm/README15
-rw-r--r--system/swtpm/doinst.sh16
-rw-r--r--system/swtpm/slack-desc19
-rw-r--r--system/swtpm/swtpm.SlackBuild119
-rw-r--r--system/swtpm/swtpm.info10
5 files changed, 179 insertions, 0 deletions
diff --git a/system/swtpm/README b/system/swtpm/README
new file mode 100644
index 000000000000..5218bd9ec95a
--- /dev/null
+++ b/system/swtpm/README
@@ -0,0 +1,15 @@
+swtpm (TPM emulation)
+
+swtpm emulates a TPM (Trusted Process Module) in software; once
+running, QEMU can attach TPMs to virtual machines (to run Windows 11,
+for example). See specs/tpm.rst in the QEMU doc directory for more
+details.
+
+Please note that the swtpm command will emulate TPM 1.2 unless it is
+called with "--tpm2".
+
+For more information about the different tools provided by swtpm, see
+the documents in /usr/doc/swtpm-0.5.4/readmes.
+
+The user and group for TSS are both "tss" by default, and should have
+been created before compiling the trousers package.
diff --git a/system/swtpm/doinst.sh b/system/swtpm/doinst.sh
new file mode 100644
index 000000000000..007903496ae8
--- /dev/null
+++ b/system/swtpm/doinst.sh
@@ -0,0 +1,16 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+config etc/swtpm_setup.conf.new
+config etc/swtpm-localca.conf.new
+config etc/swtpm-localca.options.new
diff --git a/system/swtpm/slack-desc b/system/swtpm/slack-desc
new file mode 100644
index 000000000000..c1298bb1e9d4
--- /dev/null
+++ b/system/swtpm/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+swtpm: swtpm (libtpms-based TPM emulator)
+swtpm:
+swtpm: swtpm is a libtpms-based TPM emulator with socket, character device
+swtpm: and Linux CUSE interface options.
+swtpm:
+swtpm: Once swtpm is running, QEMU can attach the emulated TPM to a virtual
+swtpm: machine.
+swtpm:
+swtpm:
+swtpm: Author: Stefan Berger
+swtpm: Homepage: https://github.com/stefanberger/swtpm
diff --git a/system/swtpm/swtpm.SlackBuild b/system/swtpm/swtpm.SlackBuild
new file mode 100644
index 000000000000..8159d041a274
--- /dev/null
+++ b/system/swtpm/swtpm.SlackBuild
@@ -0,0 +1,119 @@
+#!/bin/bash
+
+# Slackware build script for swtpm
+
+# Copyright 2022 K. Eugene Carlson Tsukuba, Japan
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=swtpm
+VERSION=${VERSION:-0.5.4}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
+# the name of the created package would be, and then exit. This information
+# could be useful to other scripts.
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+./autogen.sh
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --docdir=/usr/doc \
+ --mandir=/usr/man \
+ --with-selinux=no
+make
+make install-strip DESTDIR=$PKG
+find $PKG/usr/lib64 -type f -name *\.la -delete
+
+gzip -9 $PKG/usr/man/man*/*
+
+for new in swtpm_setup.conf swtpm-localca.conf swtpm-localca.options; do
+ mv $PKG/etc/$new $PKG/etc/$new.new
+done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a COPYING LICENSE README TODO $PKG/usr/doc/$PRGNAM-$VERSION
+# Each tool has its own short README document.
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/readmes
+(
+cd src
+for dir in swtpm_bios swtpm_cert swtpm_ioctl swtpm_setup; do
+ cp -a $dir/README $PKG/usr/doc/$PRGNAM-$VERSION/readmes/$dir.readme
+done
+)
+
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/system/swtpm/swtpm.info b/system/swtpm/swtpm.info
new file mode 100644
index 000000000000..8b0d72db6358
--- /dev/null
+++ b/system/swtpm/swtpm.info
@@ -0,0 +1,10 @@
+PRGNAM="swtpm"
+VERSION="0.5.4"
+HOMEPAGE="https://github.com/stefanberger/swtpm"
+DOWNLOAD="https://github.com/stefanberger/swtpm/archive/refs/tags/v0.5.4/swtpm-0.5.4.tar.gz"
+MD5SUM="08f545f7d12241b9cc60b09791ccb280"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="libtpms trousers python3-twisted"
+MAINTAINER="K. Eugene Carlson"
+EMAIL="kvngncrlsn@gmail.com"