[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
# limitations under the License.
#
# 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=""
# extract smack label before removal
DB_LABEL=""
- if [ -f /opt/dbspace/.$name.db ]
+ if [ -f $dbpath.$name.db ]
- DB_LABEL=`chsmack /opt/dbspace/.$name.db | sed -r "s/.*access=\"([^\"]+)\"/\1/"`
+ DB_LABEL=`chsmack $dbpath.$name.db | sed -r "s/.*access=\"([^\"]+)\"/\1/"`
- rm -f /opt/dbspace/.$name.db
# extract smack label before removal
JOURNAL_LABEL=""
# extract smack label before removal
JOURNAL_LABEL=""
- if [ -f /opt/dbspace/.$name.db-journal ]
+ if [ -f $dbpath.$name.db-journal ]
- 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/"`
- rm -f /opt/dbspace/.$name.db-journal
+ rm -f $dbpath.$name.db-journal
SQL="PRAGMA journal_mode = PERSIST;"
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"
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
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
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
+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
namespace CustomHandlerDB {
namespace Interface {
namespace {
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;
}
DPL::DB::SqlConnection::Flag::Type CustomHandler_DB_FLAGS =
DPL::DB::SqlConnection::Flag::UseLucene;
}
# 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
# 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 ..."
echo "[WRT] wrt-commons postinst done ..."