From bd780bf0d411a12908159ee94823c35fe8c49296 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Thu, 7 May 2020 15:30:07 +0200 Subject: [PATCH] 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 --- tinyipa/build-instance-images.sh | 3 +++ tinyipa/build-tinyipa.sh | 3 +++ tinyipa/finalise-tinyipa.sh | 3 +++ 3 files changed, 9 insertions(+) diff --git a/tinyipa/build-instance-images.sh b/tinyipa/build-instance-images.sh index 1203771..0fd0221 100755 --- a/tinyipa/build-instance-images.sh +++ b/tinyipa/build-instance-images.sh @@ -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 diff --git a/tinyipa/build-tinyipa.sh b/tinyipa/build-tinyipa.sh index b9b0f8a..d14f8f2 100755 --- a/tinyipa/build-tinyipa.sh +++ b/tinyipa/build-tinyipa.sh @@ -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) diff --git a/tinyipa/finalise-tinyipa.sh b/tinyipa/finalise-tinyipa.sh index 87e75eb..1b4e319 100755 --- a/tinyipa/finalise-tinyipa.sh +++ b/tinyipa/finalise-tinyipa.sh @@ -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)