diff options
-rwxr-xr-x | packaging/aul.spec | 1 | ||||
-rw-r--r-- | parser/component/CMakeLists.txt | 2 | ||||
-rwxr-xr-x | parser/component/script/501.component_upgrade.sh | 65 |
3 files changed, 68 insertions, 0 deletions
diff --git a/packaging/aul.spec b/packaging/aul.spec index b15b8cc3..e9ee8a0f 100755 --- a/packaging/aul.spec +++ b/packaging/aul.spec @@ -133,6 +133,7 @@ chsmack -a 'User::Home' %{TZ_SYS_DB}/.component.db-journal %{_sysconfdir}/package-manager/parserlib/metadata/libaul-parser.so %{_sysconfdir}/package-manager/parserlib/libcomponent-based-application.so %attr(0755,root,root) %{_sysconfdir}/gumd/useradd.d/* +%attr(0755,root,root) %{_datadir}/upgrade/scripts/501.component_upgrade.sh %files test %{_bindir}/open_app diff --git a/parser/component/CMakeLists.txt b/parser/component/CMakeLists.txt index 60acbd1c..27100ff0 100644 --- a/parser/component/CMakeLists.txt +++ b/parser/component/CMakeLists.txt @@ -37,3 +37,5 @@ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/data/component.info DESTINATION ${SHARED_DIR}/parser-plugins) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/script/14_component-add.post DESTINATION ${SYSCONF_INSTALL_DIR}/gumd/useradd.d) +INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/script/501.component_upgrade.sh + DESTINATION ${SHARE_INSTALL_PREFIX}/upgrade/scripts) diff --git a/parser/component/script/501.component_upgrade.sh b/parser/component/script/501.component_upgrade.sh new file mode 100755 index 00000000..1bc73c01 --- /dev/null +++ b/parser/component/script/501.component_upgrade.sh @@ -0,0 +1,65 @@ +#!/bin/sh + +#------------------------------------------# +# component db upgrade (4.0 -> 5.5) # +#------------------------------------------# + +# Macro +PATH=/bin:/usr/bin:/sbin:/usr/sbin + +GLOBAL_USER_DB=/opt/dbspace/.component.db +DEFAULT_USER_DB=/opt/dbspace/user/5001/.component.db + +# Create DB +sqlite3 $GLOBAL_USER_DB << EOF +PRAGMA journal_mode = PERSIST; + +CREATE TABLE IF NOT EXISTS component_info ( + package TEXT NOT NULL, + app_id TEXT NOT NULL, + component_id TEXT NOT NULL, + component_type TEXT NOT NULL, + component_launch_mode TEXT NOT NULL, + component_main TEXT NOT NULL, + component_icon_display NOT NULL, + component_taskmanage NOT NULL, + PRIMARY KEY (component_id) +); + +CREATE TABLE IF NOT EXISTS component_localized_info ( + component_id TEXT NOT NULL, + component_locale TEXT NOT NULL DEFAULT 'No Locale', + component_label TEXT, + component_icon TEXT, + PRIMARY KEY (component_id, component_locale) + FOREIGN KEY (component_id) + REFERENCES component_info(component_id) ON DELETE CASCADE +); + +EOF + +# Create DB Path for default user +mkdir -p /opt/dbspace/user/5001 +chmod 770 /opt/dbspace/user/5001 +chown owner:system_share /opt/dbspace/user/5001 +chsmack -a User::Home /opt/dbspace/user +chsmack -a User::Home /opt/dbspace/user/5001 + +# Copy DB +cp $GLOBAL_USER_DB $DEFAULT_USER_DB + +# Adjust Permission +chmod 664 $GLOBAL_USER_DB +chmod 664 $GLOBAL_USER_DB-journal + +chown owner:users $GLOBAL_USER_DB +chown owner:users $GLOBAL_USER_DB-journal + +chsmack -a User::Home $GLOBAL_USER_DB +chsmack -a User::Home $GLOBAL_USER_DB-journal + +chmod 666 $DEFAULT_USER_DB +chmod 666 $DEFAULT_USER_DB-journal + +chsmack -a User::Home $DEFAULT_USER_DB +chsmack -a User::Home $DEFAULT_USER_DB-journal |