Manually install rustup when building debian VM
Unlike Debian, Ubuntu doesn't have rustup package in apt repository. So
it requires to execute command bringing files from official site.
And added missing dep to build rust pkg
Bug: 340126051
Test: sudo ./build.sh
Test: ./build_in_container.sh
Change-Id: I5775fb24086864f3835d894285aa8d9f2642ce60
diff --git a/build/debian/build.sh b/build/debian/build.sh
index eff59a0..5894eaf 100755
--- a/build/debian/build.sh
+++ b/build/debian/build.sh
@@ -38,13 +38,16 @@
DEBIAN_FRONTEND=noninteractive \
apt install --no-install-recommends --assume-yes \
binfmt-support \
+ build-essential \
ca-certificates \
+ curl \
debsums \
dosfstools \
fai-server \
fai-setup-storage \
fdisk \
gcc-aarch64-linux-gnu \
+ libc6-dev-arm64-cross \
make \
python3 \
python3-libcloud \
@@ -57,11 +60,12 @@
udev \
- which cargo > /dev/null 2>&1 || {
- apt install --no-install-recommends --assume-yes rustup
- rustup default stable
- rustup update
- }
+ if [ ! -f $HOME/.cargo/bin/cargo ]; then
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
+ fi
+
+ source $HOME/.cargo/env
+ rustup target add aarch64-unknown-linux-gnu
sed -i s/losetup\ -f/losetup\ -P\ -f/g /usr/sbin/fai-diskimage
sed -i 's/wget \$/wget -t 0 \$/g' /usr/share/debootstrap/functions
@@ -96,7 +100,7 @@
wget ${url} -O ${dst}/files/usr/local/bin/ttyd/AVF
chmod 777 ${dst}/files/usr/local/bin/ttyd/AVF
- pushd forwarder_guest > /dev/null
+ pushd $(dirname $0)/forwarder_guest > /dev/null
RUSTFLAGS="-C linker=aarch64-linux-gnu-gcc" cargo build \
--target aarch64-unknown-linux-gnu \
--target-dir ${workdir}/forwarder_guest