From 1d54574aafb44faf41ba52b3334ce9e687993cf1 Mon Sep 17 00:00:00 2001 From: Sunmin Lee Date: Mon, 12 Sep 2016 21:41:22 +0900 Subject: Upgrade: Automated upgrade From now on, this package activates upgrade automatically when the device is rebooted. And for this, more detailed logging method is added. Change-Id: Icd46e088be15bd08b9cff3681662f585a505c31f Signed-off-by: Sunmin Lee --- packaging/system-plugin.spec | 9 ++------- units/init-update.service | 8 -------- units/offline-update.service | 2 +- upgrade/update-image.sh | 4 ++-- upgrade/update-init.sh | 2 +- upgrade/update.sh | 20 +++++++++++++++----- 6 files changed, 21 insertions(+), 24 deletions(-) delete mode 100644 units/init-update.service diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec index 858d295..36a06d9 100644 --- a/packaging/system-plugin.spec +++ b/packaging/system-plugin.spec @@ -175,11 +175,9 @@ install -m 755 scripts/tizen-fstrim-on-charge.sh %{buildroot}%{_bindir} mkdir -p %{buildroot}%{_datadir} cp -r upgrade %{buildroot}%{_datadir} mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants -install -m 644 units/init-update.service %{buildroot}%{_unitdir} install -m 644 units/offline-update.service %{buildroot}%{_unitdir} -ln -s ../init-update.service %{buildroot}%{_unitdir}/system-update.target.wants/init-update.service +ln -s ../offline-update.service %{buildroot}%{_unitdir}/system-update.target.wants/offline-update.service ln -s %{_datadir}/upgrade %{buildroot}/system-update -install -m 644 rules/99-sdb-switch.rules %{buildroot}%{_prefix}/lib/udev/rules.d/ %clean rm -rf %{buildroot} @@ -294,11 +292,8 @@ mv %{_sysconfdir}/fstab_lazymnt %{_sysconfdir}/fstab %files -n system-upgrade %{_datadir}/upgrade %{_unitdir}/offline-update.service -%{_unitdir}/init-update.service -#%{_unitdir}/system-update.target.wants/offline-update.service -%{_unitdir}/system-update.target.wants/init-update.service +%{_unitdir}/system-update.target.wants/offline-update.service /system-update -%{_prefix}/lib/udev/rules.d/99-sdb-switch.rules %files -n systemd-user-helper %manifest systemd-user-helper.manifest diff --git a/units/init-update.service b/units/init-update.service deleted file mode 100644 index e438cb3..0000000 --- a/units/init-update.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=System update initialize service -Requires=sysinit.target -After=sysinit.target - -[Service] -Type=simple -ExecStart=/system-update/update-init.sh diff --git a/units/offline-update.service b/units/offline-update.service index ed00616..c90b4e0 100644 --- a/units/offline-update.service +++ b/units/offline-update.service @@ -1,7 +1,7 @@ [Unit] Description=System update script service Requires=sysinit.target -After=sysinit.target init-update.service +After=sysinit.target [Service] Type=simple diff --git a/upgrade/update-image.sh b/upgrade/update-image.sh index fd20bcf..6d73b74 100755 --- a/upgrade/update-image.sh +++ b/upgrade/update-image.sh @@ -4,8 +4,8 @@ # # Back rpm db up for Tizen 3.0 -mkdir /system-update/data/rpm -cp -arf /var/lib/rpm/* /system-update/data/rpm +mkdir /usr/share/upgrade/data/rpm +cp -arf /var/lib/rpm/* /usr/share/upgrade/data/rpm # remove RW partitions' files rm -rf /opt/* diff --git a/upgrade/update-init.sh b/upgrade/update-init.sh index 43e33ad..63f993b 100755 --- a/upgrade/update-init.sh +++ b/upgrade/update-init.sh @@ -23,7 +23,7 @@ gum-utils --offline -u --uid 5001 # Copy 3.0 rpm db rm -rf /var/lib/rpm/* -cp -arf /system-update/data/rpm/* /var/lib/rpm +cp -arf /usr/share/upgrade/data/rpm/* /var/lib/rpm # Disable cynara-check buxton2ctl security-disable diff --git a/upgrade/update.sh b/upgrade/update.sh index a4d3534..bd883d7 100755 --- a/upgrade/update.sh +++ b/upgrade/update.sh @@ -5,27 +5,37 @@ PATH=/bin:/usr/bin:/sbin:/usr/sbin PATCH_DIR=/usr/share/upgrade/scripts -RESULT_FILE=/upgrade_result +UPDATE_DIR=/opt/upgrade +RESULT_FILE=${UPDATE_DIR}/update_result +UPDATE_LOG=${UPDATE_DIR}/update_log RUN=/bin/sh # Change to normal mode from next booting rm /system-update -rm /usr/lib/udev/rules.d/99-sdb-switch.rules # Execute update scripts if [ ! -d ${PATCH_DIR} ] then echo "FAIL: Upgrade directory does not exist" > ${RESULT_FILE} else + mkdir -p ${UPDATE_DIR} + + echo "UPDATE: initializing" >> ${UPDATE_LOG} + ${RUN} /usr/share/upgrade/update-init.sh >> ${UPDATE_LOG} 2>&1 + PATCHES=`/bin/ls ${PATCH_DIR}` + echo "UPDATE: RW update scripts" >> ${UPDATE_LOG} for PATCH in ${PATCHES}; do - ${RUN} ${PATCH_DIR}/${PATCH} + echo "${PATCH} is started..." >> ${UPDATE_LOG} + ${RUN} ${PATCH_DIR}/${PATCH} >> ${UPDATE_LOG} 2>&1 + echo "${PATCH} is ended..." >> ${UPDATE_LOG} done - ${RUN} /usr/share/upgrade/update-post.sh + echo "UPDATE: post operations" >> ${UPDATE_LOG} + ${RUN} /usr/share/upgrade/update-post.sh >> ${UPDATE_LOG} 2>&1 - echo "SUCCESS: Upgrade successfully finished" > ${RESULT_FILE} + echo "SUCCESS: Upgrade successfully finished" >> ${RESULT_FILE} fi # Reboot -- cgit v1.2.3