2 # Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
18 DB_USER_PATH=/opt/usr/dbspace/
23 # extract smack label before removal
25 if [ -f $dbpath.$name.db ]
27 DB_LABEL=`/usr/bin/chsmack $dbpath.$name.db | sed -r "s/.*access=\"([^\"]+)\"/\1/"`
29 /bin/rm -f $dbpath.$name.db
31 # extract smack label before removal
33 if [ -f $dbpath.$name.db-journal ]
35 JOURNAL_LABEL=`/usr/bin/chsmack $dbpath.$name.db-journal | sed -r "s/.*access=\"([^\"]+)\"/\1/"`
37 /bin/rm -f $dbpath.$name.db-journal
39 SQL="PRAGMA journal_mode = PERSIST;"
40 /usr/bin/sqlite3 $dbpath.$name.db "$SQL"
41 SQL=".read /usr/share/wrt-engine/"$name"_db.sql"
42 /usr/bin/sqlite3 $dbpath.$name.db "$SQL"
43 /bin/touch $dbpath.$name.db-journal
44 /bin/chown 0:5000 $dbpath.$name.db
45 /bin/chown 0:5000 $dbpath.$name.db-journal
46 /bin/chmod 660 $dbpath.$name.db
47 /bin/chmod 660 $dbpath.$name.db-journal
49 /usr/bin/pkill -9 security-serv
54 /usr/bin/chsmack -a "$DB_LABEL" $dbpath.$name.db
58 if [ -n "$JOURNAL_LABEL" ]
60 /usr/bin/chsmack -a "$JOURNAL_LABEL" $dbpath.$name.db-journal
66 create_db $name $DB_PATH
69 for name in wrt_custom_handler wrt_i18n
71 create_db $name $DB_USER_PATH