From 05bac516402f396763da22c12f90fa25630a6494 Mon Sep 17 00:00:00 2001 From: Sunmin Lee Date: Wed, 20 Dec 2017 11:26:55 +0900 Subject: [PATCH] Revert recovery update service Recovery partitions will be updated by PRE_UA. - Revert "Fix Architecture Dependency" - Revert "Introduce recovery-update.service" Change-Id: Ic15dda2e82ec1ab91d9c48121ec09486a8e88876 Signed-off-by: Sunmin Lee --- packaging/system-rw-update.spec | 9 +--- units/recovery-update.service | 12 ------ upgrade/recovery-update.sh | 91 ----------------------------------------- upgrade/update-init.sh | 18 -------- upgrade/update.sh | 18 ++++---- 5 files changed, 10 insertions(+), 138 deletions(-) delete mode 100755 units/recovery-update.service delete mode 100755 upgrade/recovery-update.sh diff --git a/packaging/system-rw-update.spec b/packaging/system-rw-update.spec index 84bad20..41a10fb 100644 --- a/packaging/system-rw-update.spec +++ b/packaging/system-rw-update.spec @@ -1,6 +1,6 @@ Name: system-rw-update Summary: System RW update management -Version: 1.1.0 +Version: 1.2.0 Release: 0 Group: Base/Startup License: Apache-2.0 @@ -49,11 +49,6 @@ ln -s ../offline-update.service %{buildroot}%{_unitdir}/system-update.target.wan ln -s ../getty.target %{buildroot}%{_unitdir}/system-update.target.wants ln -s ../cynara.socket %{buildroot}%{_unitdir}/system-update.target.wants -# recovery update service -mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants/ -install -m 0644 units/recovery-update.service %{buildroot}%{_unitdir}/recovery-update.service -ln -s ../recovery-update.service %{buildroot}%{_unitdir}/multi-user.target.wants/recovery-update.service - # SDB debugging install -m 644 units/udev-sdb-init.service %{buildroot}%{_unitdir} ln -s ../udev-sdb-init.service %{buildroot}%{_unitdir}/system-update.target.wants @@ -78,8 +73,6 @@ fi %{_datadir}/upgrade/* %{_unitdir}/offline-update.service %{_unitdir}/system-update.target.wants -%{_unitdir}/recovery-update.service -%{_unitdir}/multi-user.target.wants/recovery-update.service %{_unitdir}/udev-sdb-init.service %files ani diff --git a/units/recovery-update.service b/units/recovery-update.service deleted file mode 100755 index 478f99c..0000000 --- a/units/recovery-update.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Recovery Update -Wants=local-fs.target -After=local-fs.target - -[Service] -Type=oneshot -SmackProcessLabel=System -ExecStart=/usr/share/upgrade/recovery-update.sh - -[Install] -WantedBy=multi-user.target diff --git a/upgrade/recovery-update.sh b/upgrade/recovery-update.sh deleted file mode 100755 index dc068a5..0000000 --- a/upgrade/recovery-update.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh - -FULL_RECOVERY_P=ramdisk-recovery.img -TOTA_RECOVERY_P=RAMDISK2 -BLKDEV_RECOVERY= -POSTRESULT=post.result - -STATUS_DIR=/opt/data/recovery - -UPI_RECOVERY_PARTITION_COPY_ERROR=fa19 -UPI_RECOVERY_UPDATE_ERROR=fa1a - -#===================== -# funtions -#===================== - -#------------------------------------------------ -# print_log -#------------------------------------------------ -print_log() { - echo $@ - echo $@ >> ${PATCH_LOG_FILE} - /bin/sync -} - -#------------------------------------------------ -# get partition id -#------------------------------------------------ -get_partition_id() { - BLKID="/usr/sbin/blkid" - - PART_RECOVERY=$("$BLKID" --match-token PARTLABEL=ramdisk2 -o device || - "$BLKID" --match-token LABEL=ramdisk-recovery -o device) -} - -#===================== -# main routine start -#===================== - -get_partition_id - -BLKDEV_RECOVERY=${PART_RECOVERY} - -if [ ! -d ${STATUS_DIR} ]; then - echo "${STATUS_DIR} not exist" - exit 0 -fi - -if [ -f ${DST_DIR}/${TOTA_RECOVERY_P} ]; then - /bin/mv ${DST_DIR}/${TOTA_RECOVERY_P} ${DST_DIR}/${FULL_RECOVERY_P} -fi - -PATCH_LOG_FILE=${STATUS_DIR}/RW.LOG - -DST_DIR=/opt/usr/data/fota - -#------------------------------------------------ -# update recovery partition -#------------------------------------------------ -if [ -r ${DST_DIR}/${FULL_RECOVERY_P} ]; then - - #--- FULL_IMG case --- - TIMESTAMP=$(/bin/date +%H:%M:%S) - print_log "start recovery partition update : (${TIMESTAMP})" - - /bin/dd if=${DST_DIR}/${FULL_RECOVERY_P} of=${BLKDEV_RECOVERY} - if [ "$?" = "0" ]; then - /bin/rm -f ${DST_DIR}/${FULL_RECOVERY_P} - /bin/sync - print_log "update succeeded" - else - if [ -f /opt/data/recovery/result ]; then - fotaflag=`/bin/cat /opt/data/recovery/result` - if [ "$fotaflag" = "0" ]; then - echo ${UPI_RECOVERY_PARTITION_COPY_ERROR} > /opt/data/recovery/result - /usr/bin/chmod 644 /opt/data/recovery/result - print_log "Change result to ${UPI_RECOVERY_PARTITION_COPY_ERROR}" - fi - fi - print_log "update failed" - fi - - TIMESTAMP=$(/bin/date +%H:%M:%S) - print_log "end recovery partition update : (${TIMESTAMP})" -else - ULOG="skip recovery partition update" - /usr/bin/grep "${ULOG}" ${PATCH_LOG_FILE} > /dev/null 2>&1 - if [ "$?" != 0 ]; then - print_log "${ULOG}" - fi -fi diff --git a/upgrade/update-init.sh b/upgrade/update-init.sh index 5a02ac3..6825aeb 100755 --- a/upgrade/update-init.sh +++ b/upgrade/update-init.sh @@ -7,13 +7,6 @@ RW_MACRO=/usr/share/upgrade/rw-update-macro.inc RW_UPDATE=/usr/share/upgrade/update.sh DEBUG_MODE=/opt/usr/.upgdebug -DELTA_TAR=delta.tar -FULL_RECOVERY=ramdisk-recovery.img -TOTA_RECOVERY=RAMDISK2 -DST_DIR=/opt/usr/data/fota -STATUS_DIR=/opt/data/recovery -DELTA_PATH_FILE=${STATUS_DIR}/DELTA.PATH - if [ -f $RW_MACRO ]; then source $RW_MACRO get_version_info @@ -28,17 +21,6 @@ fi # Permission Update for shared directories /etc/gumd/useradd.d/91_user-dbspace-permissions.post owner -# Pre operations for recovery update -if [ -f ${DELTA_PATH_FILE} ]; then - if [ -f ${DST_DIR}/${TOTA_RECOVERY} ]; then - /bin/mv ${DST_DIR}/${TOTA_RECOVERY} ${DST_DIR}/${FULL_RECOVERY} - fi -fi - -if [ -f ${DELTA_DIR}/${DELTA_TAR} ]; then - /bin/rm -f ${DELTA_DIR}/${DELTA_TAR} -fi - sleep 10 if [ -f $DEBUG_MODE ]; then exit diff --git a/upgrade/update.sh b/upgrade/update.sh index ca15404..9129823 100755 --- a/upgrade/update.sh +++ b/upgrade/update.sh @@ -6,7 +6,7 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin TMP_DIR=/tmp/upgrade PATCH_DIR=/usr/share/upgrade/scripts -RW_LOG=/opt/data/recovery/RW.LOG +RESULT_FILE=/opt/data/recovery/rw_result SDB_RULE=/opt/data/recovery/99-sdb-switch.rules VERSION_FILE=/opt/etc/version RW_MACRO=/usr/share/upgrade/rw-update-macro.inc @@ -24,7 +24,7 @@ RW_ANI=/usr/bin/rw-update-ani Verity_Check() { if [ "z$1" = "z" ]; then - echo "Input Shell Script Null" >> ${RW_LOG} + echo "Input Shell Script Null" >> ${RESULT_FILE} return 1 fi @@ -39,18 +39,18 @@ Verity_Check() { md5list=`/usr/bin/grep ${SC_FILE} ${SC_LIST} | /usr/bin/awk -F' ' '{print $2}'` if [ "$md5result" = "$md5list" ]; then - echo "[PASS ] ${SC_FILE} verity check" >> ${RW_LOG} + echo "[PASS ] ${SC_FILE} verity check" >> ${RESULT_FILE} return 0 else - echo "[MISMATCH] ${SC_FILE} md5sum" >> ${RW_LOG} + echo "[MISMATCH] ${SC_FILE} md5sum" >> ${RESULT_FILE} return 2 fi else - echo "[No entry] ${SC_FILE} in ${SC_LIST}" >> ${RW_LOG} + echo "[No entry] ${SC_FILE} in ${SC_LIST}" >> ${RESULT_FILE} return 1 fi else - echo "No such file ${SC_LIST}" >> ${RW_LOG} + echo "No such file ${SC_LIST}" >> ${RESULT_FILE} return 1 fi } @@ -64,12 +64,12 @@ if [ -e ${RW_ANI} ]; then RW_GUI=1 fi -echo "System RW update: rw update started" > ${RW_LOG} +echo "System RW update: rw update started" > ${RESULT_FILE} # Execute update scripts if [ ! -d ${PATCH_DIR} ] then - echo "FAIL: Upgrade directory does not exist" >> ${RW_LOG} + echo "FAIL: Upgrade directory does not exist" >> ${RESULT_FILE} else if [ "${RW_GUI}" = "1" ]; then progress=0 @@ -97,7 +97,7 @@ else sync - echo "SUCCESS: Upgrade successfully finished" >> ${RW_LOG} + echo "SUCCESS: Upgrade successfully finished" >> ${RESULT_FILE} fi if [ -e ${SDB_RULE} ]; then -- 2.7.4