aboutsummaryrefslogtreecommitdiffstats
path: root/build.sh
blob: 369974c7d49588a735d0b7270c7b893f2f4b6b00 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/etc/bash

#set -e
sudo kill -9 $(ps -ef | grep "apt" | grep -v grep | awk '{print $2}')

sudo rm /var/lib/dpkg/lock
sudo rm /var/lib/apt/lists/lock
sudo rm /var/cache/apt/archives/lock

sudo dpkg --configure -a

sudo dpkg --remove --force-remove-reinstreq linux-headers-generic
sudo dpkg --remove --force-remove-reinstreq linux-generic
sudo apt-get -f install
sudo apt-get install linux-image-generic

sudo apt -y update
sudo apt -y install autoconf
sudo apt -y install autoconf-archive
sudo apt -y install libglib2.0-dev
sudo apt -y install libdbus-1-dev
sudo apt -y install automake
sudo apt -y install libtool
sudo apt -y install autotools-dev
sudo apt -y install libcppunit-dev
sudo apt -y install p11-kit
sudo apt -y install libcurl4-gnutls-dev
sudo apt -y autoremove

echo "Build SoftHSMv2..."
cd SoftHSMv2
sh autogen.sh
./configure --disable-gost
make -j$(nproc)
cd ..

sudo apt -y install \
  libcmocka0 \
  libcmocka-dev \
  build-essential \
  git \
  pkg-config \
  gcc \
  g++ \
  m4 \
  liburiparser-dev \
  libgcrypt20-dev \
  libssl-dev \
  pandoc

#echo "Install openssl..."
#git clone https://github.com/openssl/openssl.git
#cd openssl
#./config
#make -j$(nproc)
#sudo make install
#cd ..
#rm -rf openssl

echo "Install tpm2-tss 1.2.0..."
git clone https://github.com/tpm2-software/tpm2-tss.git
cd tpm2-tss
git checkout 1.2.0
./bootstrap
./configure --enable-unit
#cp ../implementation.h ./include/sapi/implementation.h
make -j$(nproc) check
sudo make install
sudo ldconfig
cd ..
rm -rf tpm2-tss

echo "Install tpm2-abrmd 1.1.1..."
#sudo useradd --system --user-group tss
git clone https://github.com/tpm2-software/tpm2-abrmd.git
cd tpm2-abrmd
git checkout 1.1.1
./bootstrap
./configure --with-dbuspolicydir=/etc/dbus-1/system.d --with-systemdsystemunitdir=/lib/systemd/system --with-systemdpresetdir=/lib/systemd/system-preset --with-udevrulesdir=/etc/udev/rules.d --datarootdir=/usr/share --enable-unit
make -j$(nproc) check
sudo make install
sudo ldconfig
sudo udevadm control --reload-rules && sudo udevadm trigger
sudo pkill -HUP dbus-daemon
sudo systemctl daemon-reload
cd ..
rm -rf tpm2-abrmd

echo "Install tpm2-tools 2.1.1..."
git clone https://github.com/tpm2-software/tpm2-tools.git
cd tpm2-tools
git checkout 2.1.1
./bootstrap
./configure --enable-unit
make -j$(nproc) check
sudo make install
sudo ldconfig
cd ..
rm -rf tpm2-tools

echo "Build TPM2_plugin..."
cd TPM2-Plugin
./bootstrap
./configure
make
sudo make install
sudo ldconfig
cd ..
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib