tools/stx/toCOPY/pkgbuilder/setup.sh
Haiqing Bai 26d7e10a8a pkgbuilder: Set the build directory to the shared volume
The pkgbuilder container sets its build directory '/build'
to '/var/lib/sbuild/build', since the root directory '/'
of the container is the docker overlay(on host, it is '/ovlerlay'),
so the '/build' directory consumes the disk of host overlay
and may cause below issue:
"E: Disk space is probably not sufficient for building"

This fix does not mount '/build' to overlay and sets it to
pkgbuilder's private directory on the shared volume.

This fix requires to rebuild the build environment:
stx-init-env --rebuild

Test Plan:
Pass: 1. Before rebuilding the container, change the line:
         "$purge_build_directory = 'always'"; to
         "$purge_build_directory = 'never'";
         in tools/stx/toCOPY/pkgbuilder/debbuilder.conf
      2. Rebuild the container and enter into the builder:
         $build-pkgs -c -p <package>
      3. Then enter into the pkgbuilder:
         $cd '/localdisk/pkgbuilder/<USER>/<PROJECT>/chroots/'
      4. find . -name "build"
         There should be 'build/<package>-*' build directory

Story: 2008846
Task: 46956

Signed-off-by: Haiqing Bai <haiqing.bai@windriver.com>
Change-Id: Iad6c86c0991eecc64e3677b606e607f0b80a5509
2022-11-29 11:36:56 +08:00

22 lines
679 B
Bash
Executable File

#!/bin/bash
SCHROOT_FSTAB="/etc/schroot/sbuild/fstab"
if [ -f "/etc/fstab" ]; then
speed_up=`cat /etc/fstab | grep 'speeding up sbuild'`
[ "x${speed_up}" != "x" ] && exit 0
fi
cat >>/etc/fstab << EOF
# For speeding up sbuild/schroot and prevent SSD wear-out
tmpfs /var/lib/schroot/session tmpfs uid=root,gid=root,mode=0755 0 0
tmpfs /var/lib/schroot/union/overlay tmpfs uid=root,gid=root,mode=0755 0 0
EOF
# The root '/' of the container is on docker overlay, so the
# original '/build' of chroot is on overlay, here remove the
# setting and make the '/build' to the shared volume of container
sed -i "/\/var\/lib\/sbuild\/build/d" ${SCHROOT_FSTAB}
mount -a