NingSun | 1ca4825 | 2018-04-26 14:20:38 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
NingSun | da00ff6 | 2018-03-14 16:35:31 -0700 | [diff] [blame] | 2 | |
NingSun | 7793a61 | 2018-04-10 15:49:01 -0700 | [diff] [blame] | 3 | #set -e |
NingSun | da00ff6 | 2018-03-14 16:35:31 -0700 | [diff] [blame] | 4 | sudo kill -9 $(ps -ef | grep "apt" | grep -v grep | awk '{print $2}') |
| 5 | |
| 6 | sudo rm /var/lib/dpkg/lock |
| 7 | sudo rm /var/lib/apt/lists/lock |
| 8 | sudo rm /var/cache/apt/archives/lock |
| 9 | |
| 10 | sudo dpkg --configure -a |
| 11 | |
NingSun | 7793a61 | 2018-04-10 15:49:01 -0700 | [diff] [blame] | 12 | sudo dpkg --remove --force-remove-reinstreq linux-headers-generic |
| 13 | sudo dpkg --remove --force-remove-reinstreq linux-generic |
| 14 | sudo apt-get -f install |
| 15 | sudo apt-get install linux-image-generic |
| 16 | |
| 17 | sudo apt -y update |
NingSun | da00ff6 | 2018-03-14 16:35:31 -0700 | [diff] [blame] | 18 | sudo apt -y install autoconf |
NingSun | 7793a61 | 2018-04-10 15:49:01 -0700 | [diff] [blame] | 19 | sudo apt -y install autoconf-archive |
| 20 | sudo apt -y install libglib2.0-dev |
| 21 | sudo apt -y install libdbus-1-dev |
NingSun | da00ff6 | 2018-03-14 16:35:31 -0700 | [diff] [blame] | 22 | sudo apt -y install automake |
| 23 | sudo apt -y install libtool |
| 24 | sudo apt -y install autotools-dev |
NingSun | 7793a61 | 2018-04-10 15:49:01 -0700 | [diff] [blame] | 25 | sudo apt -y install libcppunit-dev |
| 26 | sudo apt -y install p11-kit |
| 27 | sudo apt -y install libcurl4-gnutls-dev |
| 28 | sudo apt -y autoremove |
NingSun | da00ff6 | 2018-03-14 16:35:31 -0700 | [diff] [blame] | 29 | |
| 30 | echo "Build SoftHSMv2..." |
| 31 | cd SoftHSMv2 |
| 32 | sh autogen.sh |
NingSun | 7793a61 | 2018-04-10 15:49:01 -0700 | [diff] [blame] | 33 | ./configure --disable-gost |
| 34 | make -j$(nproc) |
NingSun | da00ff6 | 2018-03-14 16:35:31 -0700 | [diff] [blame] | 35 | cd .. |
| 36 | |
NingSun | 7793a61 | 2018-04-10 15:49:01 -0700 | [diff] [blame] | 37 | sudo 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 |
NingSun | da00ff6 | 2018-03-14 16:35:31 -0700 | [diff] [blame] | 57 | #cd .. |
NingSun | 7793a61 | 2018-04-10 15:49:01 -0700 | [diff] [blame] | 58 | #rm -rf openssl |
| 59 | |
| 60 | echo "Install tpm2-tss 1.2.0..." |
| 61 | git clone https://github.com/tpm2-software/tpm2-tss.git |
| 62 | cd tpm2-tss |
| 63 | git checkout 1.2.0 |
| 64 | ./bootstrap |
| 65 | ./configure --enable-unit |
| 66 | #cp ../implementation.h ./include/sapi/implementation.h |
| 67 | make -j$(nproc) check |
| 68 | sudo make install |
| 69 | sudo ldconfig |
| 70 | cd .. |
| 71 | rm -rf tpm2-tss |
| 72 | |
| 73 | echo "Install tpm2-abrmd 1.1.1..." |
| 74 | #sudo useradd --system --user-group tss |
| 75 | git clone https://github.com/tpm2-software/tpm2-abrmd.git |
| 76 | cd tpm2-abrmd |
| 77 | git 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 |
| 80 | make -j$(nproc) check |
| 81 | sudo make install |
| 82 | sudo ldconfig |
| 83 | sudo udevadm control --reload-rules && sudo udevadm trigger |
| 84 | sudo pkill -HUP dbus-daemon |
| 85 | sudo systemctl daemon-reload |
| 86 | cd .. |
| 87 | rm -rf tpm2-abrmd |
| 88 | |
| 89 | echo "Install tpm2-tools 2.1.1..." |
| 90 | git clone https://github.com/tpm2-software/tpm2-tools.git |
| 91 | cd tpm2-tools |
| 92 | git checkout 2.1.1 |
| 93 | ./bootstrap |
| 94 | ./configure --enable-unit |
| 95 | make -j$(nproc) check |
| 96 | sudo make install |
| 97 | sudo ldconfig |
| 98 | cd .. |
| 99 | rm -rf tpm2-tools |
| 100 | |
| 101 | echo "Build TPM2_plugin..." |
| 102 | cd TPM2-Plugin |
| 103 | ./bootstrap |
| 104 | ./configure |
| 105 | make |
| 106 | sudo make install |
| 107 | sudo ldconfig |
| 108 | cd .. |
| 109 | export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib |