Commit e7bec916 authored by Xiaowu Zhang's avatar Xiaowu Zhang Committed by root

add script to compile

parent cd0a8d1d
/root/metadata-collect-agent/target/x86_64-unknown-linux-musl/release/metadata-collect-agent
\ No newline at end of file
......@@ -5,6 +5,6 @@ reproducible=yes
compress=xz
uefi=yes
uefi_stub=/usr/lib/systemd/boot/efi/linuxx64.efi.stub
uefi_secureboot_cert=/root/db.crt
uefi_secureboot_key=/root/db.key
uefi_secureboot_cert=/etc/uefi-key/db.crt
uefi_secureboot_key=/etc/uefi-key/db.key
add_dracutmodules="metadata-collect"
#!/bin/bash
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
if [ ! -e "$HOME/.cargo/bin" ]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
fi
export PATH=$PATH:$HOME/.cargo/bin
rustup target add x86_64-unknown-linux-musl
echo "Enter ERP5 User"
read ERP5_USER
echo "Enter ERP5 Password"
read ERP5_PASS
echo "Enter ERP5 Base Url"
read ERP5_BASE_URL
export ERP5_USER=$ERP5_USER
export ERP5_PASS=$ERP5_PASS
export ERP5_BASE_URL=$ERP5_BASE_URL
if [ ! -e /etc/uefi-key ]; then
mkdir /etc/uefi-key
fi
if [ ! -e /etc/uefi-key/db.crt ]; then
openssl req -newkey rsa:4096 -nodes -keyout /etc/uefi-key/db.key -new -x509 -sha256 -days 36500 -subj "/CN=TEST" -out /etc/uefi-key/db.crt
openssl x509 -outform DER -in /etc/uefi-key/db.crt -out /etc/uefi-key/db.cer
fi
cd dracut.module
make install
cd ..
rm -rf dracut_tmp
mkdir dracut_tmp
disk_info=$(/sbin/fdisk -l | grep '^/dev' | cut -d' ' -f1)
disk_info_list=(${disk_info//' '/})
/sbin/e2label ${disk_info_list[1]} ROOT
dracut --force -c ./dracut.module/dracut.conf --confdir dracut_tmp
cp -r /boot/efi/EFI /EFI
uefi=$(ls /EFI/Linux)
efibootmgr --quiet --create --disk ${disk_info_list[0]} --label 'debian UEFI' --loader /EFI/Linux/$uefi
......@@ -31,5 +31,5 @@ BINARY="$(pwd)/target/$HOST_TARGET/release/$(basename "$(pwd)")"
strip --strip-all "$BINARY"
objdump -T "$BINARY" || true
ln -s "$BINARY" dracut.module/90metadata-collect/metadata-collect-agent || true
ln -s "$BINARY" debian.package.unsafe/unsafe-boot-metadata-collect-agent/sbin/metadata-collect-agent || true
\ No newline at end of file
ln -sf "$BINARY" dracut.module/90metadata-collect/metadata-collect-agent || true
ln -sf "$BINARY" debian.package.unsafe/unsafe-boot-metadata-collect-agent/sbin/metadata-collect-agent || true
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