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!.*<key[^>]*>\(.*\)</key>!\1!gp' /etc/config/model-config.xml)
+ OS__manufacturer=$(sed -n -e '/.*manufacturer.*/s!.*<key[^>]*>\(.*\)</key>!\1!gp' /etc/config/model-config.xml)
+ OS__device_type=$(sed -n -e '/.*device_type.*/s!.*<key[^>]*>\(.*\)</key>!\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")")
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"