From: Sunmin Lee Date: Fri, 5 Aug 2016 10:45:54 +0000 (+0900) Subject: Upgrade: system upgrade package is added X-Git-Tag: submit/tizen/20160810.235655~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2ab6aec903f5c5789450b97fc1bf27d55e198c0f;p=platform%2Fadaptation%2Fsystem-plugin.git Upgrade: system upgrade package is added For upgrade of RW partition, offline system update function of systemd is activated. Update scripts for each packages should be under the upgrade/update-script, and new files for update version should be under the upgrade/data. * The update scripts are executed alphabetically (ref: man ls). To specify the execution order explicitly, numeric prefix can be used such as: 00.first.patch.sh, 01.second.patch.sh Change-Id: I12a4a703cf252ed671ecd6d94cda5ff624e5dd87 Signed-off-by: Sunmin Lee --- diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec index 819c023..b791dba 100644 --- a/packaging/system-plugin.spec +++ b/packaging/system-plugin.spec @@ -79,6 +79,13 @@ Requires: liblazymount = %{version} %description -n liblazymount-devel Development library for lazy mount feature.It supports some interface functions. +%package -n system-upgrade +Summary: System upgrade available patch +License: Apache-2.0 + +%description -n system-upgrade +Systemd offline system update activation package + %prep %setup -q @@ -143,6 +150,14 @@ install -m 644 units/tizen-fstrim-user.service %{buildroot}%{_unitdir} mkdir -p %{buildroot}%{_bindir} install -m 755 scripts/tizen-fstrim-on-charge.sh %{buildroot}%{_bindir} +# upgrade +mkdir -p %{buildroot}%{_datadir} +cp -r upgrade %{buildroot}%{_datadir} +mkdir -p %{buildroot}%{_unitdir}/system-update.target.wants +install -m 644 units/offline-update.service %{buildroot}%{_unitdir} +ln -s ../offline-update.service %{buildroot}%{_unitdir}/system-update.target.wants/offline-update.service +ln -s %{_datadir}/upgrade %{buildroot}/system-update + %clean rm -rf %{buildroot} @@ -240,3 +255,8 @@ mv %{_sysconfdir}/fstab_initrd %{_sysconfdir}/fstab %{_libdir}/pkgconfig/liblazymount.pc %{_bindir}/test_lazymount +%files -n system-upgrade +%{_datadir}/upgrade +%{_unitdir}/offline-update.service +%{_unitdir}/system-update.target.wants/offline-update.service +/system-update diff --git a/units/offline-update.service b/units/offline-update.service new file mode 100644 index 0000000..c90b4e0 --- /dev/null +++ b/units/offline-update.service @@ -0,0 +1,8 @@ +[Unit] +Description=System update script service +Requires=sysinit.target +After=sysinit.target + +[Service] +Type=simple +ExecStart=/system-update/update.sh diff --git a/upgrade/data/.gitignore b/upgrade/data/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/upgrade/scripts/.gitignore b/upgrade/scripts/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/upgrade/update.sh b/upgrade/update.sh new file mode 100755 index 0000000..ab46c9a --- /dev/null +++ b/upgrade/update.sh @@ -0,0 +1,24 @@ +#!/bin/sh +# RW update script +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +PATCH_DIR=/usr/share/upgrade/scripts +RESULT_FILE=/upgrade_result +RUN=/bin/sh + +rm /system-update + +if [ ! -d ${PATCH_DIR} ] +then + echo "FAIL: Upgrade directory does not exist" > ${RESULT_FILE} +else + PATCHES=`/bin/ls ${PATCH_DIR}` + + for PATCH in ${PATCHES}; do + ${RUN} ${PATCH_DIR}/${PATCH} + done + + echo "SUCCESS: Upgrade successfully finished" > ${RESULT_FILE} +fi + +systemctl reboot