From: Mateusz Moscicki Date: Fri, 1 Sep 2023 11:42:16 +0000 (+0200) Subject: Add support for /etc/isu/upgrade.cfg X-Git-Tag: accepted/tizen/unified/20230912.013607^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53fb4af8eb2c28b7b6b0ac99d51e706072dfc2a4;p=platform%2Fcore%2Fsystem%2Fupgrade.git Add support for /etc/isu/upgrade.cfg Configuration file /etc/isu/upgrade.conf specifies what fields will be checked when verifying the compatiblity of the ISU package during OS Upgrade. Fields that should be taken into account should be specified as comma separated list for option: platform_major_version_fields= Change-Id: I7c0251117516080b6d362991770cc6abff113d5e --- diff --git a/packaging/upgrade.spec b/packaging/upgrade.spec index 527ad7a..023c44e 100644 --- a/packaging/upgrade.spec +++ b/packaging/upgrade.spec @@ -3,7 +3,7 @@ Name: upgrade Summary: Upgrade support for Tizen -Version: 8.0.1 +Version: 8.0.2 Release: 0 Group: System License: Apache-2.0 diff --git a/scripts/rw-upgrade/update.sh.in b/scripts/rw-upgrade/update.sh.in index 5d3739d..d3ed298 100644 --- a/scripts/rw-upgrade/update.sh.in +++ b/scripts/rw-upgrade/update.sh.in @@ -111,7 +111,20 @@ REMOVE_ISU_PKG() REMOVE_UNNECESSARY_ISU_PKGS() { local OS_RELEASE_NAME - OS_RELEASE_NAME=$(grep TZ_BUILD_RELEASE_NAME /etc/tizen-build.conf | awk -F '"' '{print $2}') + local UPGRADE_CFG_PATH=/etc/isu/upgrade.cfg + OS__tz_build_release_name=$(grep TZ_BUILD_RELEASE_NAME /etc/tizen-build.conf | awk -F '"' '{print $2}') + OS__tz_build_arch=$(grep TZ_BUILD_ARCH /etc/tizen-build.conf | awk -F '=' '{print $2}') + OS__model_name=$(sed -n -e '/.*model_name.*/s!.*]*>\(.*\)!\1!gp' /etc/config/model-config.xml) + OS__manufacturer=$(sed -n -e '/.*manufacturer.*/s!.*]*>\(.*\)!\1!gp' /etc/config/model-config.xml) + OS__device_type=$(sed -n -e '/.*device_type.*/s!.*]*>\(.*\)!\1!gp' /etc/config/model-config.xml) + + local platform_major_version_fields="tz_build_release_name tz_build_arch model_name device_type" + if [ -f "${UPGRADE_CFG_PATH}" ]; then + fields_from_file=$(grep -e ^platform_major_version_fields "${UPGRADE_CFG_PATH}" | cut -f2 -d= | sed -e 's/,/ /g') + if [ -n "${fields_from_file}" ]; then + platform_major_version_fields="$fields_from_file" + fi + fi for ISUCFG in $(find /etc/isu/ -type f -name isu.cfg); do PKG_NAME=$(basename "$(dirname "$ISUCFG")") @@ -120,15 +133,26 @@ REMOVE_UNNECESSARY_ISU_PKGS() fi CUR_IMG_VERSION=$(grep -e "^version" "/etc/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') INSTALLED_VERSION=$(grep -e "^version" "/opt/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') - ISU_RELEASE_NAME=$(grep -e "^tz_build_release_name" "/opt/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') - - if [ "$OS_RELEASE_NAME" != "$ISU_RELEASE_NAME" ]; then - # Release name of the current image and package are different. - # In that case we remove the ISU package because it may - # not be compatible with this version of the system. - REMOVE_ISU_PKG "$PKG_NAME" - continue - fi + ISU__tz_build_release_name=$(grep -e "^tz_build_release_name" "/opt/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') + ISU__tz_build_arch=$(grep -e "^tz_build_arch" "/opt/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') + ISU__model_name=$(grep -e "^model_name" "/opt/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') + ISU__manufacturer=$(grep -e "^manufacturer" "/opt/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') + ISU__device_type=$(grep -e "^device_type" "/opt/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') + + + for field in $platform_major_version_fields; do + os_value=OS__$field + isu_value=ISU__$field + if [ "${!os_value}" != "${!isu_value}" ]; then + # One of the values defined in /opt/isu/upgrade.cfg is different. + # In that case we remove the ISU package because it may + # not be compatible with this version of the system. + NOTIFY "${field} value is different for OS and ISU - removing incompatible ${PKG_NAME} ISU package" + REMOVE_ISU_PKG "$PKG_NAME" + continue 2 + fi + + done VERSION_COMPARE "$CUR_IMG_VERSION" "$INSTALLED_VERSION"