Avoid duplicate gpg-verify lines in ostree config

Currently the software-controller-init.sh script may append
the config 'gpg-verify=false' to the end of the current feed
and sysroot ostree 'config' files everytime the host reboots.

This commit fix the issue by allowing the script to append the
config only if it does not exist.

Test Plan
PASS: AIO-DX - major release deployment stx8 -> stx10
PASS: verify the feed and sysroot ostree config files

Story: 2010676
Task: 51035

Change-Id: I912d5cb74090d343bb4b4bf9c08f3fec89ac3b78
Signed-off-by: Heitor Matsui <heitorvieira.matsui@windriver.com>
This commit is contained in:
Heitor Matsui 2024-09-17 17:55:14 -03:00
parent 7940196617
commit 33cd1e0a1c

View File

@ -47,10 +47,10 @@ function do_setup {
LOG "Creating repo."
# TODO(cshort) Remove this once gpg support is added.
sed -i '$a gpg-verify=false' \
/var/www/pages/feed/rel-${SW_VERSION}/ostree_repo/config
sed -i '$a gpg-verify=false' \
/sysroot/ostree/repo/config
FEED_OSTREE_CONFIG="/var/www/pages/feed/rel-${SW_VERSION}/ostree_repo/config"
SYSROOT_OSTREE_CONFIG="/sysroot/ostree/repo/config"
grep -xq "gpg-verify=false" $FEED_OSTREE_CONFIG || sed -i '$a gpg-verify=false' $FEED_OSTREE_CONFIG
grep -xq "gpg-verify=false" $SYSROOT_OSTREE_CONFIG || sed -i '$a gpg-verify=false' $SYSROOT_OSTREE_CONFIG
apt-ostree repo init \
--feed $REPO_DIR \