Change location of web-provider db and clean up C APIs
[platform/framework/web/web-provider.git] / data / web_provider_reset_db.sh
1 #!/bin/sh
2 # Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
3 #
4 #    Licensed under the Flora License, Version 1.1 (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
7 #
8 #        http://floralicense.org/license/
9 #
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.
15 #
16
17 web_provider_db="/opt/usr/dbspace/.web_provider.db"
18 web_provider_sql="/usr/share/web-provider/web_provider_db.sql"
19
20 if [ -f $web_provider_db ]; then
21     echo "DB already exists."
22 else
23     echo "create web livebox DB..."
24     rm -f $web_provider_db
25     rm -f $web_provider_db-journal
26     sql="PRAGMA journal_mode = PERSIST;"
27     sqlite3 $web_provider_db "$sql"
28     sql=".read "$web_provider_sql
29     sqlite3 $web_provider_db "$sql"
30     touch $web_provider_db-journal
31     chown 0:6026 $web_provider_db
32     chown 0:6026 $web_provider_db-journal
33     chmod 660 $web_provider_db
34     chmod 660 $web_provider_db-journal
35     echo "finish creation of db."
36 fi