summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunmin Lee <sunm.lee@samsung.com>2016-08-05 19:45:54 +0900
committerSunmin Lee <sunm.lee@samsung.com>2016-08-09 17:02:22 +0900
commit2ab6aec903f5c5789450b97fc1bf27d55e198c0f (patch)
tree3d848871bdff96f1ff7e431dce8f9b45cef60810
parent5ed58f4011c1439f180594a4d762974e3a2888d9 (diff)
downloadsystem-plugin-2ab6aec903f5c5789450b97fc1bf27d55e198c0f.tar.gz
system-plugin-2ab6aec903f5c5789450b97fc1bf27d55e198c0f.tar.bz2
system-plugin-2ab6aec903f5c5789450b97fc1bf27d55e198c0f.zip
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 <sunm.lee@samsung.com>
-rw-r--r--packaging/system-plugin.spec20
-rw-r--r--units/offline-update.service8
-rw-r--r--upgrade/data/.gitignore0
-rw-r--r--upgrade/scripts/.gitignore0
-rwxr-xr-xupgrade/update.sh24
5 files changed, 52 insertions, 0 deletions
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
--- /dev/null
+++ b/upgrade/data/.gitignore
diff --git a/upgrade/scripts/.gitignore b/upgrade/scripts/.gitignore
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/upgrade/scripts/.gitignore
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