[Title] Default user agent string is changed for Tizen2.0
[profile/ivi/org.tizen.browser.git] / debian / org.tizen.browser.postinst
1 #!/bin/sh
2 if [ ${USER} == "root" ]
3 then
4         # Change file owner
5         chown -R 5000:5000 /opt/apps/org.tizen.browser/data
6 fi
7
8 ##### Bookmark ######
9 if [ ! -f /opt/dbspace/.internet_bookmark.db ];
10 then
11         sqlite3 /opt/dbspace/.internet_bookmark.db 'PRAGMA journal_mode=PERSIST;
12         CREATE TABLE bookmarks(id INTEGER PRIMARY KEY AUTOINCREMENT, type INTEGER, parent INTEGER, address, title, creationdate, sequence INTEGER, updatedate, visitdate, editable INTEGER, accesscount INTEGER, favicon BLOB, favicon_length INTEGER, favicon_w INTEGER, favicon_h INTEGER);
13         create index idx_bookmarks_on_parent_type on bookmarks(parent, type);
14
15         insert into bookmarks (type, parent, title, creationdate, editable, sequence, accesscount) values(1, 0, "Bookmarks", DATETIME("now"),  0, 1, 0);'
16 fi
17
18 ##### History ######
19 if [ ! -f /opt/dbspace/.browser-history.db ];
20 then
21         sqlite3 /opt/dbspace/.browser-history.db 'PRAGMA journal_mode=PERSIST;
22         CREATE TABLE history(id INTEGER PRIMARY KEY AUTOINCREMENT, address, title, counter INTEGER, visitdate DATETIME, favicon BLOB, favicon_length INTEGER, favicon_w INTEGER, favicon_h INTEGER);'
23 fi
24
25 ##### Geolocation ######
26 if [ ! -f /opt/apps/org.tizen.browser/data/db/.browser-geolocation.db ];
27 then
28         sqlite3 /opt/apps/org.tizen.browser/data/db/.browser-geolocation.db 'PRAGMA journal_mode=PERSIST;
29         create table geolocation(id integer primary key autoincrement, address, accept INTEGER,updatedate DATETIME);'
30 fi
31
32 ##### Password ######
33 if [ ! -f /opt/apps/org.tizen.browser/data/db/.browser-credential.db ];
34 then
35         sqlite3 /opt/apps/org.tizen.browser/data/db/.browser-credential.db 'PRAGMA journal_mode=PERSIST;
36         create table passwords(id integer primary key autoincrement, address, login, password)'
37 fi
38
39 #### USER AGENTS #####
40 #initDB
41 #rm /opt/apps/org.tizen.browser/data/db/.browser.db
42 # create db
43 #FILE = /opt/apps/org.tizen.browser/data/db/.browser.db
44 if [ ! -f /opt/apps/org.tizen.browser/data/db/.browser.db ];
45 then
46         sqlite3 /opt/apps/org.tizen.browser/data/db/.browser.db 'PRAGMA journal_mode=PERSIST;
47         create table user_agents(name primary key, value)'
48         # mobile 
49         sqlite3 /opt/apps/org.tizen.browser/data/db/.browser.db 'PRAGMA journal_mode=PERSIST;
50         insert into user_agents values("Galaxy S", "Mozilla/5.0 (Linux; U; Android 2.3.7; en-gb; GT-I9000 Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
51         insert into user_agents values("Galaxy S II", "Mozilla/5.0 (Linux; U; Android 2.3.5; en-gb; GT-I9100 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
52         insert into user_agents values("Galaxy S III", "Mozilla/5.0 (Linux; U; Android 4.0.3; en-gb; GT-I9300 Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
53         insert into user_agents values("SLP Galaxy", "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; GT-I9500 Build/GINGERBREAD) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
54         insert into user_agents values("Tizen", "Mozilla/5.0 (Linux; U; Tizen 1.0; en-us) AppleWebKit/534.46 (KHTML, like Gecko) Mobile Tizen Browser/1.0");
55         insert into user_agents values("Galaxy Nexus", "Mozilla/5.0 (Linux; U; Android 4.0.3; en-us; Galaxy Nexus Build/IML74K) AppleWebKit/535.7 (KHTML, like Gecko) Mobile Safari/535.7");
56         insert into user_agents values("Samsung", "Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-I9200/1.0; U; Linux/SLP/2.0; ko-kr) AppleWebKit/534.4 (KHTML, like Gecko) Dolfin/2.0 Mobile");
57         insert into user_agents values("Samsung Dolfin", "SAMSUNG-GT-S8500/S8500XXJD2 SHP/VPP/R5 Dolfin/2.0 Nextreaming SMM-MMS/1.2.0 profile/MIDP-2.1 configuration/CLDC-1.1");
58         insert into user_agents values("Apple iPhone 3", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_1_3 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7E18 Safari/528.16");
59         insert into user_agents values("Apple iPhone 4", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5");
60         insert into user_agents values("Apple iOS 5", "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A405 Safari/7534.48.3");
61         insert into user_agents values("Android 2.3 (Nexus One)", "Mozilla/5.0 (Linux; U; Android 2.3.4; en-us; Nexus One Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1");
62         insert into user_agents values("Opera Mobi", "Opera/9.80 (Windows NT 6.1; U; Edition IBIS; en) Presto/2.6.30 Version/10.63");
63         insert into user_agents values("Samsung Bada", "Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-S8500/1.0; U; Bada/1.0; en-us) AppleWebKit/533.1 (KHTML, like Gecko) Dolfin/2.0 Mobile WVGA SMM-MMS/1.2.0 OPN-B");
64         insert into user_agents values("Orange TV", "Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3 OrangeAppliTV/2.3.9");
65         insert into user_agents values("Chrome Browser for android", "Mozilla/5.0 (Linux; U; Android 4.0.1; ko-kr; Galaxy Nexus Build/ITL41F) AppleWebKit/535.7 (KHTML, like Gecko) CrMo/16.0.912.75 Mobile Safari/535.7");
66         insert into user_agents values("MANGO(Nokia 800C)", "Mozilla/5.0 (compatible; MSIE 9.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0; Nokia; 800C)");
67         insert into user_agents values("System user agent", "");
68         insert into user_agents values("Samsung Bada 2.0", "Mozilla/5.0 (SAMSUNG; SAMSUNG-GT-S8500/1.0; U; Bada/2.0; en-us) AppleWebKit/534.20 (KHTML, like Gecko) Mobile WVGA SMM-MMS/1.2.0 OPN-B Dolfin/3.0")'
69
70         # desktop
71         sqlite3 /opt/apps/org.tizen.browser/data/db/.browser.db 'PRAGMA journal_mode=PERSIST;
72         insert into user_agents values("Samsung Desktop", "Mozilla/5.0 (U; Linux/SLP/2.0; ko-kr) AppleWebKit/533.1 (KHTML, like Gecko)");
73         insert into user_agents values("Firefox 5", "Mozilla/5.0 (Windows NT 6.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1");
74         insert into user_agents values("Firefox 5 Fennec(Mobile)", "Mozilla/5.0 (Android; Linux armv7l; rv:5.0) Gecko/20110615 Firefox/5.0 Fennec/5.0");
75         insert into user_agents values("Safari 5.0", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_2) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7");
76         insert into user_agents values("Google Chrome 18.0", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/535.16 (KHTML, like Gecko) Chrome/18.0.1003.1 Safari/535.16");
77         insert into user_agents values("Internet Explorer 9", "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)");
78         insert into user_agents values("Galaxy Tab 10.1", "Mozilla/5.0 (Linux; U; Android 3.0.1; en-us; GT-P7100 Build/HRI83) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13");
79         insert into user_agents values("iPad 2", "Mozilla/5.0 (iPad; U; CPU OS 4_3_5 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8L1 Safari/6533.18.5")'
80 fi
81
82 #init cookies DB
83 #rm /optpps/org.tizen.browser/data/db/dbspace/.browser-cookies.db
84 # create cookies db
85 #FILE = /opt/apps/org.tizen.browser/data/db/.browser-cookies.db
86
87 if [ ! -f /opt/apps/org.tizen.browser/data/db/.browser-cookies.db ];
88 then
89         sqlite3 /opt/apps/org.tizen.browser/data/db/.browser-cookies.db 'CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER);'
90         #test cookie
91         #sqlite3 /opt/apps/org.tizen.browser/data/db/.browser-cookies.db 'INSERT INTO moz_cookies values(NULL, "cookies_name_test", "cookies_value_test", "www.cookies_test.com", "cookies_path_test", 2011, NULL, 1, 0);'
92 fi
93
94 # Change db file owner & permission
95 if [ ${USER} == "root" ]
96 then
97         #chown root:root /opt/apps/org.tizen.browser/data/db
98         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser.db
99         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser.db-journal
100         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser-cookies.db
101         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser-cookies.db-journal
102         chown :6002 /opt/dbspace/.browser-history.db
103         chown :6002 /opt/dbspace/.browser-history.db-journal
104         chown :6002 /opt/dbspace/.internet_bookmark.db
105         chown :6002 /opt/dbspace/.internet_bookmark.db-journal
106         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser-credential.db
107         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser-credential.db-journal
108         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser-geolocation.db
109         chown :6002 /opt/apps/org.tizen.browser/data/db/.browser-geolocation.db-journal
110         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser.db
111         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser.db-journal
112         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser-cookies.db
113         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser-cookies.db-journal
114         chmod 666 /opt/dbspace/.browser-history.db
115         chmod 666 /opt/dbspace/.browser-history.db-journal
116         chmod 660 /opt/dbspace/.internet_bookmark.db
117         chmod 660 /opt/dbspace/.internet_bookmark.db-journal
118         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser-credential.db
119         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser-credential.db-journal
120         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser-geolocation.db
121         chmod 660 /opt/apps/org.tizen.browser/data/db/.browser-geolocation.db-journal
122 fi
123
124 ##################################################
125 # set default vconf values
126 ##################################################
127 if [ ${USER} == "root" ]
128 then
129         vconftool set -t string db/browser/browser_user_agent "System user agent" -g 6514 -f
130         vconftool set -t string db/browser/custom_user_agent "" -g 6514 -f
131 else
132         vconftool set -t string db/browser/browser_user_agent "System user agent" -f
133         vconftool set -t string db/browser/custom_user_agent "" -f
134 fi