diff --git a/dracut.module/Makefile b/dracut.module/Makefile index 514f3fc7acef55bb2079738a13606015efaa3a4d..830b56b9990bbc9c2edf165ecc5412650be63cdd 100644 --- a/dracut.module/Makefile +++ b/dracut.module/Makefile @@ -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 diff --git a/install.sh b/install.sh index a95d73bca5fd044b3a9ef7efa16f19d9ce39b180..433e16ac05feedf3655362f265d13bacac62f499 100755 --- a/install.sh +++ b/install.sh @@ -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/* diff --git a/scan-filesystem/cython/Makefile b/scan-filesystem/cython/Makefile index 4d8a81ec802e5a4f224ed1969d708181cd2cb05a..a29742735251d42130732e358a524f391604d164 100644 --- a/scan-filesystem/cython/Makefile +++ b/scan-filesystem/cython/Makefile @@ -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 $^ -> $@]"