system-upgrade: patch for normal image 43/106043/2 accepted/tizen_3.0.m2_mobile accepted/tizen_3.0.m2_tv accepted/tizen_3.0.m2_wearable tizen_3.0.m2 accepted/tizen/3.0.m2/mobile/20170104.100239 accepted/tizen/3.0.m2/tv/20170104.100421 accepted/tizen/3.0.m2/wearable/20170104.101018 accepted/tizen/3.0/common/20161221.181219 accepted/tizen/3.0/ivi/20161221.010849 accepted/tizen/3.0/mobile/20161221.011431 accepted/tizen/3.0/tv/20161221.010641 accepted/tizen/3.0/wearable/20161221.010557 submit/tizen_3.0.m2/20170104.093748 submit/tizen_3.0/20161220.090555
authorSunmin Lee <sunm.lee@samsung.com>
Tue, 20 Dec 2016 07:01:05 +0000 (16:01 +0900)
committerSunmin Lee <sunm.lee@samsung.com>
Tue, 20 Dec 2016 08:58:45 +0000 (17:58 +0900)
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>
packaging/system-plugin.spec
scripts/make_upgrade_image.sh [new file with mode: 0644]
upgrade/update-image.sh [deleted file]

index 878865a..06a1e97 100644 (file)
@@ -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 (file)
index 0000000..15968ce
--- /dev/null
@@ -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 (executable)
index 27441bc..0000000
+++ /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/*