From: Adam Michalski Date: Thu, 11 Apr 2024 14:15:27 +0000 (+0200) Subject: Add ISU rpk package removal during OS Upgrade X-Git-Tag: accepted/tizen/unified/20240606.161520~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf88afcf0d47b5c3e1de56b7e21c78b1cc551d27;p=platform%2Fcore%2Fsystem%2Fupgrade.git Add ISU rpk package removal during OS Upgrade Removal of the ISU packages from /opt/isu has already been done, but in addition to that removing files from /opt/usr/globalapps needs to be done as well. Change-Id: I10c751fbae0693a1f1510e27ab71151893918d41 --- diff --git a/scripts/rw-upgrade/rw-update-macro.inc b/scripts/rw-upgrade/rw-update-macro.inc index 4af6812..48d2716 100644 --- a/scripts/rw-upgrade/rw-update-macro.inc +++ b/scripts/rw-upgrade/rw-update-macro.inc @@ -310,6 +310,39 @@ REMOVE_ISU_PKG() rm -rf "/opt/isu/$PKG_NAME" } +TRY_START_SERVICE() +{ + local SERVICE=$1 + local DESIRED_STATE=$2 + + systemctl start "$SERVICE" + + if [ "$(systemctl is-active $SERVICE)" != "$DESIRED_STATE" ]; then + echo "Couldn't start service: $SERVICE" + fi +} + +PREPARE_PKGMGR_ENV() +{ + TRY_START_SERVICE pkgmgr-info active + # "systemctl is-active" will output "inactive" for a oneshot unit + # that's currently not running but was successful last time it ran + TRY_START_SERVICE security-manager-rules-loader inactive + TRY_START_SERVICE security-manager active + TRY_START_SERVICE ac.service active + TRY_START_SERVICE package-manager active +} + +REMOVE_ISU_APP_PKG() +{ + local PKG_NAME="$1" + local APP_NAME="org.tizen.isu.$PKG_NAME" + local APP_DIR="/opt/usr/globalapps/$APP_NAME" + if [ -d "$APP_DIR" ]; then + /usr/bin/pkgcmd -u -n "$APP_NAME" + fi +} + REMOVE_UNNECESSARY_ISU_PKGS() { local OS_RELEASE_NAME @@ -333,6 +366,7 @@ REMOVE_UNNECESSARY_ISU_PKGS() if [ ! -d "/etc/isu/$PKG_NAME" ]; then NOTIFY "Platform image does not contain information about ${PKG_NAME} - unable to verify which is newer (ISU or Platform). Dropping ISU package ${PKG_NAME}." REMOVE_ISU_PKG "$PKG_NAME" + REMOVE_ISU_APP_PKG "$PKG_NAME" continue fi CUR_IMG_VERSION=$(grep -e "^version" "/etc/isu/$PKG_NAME/isu.cfg" | awk -F "=" '{ gsub(/[ ]+/, ""); print $2}') @@ -353,6 +387,7 @@ REMOVE_UNNECESSARY_ISU_PKGS() # 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" + REMOVE_ISU_APP_PKG "$PKG_NAME" continue 2 fi @@ -364,6 +399,7 @@ REMOVE_UNNECESSARY_ISU_PKGS() # Package from the current image is newer than the one installed # so we can remove the installed one REMOVE_ISU_PKG "$PKG_NAME" + REMOVE_ISU_APP_PKG "$PKG_NAME" fi done } diff --git a/scripts/rw-upgrade/update.sh.in b/scripts/rw-upgrade/update.sh.in index e642e7a..722af34 100644 --- a/scripts/rw-upgrade/update.sh.in +++ b/scripts/rw-upgrade/update.sh.in @@ -100,11 +100,6 @@ then exit fi -NOTIFY "----------------------------------------------------------------------" -NOTIFY "Remove deprecated ISU Packages" - -REMOVE_UNNECESSARY_ISU_PKGS - NOTIFY "----------------------------------------------------------------------" NOTIFY "System RW update: rw update started" @@ -154,6 +149,12 @@ else CURRENT_TASK=$(( ${CURRENT_TASK} + 1 )) done + NOTIFY "----------------------------------------------------------------------" + NOTIFY "Remove deprecated ISU Packages" + + PREPARE_PKGMGR_ENV + REMOVE_UNNECESSARY_ISU_PKGS + write_version_info if [ ${UPDATE_PROGRESS_ERR} = "1" ]