"Online Update" is a new type of OS Update.
After "reboot fota" the normal boot will be performed, and in addition
the following targets will be run:
* online-update-pre.target - this target startup is reached very realy -
after mouting the file system and before starting services. Within
this target, changes to permission and directory structure, for
example, should take place.
* online-update.target - this target is started after the basic services
(like dlog, dbus) are started. Data migration of services should take
place within this target.
If a service requires data migration after an upgrade, it should provide
a service that will perform the migration at the appropriate time of
system startup. For example:
[Unit]
Description=Bluetooth upgrade service
ConditionKernelCommandLine=bootmode=fota
Before=online-update.target bluetooth-share.service
After=opt.mount
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/usr/share/upgrade/scripts/bluetooth-share/bluetooth-share_upgrade.sh
SmackProcessLabel=System
[Install]
RequiredBy=online-update.target
The lines:
Before=online-update.target bluetooth-share.service
After=opt.mount
are responsible for starting the service at the right time.
The old upgrade type is still supported. If the system is booted like
this:
/usr/lib/systemd/systemd --unit=system-update.target
the old upgrade (Offline) will be performed. And if it runs like this:
/usr/lib/systemd/system --unit=online-update.target
then the new upgrade (Online) will be performed.
Change-Id: I691af6c500da66fb537fd744e40fec2e7a607242
mkdir -p %{buildroot}%{upgrade_support_dir}
install -m 755 scripts/upgrade-support/* %{buildroot}%{upgrade_support_dir}
+mkdir -p %{buildroot}%{upgrade_scripts_dir}/online-update-scripts-pre
+mkdir -p %{buildroot}%{upgrade_scripts_dir}/online-update-scripts
+mkdir -p %{buildroot}%{upgrade_scripts_dir}/online-update-verify
%define fota_dir /opt/usr/data/fota
mkdir -p %{buildroot}%{fota_dir}
install -m 644 scripts/clone_partitions/clone_partitions_recovery.service %{buildroot}%{_unitdir}
ln -s ../clone_partitions_recovery.service %{buildroot}%{_unitdir}/recovery.service.wants/
+
# rw-update
mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants
mkdir -p %{buildroot}%{_unitdir}/local-fs.target.wants
mkdir -p %{buildroot}%{_unitdir}/delayed.target.wants
+mkdir -p %{buildroot}%{_unitdir}/online-update-pre.target.requires
+mkdir -p %{buildroot}%{_unitdir}/online-update.target.requires
+mkdir -p %{buildroot}%{_unitdir}/online-update-failure.target.requires
+mkdir -p %{buildroot}%{_unitdir}/online-update-success.service.requires
ln -s ../getty.target %{buildroot}%{_unitdir}/system-update.target.wants
ln -s ../cynara.socket %{buildroot}%{_unitdir}/system-update.target.wants
ln -s ../dbus.socket %{buildroot}%{_unitdir}/system-update.target.wants
ln -s ../udev-trigger-dmbow@.service %{buildroot}%{_unitdir}/system-update.target.wants/udev-trigger-dmbow@user.service
ln -s ../data-checkpoint.service %{buildroot}%{_unitdir}/local-fs.target.wants/data-checkpoint.service
ln -s ../update-post.service %{buildroot}%{_unitdir}/system-update.target.wants
-ln -s ../update-finalize.service %{buildroot}%{_unitdir}/delayed.target.wants
+
+ln -s ../default.target %{buildroot}%{_unitdir}/online-update.target.requires
+ln -s ../online-update-pre.target %{buildroot}%{_unitdir}/online-update.target.requires
+ln -s ../online-update-pre.service %{buildroot}%{_unitdir}/online-update-pre.target.requires
+ln -s ../online-update.service %{buildroot}%{_unitdir}/online-update.target.requires
+ln -s ../online-update-verify.service %{buildroot}%{_unitdir}/online-update-success.service.requires
+ln -s ../online-update-success.service %{buildroot}%{_unitdir}/delayed.target.wants
+ln -s ../online-update-failure.service %{buildroot}%{_unitdir}/online-update-failure.target.requires
%posttrans engine
newrulesfile=99-sdb-switch.rules
# rw-upgrade
%{_unitdir}/data-checkpoint.service
%{_unitdir}/local-fs.target.wants/data-checkpoint.service
-%{_unitdir}/delayed.target.wants/update-finalize.service
%{_unitdir}/offline-update.service
%{_unitdir}/system-update.target.wants/cynara.socket
%{_unitdir}/system-update.target.wants/dbus.socket
%{_unitdir}/system-update.target.wants/update-post.service
%{_unitdir}/udev-sdb-init.service
%{_unitdir}/udev-trigger-dmbow@.service
-%{_unitdir}/update-finalize.service
%{_unitdir}/update-post.service
+%{_unitdir}/online-update-pre.target
+%{_unitdir}/online-update-pre.target.requires/online-update-pre.service
+%{_unitdir}/online-update-pre.service
+%{_unitdir}/online-update.target
+%{_unitdir}/online-update.target.requires/online-update.service
+%{_unitdir}/online-update.target.requires/online-update-pre.target
+%{_unitdir}/online-update.target.requires/default.target
+%{_unitdir}/online-update.service
+%{_unitdir}/online-update-failure.target
+%{_unitdir}/online-update-failure.target.requires/online-update-failure.service
+%{_unitdir}/online-update-failure.service
+%{_unitdir}/online-update-verify.service
+%{_unitdir}/online-update-success.service
+%{_unitdir}/online-update-success.service.requires/online-update-verify.service
+%{_unitdir}/delayed.target.wants/online-update-success.service
%{upgrade_scripts_dir}/99-sdb-switch.rules
%{upgrade_scripts_dir}/install-sdb-rule.sh
%{upgrade_scripts_dir}/record-version.sh
%{upgrade_scripts_dir}/update-post.sh
%{upgrade_scripts_dir}/update.sh
%{upgrade_scripts_dir}/update-verify.sh
+%{upgrade_scripts_dir}/online-update-pre.sh
+%{upgrade_scripts_dir}/online-update.sh
+%{upgrade_scripts_dir}/online-update-scripts-pre/
+%{upgrade_scripts_dir}/online-update-scripts/
+%{upgrade_scripts_dir}/online-update-verify/
+%{upgrade_scripts_dir}/online-update-verify.sh
+%{upgrade_scripts_dir}/online-update-success.sh
%files -n parse-dynparts
%manifest upgrade.manifest
CONFIGURE_FILE(udev-sdb-init.service.in udev-sdb-init.service @ONLY)
CONFIGURE_FILE(offline-update.service.in offline-update.service @ONLY)
CONFIGURE_FILE(data-checkpoint.service.in data-checkpoint.service @ONLY)
+CONFIGURE_FILE(online-update-pre.sh.in online-update-pre.sh @ONLY)
+CONFIGURE_FILE(online-update-pre.service.in online-update-pre.service @ONLY)
+CONFIGURE_FILE(online-update.service.in online-update.service @ONLY)
+CONFIGURE_FILE(online-update.sh.in online-update.sh @ONLY)
+CONFIGURE_FILE(online-update-verify.service.in online-update-verify.service @ONLY)
+CONFIGURE_FILE(online-update-verify.sh.in online-update-verify.sh @ONLY)
+CONFIGURE_FILE(online-update-success.sh.in online-update-success.sh @ONLY)
INSTALL(FILES
udev-sdb-init.service
offline-update.service
data-checkpoint.service
update-post.service
- update-finalize.service
udev-trigger-dmbow@.service
+ online-update-pre.target
+ online-update-pre.service
+ online-update.target
+ online-update.service
+ online-update-failure.target
+ online-update-failure.service
+ online-update-verify.service
+ online-update-success.service
DESTINATION ${UNIT_DIR})
INSTALL(FILES
update-post.sh
update-finalize.sh
update-verify.sh
+ online-update-pre.sh
+ online-update.sh
+ online-update-verify.sh
+ online-update-success.sh
DESTINATION ${UPGRADE_SCRIPTS_DIR}
PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
--- /dev/null
+[Unit]
+Description=System Update failure - reboot
+DefaultDependencies=no
+Before=online-update-failure.target
+ConditionKernelCommandLine=bootmode=fota
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System::Privileged
+ExecStartPre=-/bin/device_board_set_upgrade_status -1
+ExecStart=/usr/sbin/reboot -f
+StandardOutput=tty
+StandardError=tty
+RemainAfterExit=yes
+
--- /dev/null
+[Unit]
+Description=Online Update: failure
+DefaultDependencies=no
+ConditionKernelCommandLine=bootmode=fota
--- /dev/null
+[Unit]
+Description=System update script service
+DefaultDependencies=no
+Conflicts=shutdown.target
+Requires=data-checkpoint.service
+After=data-checkpoint.service
+Before=online-update-pre.target
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System::Privileged
+ExecStartPre=/bin/rm -f @UPGRADE_VAR_DIR@/log/system-rw-update.log
+ExecStart=@UPGRADE_SCRIPTS_DIR@/online-update-pre.sh
+StandardOutput=tty
+StandardError=tty
+RemainAfterExit=yes
+
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+COLOR_ERROR='\033[01;31m'
+RW_MACRO=@UPGRADE_SCRIPTS_DIR@/rw-update-macro.inc
+SCRIPTS_DIR="@UPGRADE_SCRIPTS_DIR@/online-update-scripts-pre"
+SHELL=/bin/bash
+
+source $RW_MACRO
+
+shopt -s nullglob
+
+ERROR()
+{
+ LOG_TEXT=$1
+ echo -e "${COLOR_ERROR}${LOG_TEXT}${COLOR_RESET}"
+}
+
+# Restore rpm db
+rm -rf /var/lib/rpm/*
+restore_backup_file -f /opt/var/lib/rpm
+
+# Permission Update for shared directories
+/etc/gumd/useradd.d/91_user-dbspace-permissions.post owner
+
+for SCRIPT in $SCRIPTS_DIR/*; do
+ if ! $SHELL "$SCRIPT"; then
+ ERROR "Script $SCRIPT failed - update considered unsuccessful"
+ exit 1
+ fi
+done
+
--- /dev/null
+[Unit]
+Description=System Update - before starting the system
+DefaultDependencies=no
+Before=sysinit.target sockets.target
+After=local-fs.target
+Conflicts=shutdown.target
+OnFailure=online-update-failure.target
+OnFailureJobMode=replace-irreversibly
--- /dev/null
+[Unit]
+Description=Finalize OS update
+DefaultDependencies=no
+After=system-delayed-target-done.service online-update-verify.service
+Conflicts=shutdown.target online-update-failure.target reboot.target
+ConditionKernelCommandLine=bootmode=fota
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System::Privileged
+ExecStart=/usr/share/upgrade/online-update-success.sh
+RemainAfterExit=true
+StandardOutput=tty
+StandardError=tty
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+RW_MACRO=@UPGRADE_SCRIPTS_DIR@/rw-update-macro.inc
+HAL_SET_UPGRADE_STATUS=/usr/bin/device_board_set_upgrade_status
+
+SCRIPT_NAME=$(basename $0)
+CRITICAL_LOG()
+{
+ LOG="[$SCRIPT_NAME]$1"
+ dlogsend -k "$LOG"
+ if [ "$2" != "" ]; then
+ echo "$LOG" >> "$2"
+ fi
+ echo "$LOG"
+}
+
+SET_UPGRADE_STATUS()
+{
+ ${HAL_SET_UPGRADE_STATUS} "$1"
+ if [ $? -eq 0 ]; then
+ CRITICAL_LOG "set_upgrade_status success: ${1}"
+ else
+ CRITICAL_LOG "set_upgrade_status failed: ${1}"
+ fi
+}
+
+if [ -f $RW_MACRO ];
+then
+ source $RW_MACRO
+else
+ ERROR "FAIL: Upgrade macro does not exist"
+ UPDATE_PREPARE_ERR=1
+fi
+
+if [ -z ${UPDATE_PREPARE_ERR+x} ]; then
+ /usr/bin/device_board_clear_boot_mode
+ if ! COMMIT_CHANGES; then
+ ERROR "FAIL: Commit changes error"
+ reboot -f fota
+ fi
+
+ /usr/bin/device_board_clear_partition_ab_cloned
+ /usr/bin/device_board_set_boot_success
+ SET_UPGRADE_STATUS 100
+else
+ reboot -f fota
+fi
--- /dev/null
+[Unit]
+Description=System Update: verify
+DefaultDependencies=no
+After=online-update.target system-delayed-target-done.service
+ConditionKernelCommandLine=bootmode=fota
+Conflicts=shutdown.target
+OnFailure=online-update-failure.target
+OnFailureJobMode=replace-irreversibly
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System::Privileged
+ExecStart=@UPGRADE_SCRIPTS_DIR@/online-update-verify.sh
+RemainAfterExit=true
+
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+VERIFY_SCRIPTS_DIR="@UPGRADE_SCRIPTS_DIR@/online-update-verify"
+SHELL=/bin/bash
+
+shopt -s nullglob
+
+ERROR()
+{
+ LOG_TEXT=$1
+ echo -e "${COLOR_ERROR}${LOG_TEXT}${COLOR_RESET}"
+}
+
+for SCRIPT in $VERIFY_SCRIPTS_DIR/*; do
+ if ! $SHELL "$SCRIPT"; then
+ ERROR "Script $SCRIPT failed - update considered unsuccessful"
+ exit 1
+ fi
+done
+
--- /dev/null
+[Unit]
+Description=System update script service
+DefaultDependencies=no
+After=basic.target
+Before=online-update.target
+
+[Service]
+Type=oneshot
+SmackProcessLabel=System::Privileged
+ExecStart=@UPGRADE_SCRIPTS_DIR@/online-update.sh
+StandardOutput=tty
+StandardError=tty
+RemainAfterExit=yes
+
--- /dev/null
+#!/bin/bash
+PATH=/bin:/usr/bin:/sbin:/usr/sbin
+
+COLOR_ERROR='\033[01;31m'
+COLOR_DEBUG='\033[01;34m'
+COLOR_NOTIFY='\033[01;33m'
+COLOR_RESET='\033[00;00m'
+RW_MACRO=@UPGRADE_SCRIPTS_DIR@/rw-update-macro.inc
+SCRIPTS_DIR="@UPGRADE_SCRIPTS_DIR@/online-update-scripts"
+UPDATE_DATA_DIR=/opt/data/update
+SDB_RULE=${UPDATE_DATA_DIR}/99-sdb-switch.rules
+source $RW_MACRO
+
+shopt -s nullglob
+
+SCRIPT_NAME=$(basename $0)
+
+DEBUG()
+{
+ LOG_TEXT=$1
+ echo -e "${COLOR_DEBUG}${LOG_TEXT}${COLOR_RESET}"
+}
+
+ERROR()
+{
+ LOG_TEXT=$1
+ echo -e "${COLOR_ERROR}${LOG_TEXT}${COLOR_RESET}"
+}
+
+NOTIFY()
+{
+ LOG_TEXT=$1
+ echo -e "${COLOR_NOTIFY}${LOG_TEXT}${COLOR_RESET}"
+}
+
+CRITICAL_LOG()
+{
+ LOG="[$SCRIPT_NAME]$1"
+ dlogsend -k "$LOG"
+ if [ "$2" != "" ]; then
+ echo "$LOG" >> "$2"
+ fi
+ echo "$LOG"
+}
+
+NOTIFY "----------------------------------------------------------------------"
+NOTIFY "Remove deprecated ISU Packages"
+
+REMOVE_UNNECESSARY_ISU_PKGS
+
+get_version_info
+DEBUG "Version OLD: ${OLD_VER}, NEW: ${NEW_VER}"
+
+for SCRIPT in $SCRIPTS_DIR/*; do
+ if ! $SHELL "$SCRIPT"; then
+ ERROR "Script $SCRIPT failed - update considered unsuccessful"
+ exit 1
+ fi
+done
+
+write_version_info
+
+if [ -e ${SDB_RULE} ]; then
+ rm ${SDB_RULE}
+fi
--- /dev/null
+[Unit]
+Description=System Update
+DefaultDependencies=no
+Before=multi-user.target
+After=basic.target online-update-pre.target
+Conflicts=shutdown.target
+OnFailure=online-update-failure.target
+OnFailureJobMode=replace-irreversibly
return 0
}
+
+VERSION_COMPARE() {
+ local IFS='.'
+ ver_a=($1)
+ ver_b=($2)
+
+ local n
+ if [[ ${#ver_a[@]} > ${#ver_b[@]} ]]; then
+ n=${#ver_a[@]}
+ else
+ n=${#ver_b[@]}
+ fi
+ for ((i=0; i < n; i++)); do
+ if [[ $i -ge ${#ver_a[@]} ]]; then
+ ver_a[$i]=0
+ fi
+ if [[ $i -ge ${#ver_b[@]} ]]; then
+ ver_b[$i]=0
+ fi
+ done
+ for ((i=0; i < ${#ver_a[@]}; i++)); do
+ if (( ver_a[i] > ver_b[i] )); then
+ return 1
+ elif (( ver_a[i] < ver_b[i] )); then
+ return 2
+ fi
+ done
+ return 0
+}
+
+REMOVE_ISU_PKG()
+{
+ local PKG_NAME=$1
+ rm -rf "/opt/isu/$PKG_NAME"
+}
+
+REMOVE_UNNECESSARY_ISU_PKGS()
+{
+ local OS_RELEASE_NAME
+ 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 /opt/isu/ -maxdepth 2 -type f -name isu.cfg); do
+ PKG_NAME=$(basename "$(dirname "$ISUCFG")")
+ 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"
+ continue
+ 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__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"
+
+ if [[ $? != 2 ]]; then
+ # Package from the current image is newer than the one installed
+ # so we can remove the installed one
+ REMOVE_ISU_PKG "$PKG_NAME"
+ fi
+ done
+}
+++ /dev/null
-[Unit]
-Description=Finalize OS update
-DefaultDependencies=no
-After=system-delayed-target-done.service
-ConditionKernelCommandLine=bootmode=fota
-
-[Service]
-Type=oneshot
-SmackProcessLabel=System
-ExecStart=/usr/share/upgrade/update-finalize.sh
-RemainAfterExit=true
-
echo "$1" > ${PROGRESS_DIR}/progress
}
-VERSION_COMPARE() {
- local IFS='.'
- ver_a=($1)
- ver_b=($2)
-
- local n
- if [[ ${#ver_a[@]} > ${#ver_b[@]} ]]; then
- n=${#ver_a[@]}
- else
- n=${#ver_b[@]}
- fi
- for ((i=0; i < n; i++)); do
- if [[ $i -ge ${#ver_a[@]} ]]; then
- ver_a[$i]=0
- fi
- if [[ $i -ge ${#ver_b[@]} ]]; then
- ver_b[$i]=0
- fi
- done
- for ((i=0; i < ${#ver_a[@]}; i++)); do
- if (( ver_a[i] > ver_b[i] )); then
- return 1
- elif (( ver_a[i] < ver_b[i] )); then
- return 2
- fi
- done
- return 0
-}
-
-REMOVE_ISU_PKG()
-{
- local PKG_NAME=$1
- rm -rf "/opt/isu/$PKG_NAME"
-}
-
-REMOVE_UNNECESSARY_ISU_PKGS()
-{
- local OS_RELEASE_NAME
- 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 /opt/isu/ -maxdepth 2 -type f -name isu.cfg); do
- PKG_NAME=$(basename "$(dirname "$ISUCFG")")
- 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"
- continue
- 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__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"
-
- if [[ $? != 2 ]]; then
- # Package from the current image is newer than the one installed
- # so we can remove the installed one
- REMOVE_ISU_PKG "$PKG_NAME"
- fi
- done
-}
-
# This result file will be used for Platform Update Control API to get update result.
UPDATE_RESULT_FILE=${UPDATE_DATA_DIR}/result
UPI_RW_UPDATE_ERROR_NONE=00
rm ${STATUS_FILE}
COMMIT_CHANGES
fi
-#Reboot by update-finalize.service
+#Reboot by update-post.service