Remove ISU packages during major OS upgrade 30/296930/3 accepted/tizen/unified/20230822.043319
authorMateusz Moscicki <m.moscicki2@partner.samsung.com>
Mon, 7 Aug 2023 09:31:22 +0000 (11:31 +0200)
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>
Fri, 18 Aug 2023 15:19:02 +0000 (17:19 +0200)
If the system release name has changed, remove incompatible packages, as
they may not be compatible with the new system version.

Change-Id: I43663bda0f50fbdcd608cd7e65881bd644b36476

packaging/upgrade.spec
scripts/rw-upgrade/update.sh.in

index 8a12585..527ad7a 100644 (file)
@@ -3,7 +3,7 @@
 
 Name:          upgrade
 Summary:       Upgrade support for Tizen
-Version:       8.0.0
+Version:       8.0.1
 Release:       0
 Group:         System
 License:       Apache-2.0
index 26d965a..5d3739d 100644 (file)
@@ -102,8 +102,17 @@ VERSION_COMPARE() {
         return 0
 }
 
+REMOVE_ISU_PKG()
+{
+       local PKG_NAME=$1
+       rm -rf "/opt/isu/$PKG_NAME"
+}
+
 REMOVE_UNNECESSARY_ISU_PKGS()
 {
+       local OS_RELEASE_NAME
+       OS_RELEASE_NAME=$(grep TZ_BUILD_RELEASE_NAME /etc/tizen-build.conf | awk -F '"' '{print $2}')
+
        for ISUCFG in $(find /etc/isu/ -type f -name isu.cfg); do
                PKG_NAME=$(basename "$(dirname "$ISUCFG")")
                if [ ! -d "/opt/isu/$PKG_NAME" ]; then
@@ -111,13 +120,22 @@ 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
 
                VERSION_COMPARE "$CUR_IMG_VERSION" "$INSTALLED_VERSION"
 
                if [[ $? != 2 ]]; then
                        # Package from the current image is newer than the one installed
                        # so we can remove the installed one
-                       rm -rf "/opt/isu/$PKG_NAME"
+                       REMOVE_ISU_PKG "$PKG_NAME"
                fi
        done
 }