blob: 8e44eb9c19b21ac3082f9e62908cbbedc82fe5db [file] [log] [blame]
NingSun1ca48252018-04-26 14:20:38 -07001#!/bin/bash
NingSunda00ff62018-03-14 16:35:31 -07002
NingSun7793a612018-04-10 15:49:01 -07003#set -e
NingSunda00ff62018-03-14 16:35:31 -07004sudo kill -9 $(ps -ef | grep "apt" | grep -v grep | awk '{print $2}')
5
6sudo rm /var/lib/dpkg/lock
7sudo rm /var/lib/apt/lists/lock
8sudo rm /var/cache/apt/archives/lock
9
10sudo dpkg --configure -a
11
NingSun7793a612018-04-10 15:49:01 -070012sudo dpkg --remove --force-remove-reinstreq linux-headers-generic
13sudo dpkg --remove --force-remove-reinstreq linux-generic
14sudo apt-get -f install
15sudo apt-get install linux-image-generic
16
17sudo apt -y update
NingSunda00ff62018-03-14 16:35:31 -070018sudo apt -y install autoconf
NingSun7793a612018-04-10 15:49:01 -070019sudo apt -y install autoconf-archive
20sudo apt -y install libglib2.0-dev
21sudo apt -y install libdbus-1-dev
NingSunda00ff62018-03-14 16:35:31 -070022sudo apt -y install automake
23sudo apt -y install libtool
24sudo apt -y install autotools-dev
NingSun7793a612018-04-10 15:49:01 -070025sudo apt -y install libcppunit-dev
26sudo apt -y install p11-kit
27sudo apt -y install libcurl4-gnutls-dev
28sudo apt -y autoremove
NingSunda00ff62018-03-14 16:35:31 -070029
30echo "Build SoftHSMv2..."
31cd SoftHSMv2
32sh autogen.sh
NingSun7793a612018-04-10 15:49:01 -070033./configure --disable-gost
34make -j$(nproc)
NingSunda00ff62018-03-14 16:35:31 -070035cd ..
36
NingSun7793a612018-04-10 15:49:01 -070037sudo apt -y install \
38 libcmocka0 \
39 libcmocka-dev \
40 build-essential \
41 git \
42 pkg-config \
43 gcc \
44 g++ \
45 m4 \
46 liburiparser-dev \
47 libgcrypt20-dev \
48 libssl-dev \
49 pandoc
50
51#echo "Install openssl..."
52#git clone https://github.com/openssl/openssl.git
53#cd openssl
54#./config
55#make -j$(nproc)
56#sudo make install
NingSunda00ff62018-03-14 16:35:31 -070057#cd ..
NingSun7793a612018-04-10 15:49:01 -070058#rm -rf openssl
59
60echo "Install tpm2-tss 1.2.0..."
61git clone https://github.com/tpm2-software/tpm2-tss.git
62cd tpm2-tss
63git checkout 1.2.0
64./bootstrap
65./configure --enable-unit
66#cp ../implementation.h ./include/sapi/implementation.h
67make -j$(nproc) check
68sudo make install
69sudo ldconfig
70cd ..
71rm -rf tpm2-tss
72
73echo "Install tpm2-abrmd 1.1.1..."
74#sudo useradd --system --user-group tss
75git clone https://github.com/tpm2-software/tpm2-abrmd.git
76cd tpm2-abrmd
77git checkout 1.1.1
78./bootstrap
79./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
80make -j$(nproc) check
81sudo make install
82sudo ldconfig
83sudo udevadm control --reload-rules && sudo udevadm trigger
84sudo pkill -HUP dbus-daemon
85sudo systemctl daemon-reload
86cd ..
87rm -rf tpm2-abrmd
88
89echo "Install tpm2-tools 2.1.1..."
90git clone https://github.com/tpm2-software/tpm2-tools.git
91cd tpm2-tools
92git checkout 2.1.1
93./bootstrap
94./configure --enable-unit
95make -j$(nproc) check
96sudo make install
97sudo ldconfig
98cd ..
99rm -rf tpm2-tools
100
101echo "Build TPM2_plugin..."
102cd TPM2-Plugin
103./bootstrap
104./configure
105make
106sudo make install
107sudo ldconfig
108cd ..
109export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib