forked from wmcelderry/systemd_with_tpm2
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathbuild_systemd_with_tpm2_support.sh
executable file
·61 lines (47 loc) · 1.06 KB
/
build_systemd_with_tpm2_support.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
mode="${1:-in_docker}"
#Usage:
# mode = [ on_this_host | in_docker* ]
# defaults to 'in_docker'.
function enable_source_packages()
{
sed -i 's/# deb-src/deb-src/g' /etc/apt/sources.list
}
function update_apt()
{
apt-get update
}
function install_dependencies()
{
apt-get install -y build-essential fakeroot dpkg-dev libtss2-dev
}
function get_systemd_build_dependencies()
{
apt-get build-dep -y systemd
}
function get_systemd_src()
{
apt-get source systemd
}
function build_systemd_with_tpm2_support()
{
cd systemd-249.11
sed -i 's/tpm2=false/tpm2=true/g' debian/rules
dpkg-buildpackage -rfakeroot -uc -b
}
case "$mode" in
"on_this_host")
#These could be done in a Dockerfile.
#will need a timezone setting!
enable_source_packages
update_apt
install_dependencies
get_systemd_build_dependencies
#this needs to be done inside the image:
get_systemd_src
build_systemd_with_tpm2_support
;;
"in_docker")
docker run --rm -it -v $(pwd):/build -w /build ubuntu:22.04 ./build_systemd_with_tpm2_support.sh "on_this_host"
;;
esac