Commit c968a0ea authored by root's avatar root Committed by Ophélie Gagnard

Improve install.sh and scanfile-system/cython/Makefile.

Add more automation in overall and in install.sh.
parent 1d55dd0c
......@@ -6,7 +6,7 @@ include collect-sh-template.mk
90metadata-collect/metadata-collect-agent:
# cd ../ && ./rust-build-static.bash
cd ../scan-filesyttem/cython/ && make nopython && cd ../../dracut.module
cd ../scan-filesystem/cython/ && make nopython && cd ../../dracut.module
90metadata-collect/fluent-bit:
cd ../ && ./fluent-bit-install.sh && cd dracut.module
......
......@@ -2,15 +2,16 @@
set -eux
apt-get install make autopoint autoconf libtool libattr1.dev musl-tools sbsigntool
wget http://ftp.us.debian.org/debian/pool/main/d/dracut/dracut-core_051-1_amd64.deb
wget http://ftp.us.debian.org/debian/pool/main/d/dracut/dracut_051-1_all.deb
wget http://ftp.us.debian.org/debian/pool/main/d/dracut/dracut-network_051-1_all.deb
apt install ./dracut-core_051-1_amd64.deb ./dracut_051-1_all.deb ./dracut-network_051-1_all.deb
rm dracut-core_051-1_amd64.deb dracut_051-1_all.deb dracut-network_051-1_all.deb
apt -y install make autopoint autoconf libtool libattr1.dev musl-tools sbsigntool
## Install dracut
if ! which dracut ; then
wget http://ftp.us.debian.org/debian/pool/main/d/dracut/dracut-core_051-1_amd64.deb
wget http://ftp.us.debian.org/debian/pool/main/d/dracut/dracut_051-1_all.deb
wget http://ftp.us.debian.org/debian/pool/main/d/dracut/dracut-network_051-1_all.deb
apt -y install ./dracut-core_051-1_amd64.deb ./dracut_051-1_all.deb ./dracut-network_051-1_all.deb
rm dracut*.deb
fi
if [ ! -e "$HOME/.cargo/bin" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
......@@ -19,7 +20,6 @@ export PATH=$PATH:$HOME/.cargo/bin
rustup target add x86_64-unknown-linux-musl
if [ ! -e /etc/uefi-key ]; then
mkdir /etc/uefi-key
fi
......@@ -30,9 +30,57 @@ if [ ! -e /etc/uefi-key/db.crt ]; then
fi
## Install others
apt -y install libssl-dev
# needed to build fmt library
apt -y install cmake
## Install Go
# needed for dracut.module/ make install
if ! which go ; then
GOVERSION=1.16.5
wget https://golang.org/dl/go${GOVERSION}.linux-amd64.tar.gz
rm -rf /usr/local/go
tar -C /usr/local -xzf go${GOVERSION}.linux-amd64.tar.gz
rm go*.tar.gz*
# TODO: write in /etc/profile.d/ instead
echo -e "\n" >> /etc/profile
echo 'export PATH=$PATH:/usr/local/go/bin' >> /etc/profile
source /etc/profile
fi
## Install Cython+
# needed for scan-filesystem/ make nopython
# WARNING: it does not differentiate Cython+ from Cython
if ! which cython3 ; then
mkdir -p build_cythonplus && cd build_cythonplus
wget https://lab.nexedi.com/nexedi/cython/raw/debian/build_cythonplus
chmod 744 build_cythonplus
./build_cythonplus
apt -y install ./cython3_*
cd ..
fi
## Install fmt library
# needed for scan-filesystem/ make nopython
if ! which fmt ; then
git clone https://github.com/fmtlib/fmt.git
cd fmt && mkdir -p build_fmt && cd build_fmt
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ..
make
make install
cd ../..
fi
cd dracut.module
make install
apt -y autoremove
## Build UEFI application
# TODO: write a separate script: one to install stuff, the other to build the UEFI application
cd ..
rm -rf dracut_tmp
mkdir dracut_tmp
......@@ -42,7 +90,6 @@ disk_info=$(/sbin/fdisk -l | grep '^/dev' | cut -d' ' -f1)
disk_info_list=(${disk_info//' '/})
/sbin/e2label ${disk_info_list[1]} ROOT
rm -rf /boot/efi/EFI/Linux/*
......
......@@ -51,7 +51,7 @@ nopython: main.cpp#$(EXE)
-g++ -O2 -g -Wno-unused-result -Wsign-compare -pthread -I/usr/include/python3.7 main.cpp -lcrypto -lfmt -o main 2> logs/link_errors
./parse_link_errors.py < logs/link_errors
make fake_python.o
g++ -O2 -g -Wno-unused-result -Wsign-compare -pthread -I/usr/include/python3.7 main.cpp fake_python.o -lcrypto -lfmt -o main
g++ -O2 -g -Wno-unused-result -Wsign-compare -pthread -I/usr/include/python3.7 main.cpp fake_python.o -lcrypto -lfmt -o ../../metadata-collect-agent
%.cpp: %.pyx
@echo "[Cython Compiling $^ -> $@]"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment