From: Lukasz Marek Date: Wed, 17 Apr 2013 12:37:57 +0000 (+0200) Subject: Custom handlers' db moved to user space. X-Git-Tag: submit/tizen_2.2/20130927.091100^2~124 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b529931c60c25812f7c4e2a59875dc9dd40198b9;p=platform%2Fframework%2Fweb%2Fwrt-commons.git Custom handlers' db moved to user space. [Issue#] N/A [Problem] N/A [Cause] N/A [Solution] Custom handlers' db moved to user space. [SCMRequest] N/A [Verification] 1. Build and install repository 2. Delete old db (rm /usr/dbspace/.wrt_custom_handlers*) 3. Apply commit to wrt-extra http://slp-info.sec.samsung.net/gerrit/#/c/184465/ 4. Install and run widget manual_tests/wrt_test_widgets/custom_handlers/custom_handlers.wgt 5. Register handlers for content and scheme (inside widget) 6. Open db /opt/usr/dbspace/.wrt_custom_handlers and check if new records apeared in tables. Change-Id: I07ce20f03846c3b82fff300810ac9ade99131cee --- diff --git a/etc/wrt_commons_create_clean_db.sh b/etc/wrt_commons_create_clean_db.sh index 710fb97..bb8d16e 100755 --- a/etc/wrt_commons_create_clean_db.sh +++ b/etc/wrt_commons_create_clean_db.sh @@ -14,47 +14,59 @@ # limitations under the License. # -for name in wrt wrt_custom_handler -do +DB_PATH=/opt/dbspace/ +DB_USER_PATH=/opt/usr/dbspace/ + +function create_db { + name=$1 + dbpath=$2 # extract smack label before removal DB_LABEL="" - if [ -f /opt/dbspace/.$name.db ] + if [ -f $dbpath.$name.db ] then - DB_LABEL=`chsmack /opt/dbspace/.$name.db | sed -r "s/.*access=\"([^\"]+)\"/\1/"` + DB_LABEL=`chsmack $dbpath.$name.db | sed -r "s/.*access=\"([^\"]+)\"/\1/"` fi - rm -f /opt/dbspace/.$name.db + rm -f $dbpath.$name.db # extract smack label before removal JOURNAL_LABEL="" - if [ -f /opt/dbspace/.$name.db-journal ] + if [ -f $dbpath.$name.db-journal ] then - JOURNAL_LABEL=`chsmack /opt/dbspace/.$name.db-journal | sed -r "s/.*access=\"([^\"]+)\"/\1/"` + JOURNAL_LABEL=`chsmack $dbpath.$name.db-journal | sed -r "s/.*access=\"([^\"]+)\"/\1/"` fi - rm -f /opt/dbspace/.$name.db-journal + rm -f $dbpath.$name.db-journal SQL="PRAGMA journal_mode = PERSIST;" - sqlite3 /opt/dbspace/.$name.db "$SQL" + sqlite3 $dbpath.$name.db "$SQL" SQL=".read /usr/share/wrt-engine/"$name"_db.sql" - sqlite3 /opt/dbspace/.$name.db "$SQL" - touch /opt/dbspace/.$name.db-journal - chown 0:6026 /opt/dbspace/.$name.db - chown 0:6026 /opt/dbspace/.$name.db-journal - chmod 660 /opt/dbspace/.$name.db - chmod 660 /opt/dbspace/.$name.db-journal + sqlite3 $dbpath.$name.db "$SQL" + touch $dbpath.$name.db-journal + chown 0:6026 $dbpath.$name.db + chown 0:6026 $dbpath.$name.db-journal + chmod 660 $dbpath.$name.db + chmod 660 $dbpath.$name.db-journal pkill -9 security-serv # restore smack label if [ -n "$DB_LABEL" ] then - chsmack -a $DB_LABEL /opt/dbspace/.$name.db + chsmack -a $DB_LABEL $dbpath.$name.db fi # restore smack label if [ -n "$JOURNAL_LABEL" ] then - chsmack -a $JOURNAL_LABEL /opt/dbspace/.$name.db-journal + chsmack -a $JOURNAL_LABEL $dbpath.$name.db-journal fi -done +} +for name in wrt +do + create_db $name $DB_PATH +done +for name in wrt_custom_handler +do + create_db $name $DB_USER_PATH +done diff --git a/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp b/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp index d6f70a8..5f26fd7 100644 --- a/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp +++ b/modules/custom_handler_dao/dao/CustomHandlerDatabase.cpp @@ -18,7 +18,7 @@ namespace CustomHandlerDB { namespace Interface { namespace { -const char* CustomHandler_DB_DATABASE = "/opt/dbspace/.wrt_custom_handler.db"; +const char* CustomHandler_DB_DATABASE = "/opt/usr/dbspace/.wrt_custom_handler.db"; DPL::DB::SqlConnection::Flag::Type CustomHandler_DB_FLAGS = DPL::DB::SqlConnection::Flag::UseLucene; } diff --git a/packaging/wrt-commons.spec b/packaging/wrt-commons.spec index 8ffb518..7a1a12c 100644 --- a/packaging/wrt-commons.spec +++ b/packaging/wrt-commons.spec @@ -123,8 +123,8 @@ fi # Set Smack label for db files chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db chsmack -a 'wrt-commons::db_wrt' /opt/dbspace/.wrt.db-journal -chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/dbspace/.wrt_custom_handler.db -chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/dbspace/.wrt_custom_handler.db-journal +chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/usr/dbspace/.wrt_custom_handler.db +chsmack -a 'wrt-commons::db_wrt_custom_handler' /opt/usr/dbspace/.wrt_custom_handler.db-journal echo "[WRT] wrt-commons postinst done ..."