Skip to content

Instantly share code, notes, and snippets.

@smoser

smoser/README.md

Last active Oct 12, 2020
Embed
What would you like to do?
swtpm / libtpms notes

swtpm notes

Info on how to build/use swtpm and libtpms. Pretty good doc at swtpm wiki.

Debian/Ubuntu

libtpms and swtpm seem to be working their way into debian/ubuntu.

build / upload

This is how I built libtpms and swtpm for my ppa at ppa:smoser/swtpm.

Probably should set up a daily build or something. But for now, this will work.

Note that swtpm depends on libtpms, so you can't easily just build them both without adding libtpms to be accessible.

To build for ppa:

notnative() {
    # these are not native, but debian/source/fromat says so
    local dsf="debian/source/format"
    grep -q "native" "$dsf" || return 0
    echo "3.0 (quilt)" > "$dsf" 
    git commit -m "not native package" "$dsf"
}

setrel() {
    local rel="$1"
    sed -i "1s/\([^ ]\+\) \([^ ]\+\) \([^;]\+\);/\1 \2 $rel;/g" debian/changelog
}

PPA="ppa:smoser/swtpm"
libtpmsv="0.7.3"
wget -O libtpms_${libtpmsv}.orig.tar.gz \
    https://github.com/stefanberger/libtpms/archive/v${libtpmsv}.tar.gz


# build libtpms
git clone https://github.com/stefanberger/libtpms.git
cd libtpms
git checkout v${libtpmsv}
notnative
setrel focal

debuild -S -nc 
dput $PPA ../libtpms_${libtpmsv}-1_source.changes

cd ..

# build swtpm
swtpmv=0.5.0
wget -O swtpm_${swtpmv}.orig.tar.gz \
    https://github.com/stefanberger/swtpm/archive/v${swtpmv}.tar.gz
    
git clone https://github.com/stefanberger/swtpm.git
cd swtpm
git checkout v${swtpmv}
notnative
setrel focal

debuild -S -nc
dput $PPA ../libtpms_${libtpmsv}-1_source.changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment