summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunmin Lee <sunm.lee@samsung.com>2016-12-20 16:01:05 +0900
committerSunmin Lee <sunm.lee@samsung.com>2016-12-20 17:58:45 +0900
commit9ce7b946b0aeb3c5ef9f6bc4033c5aedecb009ec (patch)
tree3f0757e7011922697994c766070c891cb6b802d0
parent1dd43a15e864eb2d2a2a0b109c55e44c229d7bc1 (diff)
downloadsystem-plugin-9ce7b946b0aeb3c5ef9f6bc4033c5aedecb009ec.tar.gz
system-plugin-9ce7b946b0aeb3c5ef9f6bc4033c5aedecb009ec.tar.bz2
system-plugin-9ce7b946b0aeb3c5ef9f6bc4033c5aedecb009ec.zip
The system-upgrade package is going to be included into normal image; and the upgrade image will be created by specific script (make_upgrade_image.sh). Change-Id: I2fa5eefdda8dbfede433cf0e1ab7101bca50e9ca Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
-rw-r--r--packaging/system-plugin.spec4
-rw-r--r--scripts/make_upgrade_image.sh88
-rwxr-xr-xupgrade/update-image.sh15
3 files changed, 88 insertions, 19 deletions
diff --git a/packaging/system-plugin.spec b/packaging/system-plugin.spec
index 878865a..06a1e97 100644
--- a/packaging/system-plugin.spec
+++ b/packaging/system-plugin.spec
@@ -184,8 +184,6 @@ 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 %{_datadir}/upgrade %{buildroot}/system-update
-install -m 644 rules/99-sdb-switch.rules %{buildroot}%{_prefix}/lib/udev/rules.d/
ln -s ../getty.target %{buildroot}%{_unitdir}/system-update.target.wants
# ivi
@@ -309,8 +307,6 @@ mv %{_sysconfdir}/fstab_lazymnt %{_sysconfdir}/fstab
#%{_unitdir}/system-update.target.wants/offline-update.service
%{_unitdir}/system-update.target.wants/init-update.service
%{_unitdir}/system-update.target.wants/getty.target
-/system-update
-%{_prefix}/lib/udev/rules.d/99-sdb-switch.rules
%files -n systemd-user-helper
%manifest systemd-user-helper.manifest
diff --git a/scripts/make_upgrade_image.sh b/scripts/make_upgrade_image.sh
new file mode 100644
index 0000000..15968ce
--- /dev/null
+++ b/scripts/make_upgrade_image.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+#
+# make_upgrade_image.sh
+#
+# Convert Tizen 3.0 platform image to upgrade image (2.4 -> 3.0)
+
+# For sdb debugging
+
+sdb_debugging=1
+sdb_rule='SUBSYSTEM=="switch", ATTR{name}=="usb_cable", ATTR{state}=="1", RUN+="/usr/bin/direct_set_debug.sh --sdb-set"\nSUBSYSTEM=="switch", ATTR{name}=="usb_cable", ATTR{state}=="0", RUN+="/usr/bin/direct_set_debug.sh --sdb-unset"'
+
+# Back up /home/owner & rpm db
+backup () {
+ echo "Back up home & rpm db"
+
+ local tmp_path=$1
+
+ umount ${tmp_path}
+ e2fsck -f rootfs.img
+ resize2fs rootfs.img 1G
+ mount rootfs.img ${tmp_path}
+
+ mount system-data.img ${tmp_path}/opt
+ mount user.img ${tmp_path}/opt/usr
+
+ mkdir ${tmp_path}/usr/share/upgrade/data/home
+ cp -af ${tmp_path}/opt/usr/home/owner ${tmp_path}/usr/share/upgrade/data/home
+
+ mkdir ${tmp_path}/usr/share/upgrade/data/rpm
+ cp -af ${tmp_path}/opt/var/lib/rpm/* ${tmp_path}/usr/share/upgrade/data/rpm
+
+ sync
+
+ umount -l ${tmp_path}/opt/usr
+ umount -l ${tmp_path}/opt
+
+ umount ${tmp_path}
+ e2fsck -f rootfs.img
+ resize2fs -M rootfs.img
+ mount rootfs.img ${tmp_path}
+}
+
+if [ `id -u` -ne 0 ]
+then
+ echo "make_upgrade_image.sh should be executed as root"
+ exit
+fi
+
+if [ ! $1 ]
+then
+ echo "usage: $0 [tizen-3.0-image(tar.gz)]"
+ exit
+fi
+
+echo "Decompressing $1"
+imgs=`tar zxvf $1`
+
+tmp_root=`mktemp -d system.XXX`
+echo "Mount rootfs.img"
+mount rootfs.img ${tmp_root}
+
+cwd=`pwd`
+backup ${cwd}/${tmp_root}
+
+echo "Make /system-update"
+ln -s /usr/share/upgrade/ ${tmp_root}/system-update
+
+# For sdb debugging
+if [ ${sdb_debugging} -eq 1 ]
+then
+ echo "Install sdb rule file"
+ rule_file="99-sdb-switch.rules"
+ echo ${sdb_rule} > ${rule_file}
+ install -m 644 ${rule_file} ${tmp_root}/usr/lib/udev/rules.d
+ rm ${rule_file}
+fi
+
+sync
+umount ${tmp_root}
+
+upgrade_img=`echo $1 | sed -e 's/\.tar\.gz//'`-upgrade.tar.gz
+echo "Compressing upgrade image ${upgrade_img}"
+tar zcf ${upgrade_img} dzImage modules.img rootfs.img
+
+echo "Remove dummies"
+rm -rf ${imgs} ${tmp_root}
+
+echo "Done"
diff --git a/upgrade/update-image.sh b/upgrade/update-image.sh
deleted file mode 100755
index 27441bc..0000000
--- a/upgrade/update-image.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# Modify normal image to upgrade image
-#
-
-# Back up rpm db for Tizen 3.0
-mkdir /usr/share/upgrade/data/rpm
-cp -af /var/lib/rpm/* /usr/share/upgrade/data/rpm
-
-# Back up default user home directory
-mkdir /usr/share/upgrade/data/home
-cp -af /home/owner /usr/share/upgrade/data/home
-
-# remove RW partitions' files
-rm -rf /opt/*