diff options
author | Krishna Kant Jaju <krishna.jaju@samsung.com> | 2024-04-08 16:01:33 +0530 |
---|---|---|
committer | Krishna Kant Jaju <krishna.jaju@samsung.com> | 2024-04-09 08:56:37 +0530 |
commit | f853095c0dc5afd88e20e5f4060d8c464091cbd0 (patch) | |
tree | a551769e2994e0ce3629607af873c556f6a2db74 | |
parent | f1d69264b56b5f4801a25978ff77f0ba4f8794b2 (diff) | |
download | account-manager-accepted/tizen_unified_x.tar.gz account-manager-accepted/tizen_unified_x.tar.bz2 account-manager-accepted/tizen_unified_x.zip |
Add OS Upgrade script for Tizen 7.0->8.0accepted/tizen/unified/x/asan/20240625.092731accepted/tizen/unified/x/20240425.051135accepted/tizen/unified/dev/20240620.003430accepted/tizen/unified/20240424.063520accepted/tizen_unified_x_asanaccepted/tizen_unified_xaccepted/tizen_unified_devaccepted/tizen_unified
Change-Id: I0aeab21a035c36a14552b02e2391c6d30d437300
Signed-off-by: Krishna Kant Jaju <krishna.jaju@samsung.com>
-rw-r--r-- | packaging/account-manager.spec | 6 | ||||
-rw-r--r-- | scripts/account-manager.sh | 108 |
2 files changed, 113 insertions, 1 deletions
diff --git a/packaging/account-manager.spec b/packaging/account-manager.spec index 86f83f6..fc1599a 100644 --- a/packaging/account-manager.spec +++ b/packaging/account-manager.spec @@ -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 index 0000000..631064a --- /dev/null +++ b/scripts/account-manager.sh @@ -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 |