Add OS Upgrade script for Tizen 7.0->8.0 09/309309/3 accepted/tizen/unified/20240424.063520 accepted/tizen/unified/dev/20240620.003430 accepted/tizen/unified/x/20240425.051135 accepted/tizen/unified/x/asan/20240625.092731
authorKrishna Kant Jaju <krishna.jaju@samsung.com>
Mon, 8 Apr 2024 10:31:33 +0000 (16:01 +0530)
committerKrishna Kant Jaju <krishna.jaju@samsung.com>
Tue, 9 Apr 2024 03:26:37 +0000 (08:56 +0530)
Change-Id: I0aeab21a035c36a14552b02e2391c6d30d437300
Signed-off-by: Krishna Kant Jaju <krishna.jaju@samsung.com>
packaging/account-manager.spec
scripts/account-manager.sh [new file with mode: 0644]

index 86f83f68216a871c1b590c1d0fe2de80d44f4abf..fc1599a62349f4880b032a9334019c516092e8a2 100644 (file)
@@ -1,6 +1,6 @@
 Name:       account-manager
 Summary:    Account Manager
-Version:    0.1.21
+Version:    0.1.22
 Release:    1
 Group:      Social & Content/Other
 License:    Apache-2.0
@@ -71,6 +71,9 @@ install -m 644 %SOURCE3 %{buildroot}%{_unitdir}/accounts-service.service
 mkdir -p %{buildroot}%{upgrade_script_path}
 cp -f scripts/500.account-manager.sh %{buildroot}%{upgrade_script_path}
 
+mkdir -p %{buildroot}%{_datadir}/upgrade/vd_scripts/additional_scripts
+install -p -m 500 scripts/account-manager.sh %{buildroot}%{_datadir}/upgrade/vd_scripts/additional_scripts/account-manager.sh
+
 %post
 /sbin/ldconfig
 #if [ ! -d /opt/usr/dbspace ]
@@ -127,6 +130,7 @@ chsmack -a 'System' %{TZ_SYS_DB}/.account.db
 %license LICENSE.APLv2
 %{_bindir}/account-svcd
 %{upgrade_script_path}/500.account-manager.sh
+%{_datadir}/upgrade/vd_scripts/additional_scripts/account-manager.sh
 %attr(0644,root,root) %{_unitdir}/accounts-service.service
 %attr(0644,root,root) %{_unitdir}/delayed.target.wants/accounts-service.service
 %attr(0644,root,root) /usr/share/dbus-1/system-services/org.tizen.account.manager.service
diff --git a/scripts/account-manager.sh b/scripts/account-manager.sh
new file mode 100644 (file)
index 0000000..631064a
--- /dev/null
@@ -0,0 +1,108 @@
+#!/bin/bash
+
+source "$UPDATE_EXEC_PATH/common/util.inc"
+source "$UPDATE_EXEC_PATH/common/debug.inc"
+source "$UPDATE_EXEC_PATH/common/mig_ctl.inc"
+source "$UPDATE_EXEC_PATH/common/path_ctl.inc"
+source "$UPDATE_EXEC_PATH/common/error_handle.inc"
+
+
+function account_manager_migration() {
+
+        # Specify the path for copying the original data in Tizen 7.0.
+        local SRC_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55=$(get_old_rw_path)/dbspace
+       local SRC_PATH_USER_DB_ACCOUNT_MANAGER_55=$(get_old_rw_path)/dbspace/5001
+
+        # Specify the destination data path to be copied to Tizen 8.0
+        local DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55=$(get_rw_path)/dbspace
+       local DST_PATH_USER_DB_ACCOUNT_MANAGER_55=$(get_rw_path)/dbspace/5001
+
+        # Check if the original data of Tizen 7.0 exists.
+
+        if [ ! -e $SRC_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55 ]; then
+                log E "[$SRC_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55] DOES NOT EXIST"
+                return
+        fi
+
+       if [ ! -e $SRC_PATH_USER_DB_ACCOUNT_MANAGER_55 ]; then
+                log E "[$SRC_PATH_USER_DB_ACCOUNT_MANAGER_55] DOES NOT EXIST"
+                return
+        fi
+
+
+        if [ ! -e $(dirname $DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55) ]; then
+
+                # Create the parent directory for the data to be copied to Tizen 8.0.
+                log E "[$DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55] DOES NOT EXIST SO CREATING"
+                mkdir -p $(dirname $DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55)
+
+                # Setting permissions for the parent directory of data to be copied to Tizen 8.0
+
+                chown "owner:users" $(dirname $DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55)
+
+                # Assigning a Smack Label to the Parent Directory of the Target Data to be Copied to Tizen 8.0
+
+                chsmack -a "User::Pkg::org.tizen.account.manager" $(dirname $DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55)
+
+                # Setting execution permissions for data to be copied in Tizen 8.0
+
+                chmod 700 $(dirname $DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55)
+                log I "[$DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55] CREATED"
+        fi
+
+       if [ ! -e $(dirname $DST_PATH_USER_DB_ACCOUNT_MANAGER_55) ]; then
+
+                # Create the parent directory for the data to be copied to Tizen 8.0.
+                log E "[$DST_PATH_USER_DB_ACCOUNT_MANAGER_55] DOES NOT EXIST SO CREATING"
+                mkdir -p $(dirname $DST_PATH_USER_DB_ACCOUNT_MANAGER_55)
+
+                # Setting permissions for the parent directory of data to be copied to Tizen 8.0
+
+                chown "owner:users" $(dirname $DST_PATH_USER_DB_ACCOUNT_MANAGER_55)
+
+                # Assigning a Smack Label to the Parent Directory of the Target Data to be Copied to Tizen 8.0
+
+                chsmack -a "User::Pkg::org.tizen.account.manager" $(dirname $DST_PATH_USER_DB_ACCOUNT_MANAGER_55)
+
+                # Setting execution permissions for data to be copied in Tizen 8.0
+
+                chmod 700 $(dirname $DST_PATH_USER_DB_ACCOUNT_MANAGER_55)
+                log I "[$DST_PATH_USER_DB_ACCOUNT_MANAGER_55] CREATED"
+        fi
+
+        # Copy data from Tizen 7.0 to Tizen 8.0 RW
+        if [ ! -e $SRC_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55/.account.db  ]; then
+                log E "[$SRC_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55] DOES NOT EXIST"
+                return
+        fi
+
+        mig_copy $SRC_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55/.account.db $DST_PATH_GLOBAL_DB_ACCOUNT_MANAGER_55 || error_handler "default_data" $LINENO
+        log I "GLOBAL DB COPY SUCCESS"
+
+        if [ ! -e $SRC_PATH_USER_DB_ACCOUNT_MANAGER_55/.account.db  ]; then
+                log E "[$SRC_PATH_USER_DB_ACCOUNT_MANAGER_55] DOES NOT EXIST"
+                return
+        fi
+
+       mig_copy $SRC_PATH_USER_DB_ACCOUNT_MANAGER_55/.account.db $DST_PATH_USER_DB_ACCOUNT_MANAGER_55 || error_handler "default_data" $LINENO
+        log I "USER DB COPY SUCCESS"
+
+
+}
+
+# Trace flag check & enable
+if is_trace_enable; then
+        trace_enable
+fi
+
+
+
+# Main Function
+
+mig_init
+
+account_manager_migration
+
+mig_finish
+
+exit 0
\ No newline at end of file