Upgrade: system upgrade package is added 38/82738/6
authorSunmin Lee <sunm.lee@samsung.com>
Fri, 5 Aug 2016 10:45:54 +0000 (19:45 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Tue, 9 Aug 2016 08:02:22 +0000 (17:02 +0900)
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 <sunm.lee@samsung.com>
packaging/system-plugin.spec
units/offline-update.service [new file with mode: 0644]
upgrade/data/.gitignore [new file with mode: 0644]
upgrade/scripts/.gitignore [new file with mode: 0644]
upgrade/update.sh [new file with mode: 0755]

index 819c023c034da28a4af8bd805f6f261593cc2016..b791dba806cdb1c83f25d21cb25796336d77d300 100644 (file)
@@ -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 (file)
index 0000000..c90b4e0
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
diff --git a/upgrade/scripts/.gitignore b/upgrade/scripts/.gitignore
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/upgrade/update.sh b/upgrade/update.sh
new file mode 100755 (executable)
index 0000000..ab46c9a
--- /dev/null
@@ -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