Install cuttlefish-common in arm64 SHI
This updates the stable host image generation
script for arm64 to install libc6:amd64, qemu-user-static,
and cuttlefish-common instead of waiting for boot to install
these. This allows the vsoc-01 home directory to be cleaned
up so the arm64 SHI has a clean home directory (which matches
the x86 build).
Bug: 146145784
Test: local build and boot
Change-Id: I2e979fe12bf29c54aee2f39aafb61d5f370c1999
diff --git a/tools/create_base_image_arm.sh b/tools/create_base_image_arm.sh
index b65600c..69c2a01 100755
--- a/tools/create_base_image_arm.sh
+++ b/tools/create_base_image_arm.sh
@@ -471,32 +471,33 @@
WantedBy=multi-user.target
EOF
- echo "Creating cleanup script..."
- cat > ${mntdir}/usr/local/bin/install-cleanup << "EOF"
-#!/bin/bash
-echo "Installing cuttlefish-common package..."
-echo "nameserver 8.8.8.8" > /etc/resolv.conf
-MAC=`ip link | grep eth0 -A1 | grep ether | sed 's/.*\(..:..:..:..:..:..\) .*/\1/' | tr -d :`
-sed -i " 1 s/.*/& rockpi-${MAC}/" /etc/hosts
-sudo hostnamectl set-hostname "rockpi-${MAC}"
+ umount ${mntdir}/sys
+ umount ${mntdir}/dev
+ umount ${mntdir}/proc
+ chroot ${mntdir} /bin/bash << "EOT"
+echo "Installing cuttlefish-common package..."
dpkg --add-architecture amd64
-until ping -c1 ftp.debian.org; do sleep 1; done
-ntpdate time.google.com
-while true; do
- apt-get -o Acquire::Check-Valid-Until=false update
- if [ $? != 0 ]; then sleep 1; continue; fi
- apt-get install -y -f libc6:amd64 qemu-user-static
- if [ $? != 0 ]; then sleep 1; continue; fi
- break
-done
+apt-get update
+apt-get install -y -f libc6:amd64 qemu-user-static
cd /home/vsoc-01/android-cuttlefish
dpkg-buildpackage -d -uc -us
apt-get install -y -f ../cuttlefish-common_*_arm64.deb
apt-get clean
+
usermod -aG cvdnetwork vsoc-01
chmod 660 /dev/vhost-vsock
chown root:cvdnetwork /dev/vhost-vsock
+rm -rf /home/vsoc-01/*
+EOT
+
+ echo "Creating cleanup script..."
+ cat > ${mntdir}/usr/local/bin/install-cleanup << "EOF"
+#!/bin/bash
+echo "nameserver 8.8.8.8" > /etc/resolv.conf
+MAC=`ip link | grep eth0 -A1 | grep ether | sed 's/.*\(..:..:..:..:..:..\) .*/\1/' | tr -d :`
+sed -i " 1 s/.*/& rockpi-${MAC}/" /etc/hosts
+sudo hostnamectl set-hostname "rockpi-${MAC}"
rm /etc/machine-id
rm /var/lib/dbus/machine-id
@@ -521,9 +522,6 @@
ln -s /boot/uInitrd-5.2.0 /boot/uInitrd
EOT
- umount ${mntdir}/sys
- umount ${mntdir}/dev
- umount ${mntdir}/proc
umount ${mntdir}
# Turn on journaling