session="$(schroot -c "${chroot}" -b)"
export CHROOT_SESSION_ID="${session}"
+# Set GOMA_TMP_DIR for better handling of goma inside chroot.
+export GOMA_TMP_DIR="/tmp/goma_tmp_$CHROOT_SESSION_ID"
+mkdir -p "$GOMA_TMP_DIR"
+
if [ $# -eq 0 ]; then
# Run an interactive shell session
schroot -c "${session}" -r -p
# clean up the stale files by invoking us with "--clean" after having killed
# all running processes.
schroot -c "${session}" -e
+# Since no goma processes are running, we can remove goma directory.
+rm -rf "$GOMA_TMP_DIR"
exit $rc
EOF
sudo chown root:root /usr/local/bin/"${target%bit}"
# Install a few more commonly used packages
sudo "/usr/local/bin/${target%bit}" apt-get -y install \
autoconf automake1.9 dpkg-dev g++-multilib gcc-multilib gdb less libtool \
- strace
+ lsof strace
# If running a 32bit environment on a 64bit machine, install a few binaries
# as 64bit. This is only done automatically if the chroot distro is the same as
readlinepkg=$(sudo "/usr/local/bin/${target%bit}" sh -c \
'apt-cache search "lib64readline.\$" | sort | tail -n 1 | cut -d " " -f 1')
sudo "/usr/local/bin/${target%bit}" apt-get -y install \
- lib64expat1 lib64ncurses5 ${readlinepkg} lib64z1
+ lib64expat1 lib64ncurses5 ${readlinepkg} lib64z1 lib64stdc++6
dep=
for i in binutils gdb; do
[ -d /usr/share/doc/"$i" ] || dep="$dep $i"