Change ownership of tce info dir

The tce-load command saves info of installed packages under
/usr/local/tce.installed that is created during the build process
by the root user.
That will cause access and writing issues when running tce-load
as normal user, and we shouldn't run tce-load as root.

Change-Id: I2c369bc0280b3b73339fb49c2d257555d9d2d937
This commit is contained in:
Riccardo Pittau 2020-05-07 15:30:07 +02:00
parent dd90f32dfe
commit bd780bf0d4
3 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,9 @@ sudo mount -o loop "$PARTIMG" "$DST_DIR/"
setup_tce $DST_DIR
# NOTE(rpittau) change ownership of the tce info dir to prevent writing issues
sudo chown $TC:$STAFF $DST_DIR/usr/local/tce.installed
$TC_CHROOT_CMD tce-load -wci grub2-multi.tcz
cleanup_tce $DST_DIR

View File

@ -167,6 +167,9 @@ if [[ $USE_PYTHON3 == "True" ]]; then
PY_REQS="buildreqs_python3.lst"
fi
# NOTE(rpittau) change ownership of the tce info dir to prevent writing issues
sudo chown $TC:$STAFF $BUILDDIR/usr/local/tce.installed
while read line; do
sudo chroot --userspec=$TC:$STAFF $BUILDDIR /usr/bin/env -i PATH=$CHROOT_PATH http_proxy=$http_proxy https_proxy=$https_proxy no_proxy=$no_proxy tce-load -wci $line
done < <(paste $WORKDIR/build_files/$PY_REQS $WORKDIR/build_files/buildreqs.lst)

View File

@ -99,6 +99,9 @@ if [[ $USE_PYTHON3 == "True" ]]; then
PY_REQS="finalreqs_python3.lst"
fi
# NOTE(rpittau) change ownership of the tce info dir to prevent writing issues
sudo chown $TC:$STAFF $FINALDIR/usr/local/tce.installed
while read line; do
$TC_CHROOT_CMD tce-load -wic $line
done < <(paste $WORKDIR/build_files/finalreqs.lst $WORKDIR/build_files/$PY_REQS)