update tizen source
[framework/messaging/msg-service.git] / debian / msg-service-tools.postinst
1 #!/bin/sh
2 set -e
3 # Automatically added by dh_makeshlibs
4 if [ "$1" = "configure" ]; then
5         ldconfig
6 fi
7 # End automatically added section
8
9 #. /etc/ipkg/functions
10
11 #PATH=$PATH:/usr/bin
12 #CURRENT_PATH=$PWD
13
14 #cd /usr/bin
15
16 #initDB
17 #rm /opt/dbspace/.msg_service.db*
18
19 if [ ! -f /opt/dbspace/.msg_service.db ]
20 then
21         sqlite3 /opt/dbspace/.msg_service.db "PRAGMA journal_mode = PERSIST;
22
23         CREATE TABLE MSG_ADDRESS_TABLE(ADDRESS_ID INTEGER PRIMARY KEY, ADDRESS_TYPE INTEGER, RECIPIENT_TYPE INTEGER, ADDRESS_VAL TEXT, CONTACT_ID INTEGER, DISPLAY_NAME TEXT, FIRST_NAME TEXT, LAST_NAME TEXT, IMAGE_PATH TEXT, SYNC_TIME DATETIME, UNREAD_CNT INTEGER DEFAULT 0, SMS_CNT INTEGER DEFAULT 0, MMS_CNT INTEGER DEFAULT 0, MAIN_TYPE INTEGER NOT NULL, SUB_TYPE INTEGER NOT NULL, MSG_DIRECTION INTEGER NOT NULL, MSG_TIME DATETIME, MSG_TEXT TEXT);
24         CREATE TABLE MSG_FOLDER_TABLE(FOLDER_ID INTEGER PRIMARY KEY, FOLDER_NAME TEXT NOT NULL, FOLDER_TYPE INTEGER DEFAULT 0);
25         CREATE TABLE MSG_MESSAGE_TABLE(MSG_ID INTEGER PRIMARY KEY, ADDRESS_ID INTEGER, FOLDER_ID INTEGER, REFERENCE_ID INTEGER, STORAGE_ID INTEGER NOT NULL, MAIN_TYPE INTEGER NOT NULL, SUB_TYPE INTEGER NOT NULL, DISPLAY_TIME DATETIME, DATA_SIZE INTEGER DEFAULT 0, NETWORK_STATUS INTEGER DEFAULT 0, READ_STATUS INTEGER DEFAULT 0, PROTECTED INTEGER DEFAULT 0, PRIORITY INTEGER DEFAULT 0, MSG_DIRECTION INTEGER NOT NULL, SCHEDULED_TIME DATETIME, BACKUP INTEGER DEFAULT 0, SUBJECT TEXT, MSG_DATA TEXT, THUMB_PATH TEXT, MSG_TEXT TEXT, DELIVERY_REPORT_STATUS INTEGER DEFAULT 0, DELIVERY_REPORT_TIME DATETIME, READ_REPORT_STATUS INTEGER DEFAULT 0, READ_REPORT_TIME DATETIME, ATTACHMENT_COUNT INTEGER DEFAULT 0, FOREIGN KEY(ADDRESS_ID) REFERENCES MSG_ADDRESS_TABLE(ADDRESS_ID), FOREIGN KEY(FOLDER_ID) REFERENCES MSG_FOLDER_TABLE(FOLDER_ID));
26         CREATE TABLE MSG_SIM_TABLE(MSG_ID INTEGER, SIM_ID INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));
27         CREATE TABLE MSG_PUSH_TABLE(MSG_ID INTEGER, ACTION INTEGER, CREATED INTEGER, EXPIRES INTEGER, ID TEXT, HREF TEXT, CONTENT TEXT, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));
28         CREATE TABLE MSG_CBMSG_TABLE(MSG_ID INTEGER, CB_MSG_ID INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));
29         CREATE TABLE MSG_SYNCML_TABLE(MSG_ID INTEGER, EXT_ID INTEGER NOT NULL, PINCODE INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));
30         CREATE TABLE MSG_SCHEDULED_TABLE(MSG_ID INTEGER, ALARM_ID INTEGER NOT NULL, LISTENER_FD INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));
31         CREATE TABLE MSG_SMS_SENDOPT_TABLE(MSG_ID INTEGER, DELREP_REQ INTEGER NOT NULL, KEEP_COPY INTEGER NOT NULL, REPLY_PATH INTEGER NOT NULL, FOREIGN KEY(MSG_ID) REFERENCES MSG_MESSAGE_TABLE(MSG_ID));
32         CREATE TABLE MSG_FILTER_TABLE(FILTER_ID INTEGER PRIMARY KEY, FILTER_TYPE INTEGER NOT NULL, FILTER_VALUE TEXT NOT NULL);
33         CREATE TABLE MSG_MMS_MESSAGE_TABLE(REFERENCE_ID INTEGER, TRANSACTION_ID TEXT, MESSAGE_ID TEXT, FWD_MESSAGE_ID TEXT, CONTENTS_LOCATION TEXT, FILE_PATH TEXT, FOREIGN KEY(REFERENCE_ID) REFERENCES MSG_MESSAGE_TABLE(REFERENCE_ID));
34         CREATE TABLE MSG_MMS_ATTR_TABLE(REFERENCE_ID INTEGER, VERSION INTEGER NOT NULL, DATA_TYPE INTEGER DEFAULT -1, DATE DATETIME, HIDE_ADDRESS INTEGER DEFAULT 0, ASK_DELIVERY_REPORT INTEGER DEFAULT 0, REPORT_ALLOWED INTEGER DEFAULT 0, READ_REPORT_ALLOWED_TYPE INTEGER DEFAULT 0, ASK_READ_REPLY INTEGER DEFAULT 0, READ INTEGER DEFAULT 0, READ_REPORT_SEND_STATUS     INTEGER DEFAULT 0, READ_REPORT_SENT INTEGER DEFAULT 0, PRIORITY INTEGER DEFAULT 0, KEEP_COPY INTEGER DEFAULT 0, MSG_SIZE INTEGER NOT NULL, MSG_CLASS INTEGER DEFAULT -1, EXPIRY_TIME DATETIME, CUSTOM_DELIVERY_TIME INTEGER DEFAULT 0, DELIVERY_TIME DATETIME, MSG_STATUS INTEGER DEFAULT -1, FOREIGN KEY(REFERENCE_ID) REFERENCES MSG_MESSAGE_TABLE(REFERENCE_ID));
35
36         CREATE INDEX MSG_ADDRESS_INDEX ON MSG_ADDRESS_TABLE(ADDRESS_ID);
37         CREATE INDEX MSG_FOLDER_INDEX ON MSG_FOLDER_TABLE(FOLDER_ID);
38         CREATE INDEX MSG_MESSAGE_INDEX ON MSG_MESSAGE_TABLE(MSG_ID, ADDRESS_ID, FOLDER_ID);
39
40         INSERT INTO MSG_FOLDER_TABLE VALUES (1, 'INBOX', 1);
41         INSERT INTO MSG_FOLDER_TABLE VALUES (2, 'OUTBOX', 2);
42         INSERT INTO MSG_FOLDER_TABLE VALUES (3, 'SENTBOX', 2);
43         INSERT INTO MSG_FOLDER_TABLE VALUES (4, 'DRAFT', 3);
44         INSERT INTO MSG_FOLDER_TABLE VALUES (5, 'CBMSGBOX', 1);
45
46         INSERT INTO MSG_ADDRESS_TABLE VALUES (0, 0, 0, '', 0, '', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, '');"
47 #       INSERT INTO MSG_ADDRESS_TABLE VALUES (1, 1, 1, '01030016057', 0, '', '', '', '', 0, 0, 2, 0, 1, 0, 1, 1284036008, 'Welcome to SLP world');
48
49 #       INSERT INTO MSG_MESSAGE_TABLE VALUES (1, 1, 3, 1, 1, 1, 0, 1284035928, 6, 2, 1, 0, 1, 0, 0, 0, '', '', '', 'Hello.', -1, 0, -1, 0, 0);
50 #       INSERT INTO MSG_MESSAGE_TABLE VALUES (2, 1, 1, 2, 1, 1, 0, 1284036008, 20, 6, 1, 0, 1, 1, 0, 0, '', '', '', 'Welcome to SLP world', -1, 0, -1, 0, 0);"
51 fi
52
53 ########## Setting Permission and Owner ###########
54
55 if [ ${USER} == "root" ]
56 then
57         # 1. executable
58         #chown root:root /usr/bin/msg-server
59         #chown root:root /usr/bin/msg-test-app
60
61         # 2. configuration
62         chown root:root /usr/share/msg-service/plugin.cfg
63 #       chown root:root /opt/etc/msg-service/mms_plugin.cfg
64 #       chown root:root /opt/etc/msg-service/kdb-setting.sh
65
66         # 3. database
67         chown :6011 /opt/dbspace/.msg_service.db
68         chown :6011 /opt/dbspace/.msg_service.db-journal
69
70         # 4. other files
71         chown root:root /opt/etc/msg-service/A.smi
72         chown root:root /opt/etc/msg-service/P091120_104633.jpg
73         chown root:root /opt/etc/msg-service/Temp0_2.txt
74         chown root:root /opt/etc/msg-service/Temp1_0.txt
75         chown root:root /opt/etc/msg-service/V091120_104905.3gp
76         chown root:root /opt/etc/msg-service/alert_on_call.mp3
77         chown root:root /opt/etc/msg-service/audio.amr
78         chown root:root /usr/share/media/Sherbet.wav
79 fi
80
81 # Change File Permission
82 # 1. executable
83 #chmod 700 /usr/bin/msg-server
84 #chmod 700 /usr/bin/msg-test-app
85
86 # 2. configuration
87 chmod 644 /usr/share/msg-service/plugin.cfg
88 #chmod 644 /opt/etc/msg-service/mms_plugin.cfg
89 #chmod 644 /opt/etc/msg-service/kdb-setting.sh
90
91 # 3. database
92 chmod 660 /opt/dbspace/.msg_service.db
93 chmod 660 /opt/dbspace/.msg_service.db-journal
94
95 # 4. other files
96 chmod 644 /opt/etc/msg-service/A.smi
97 chmod 644 /opt/etc/msg-service/P091120_104633.jpg
98 chmod 644 /opt/etc/msg-service/Temp0_2.txt
99 chmod 644 /opt/etc/msg-service/Temp1_0.txt
100 chmod 644 /opt/etc/msg-service/V091120_104905.3gp
101 chmod 644 /opt/etc/msg-service/alert_on_call.mp3
102 chmod 644 /opt/etc/msg-service/audio.amr
103 chmod 644 /usr/share/media/Sherbet.wav
104
105
106 ########## Setting Config Value ##########
107
108 # General Options
109 vconftool set -t bool db/msg/general/keep_copy 1
110 vconftool set -t int db/msg/general/alert_tone 0
111 vconftool set -t bool db/msg/general/auto_erase 0
112 vconftool set -t bool db/msg/general/block_msg 0
113 vconftool set -t int db/msg/general/contact_sync_time 0
114
115 # SMS Send Options
116 vconftool set -t int db/msg/sms_send/dcs 3
117 vconftool set -t int db/msg/network_mode 2
118 vconftool set -t bool db/msg/sms_send/reply_path 0
119 vconftool set -t bool db/msg/sms_send/delivery_report 0
120 vconftool set -t int db/msg/sms_send/save_storage 1
121
122 # MMS Send Options
123 vconftool set -t int db/msg/mms_send/msg_class 0
124 vconftool set -t int db/msg/mms_send/priority 1
125 vconftool set -t int db/msg/mms_send/expiry_time 0
126 vconftool set -t int db/msg/mms_send/custom_delivery 0
127 vconftool set -t bool db/msg/mms_send/sender_visibility 0
128 vconftool set -t bool db/msg/mms_send/delivery_report 1
129 vconftool set -t bool db/msg/mms_send/read_reply 1
130 vconftool set -t bool db/msg/mms_send/keep_copy 0
131 vconftool set -t bool db/msg/mms_send/body_replying 0
132 vconftool set -t bool db/msg/mms_send/hide_recipients 0
133 vconftool set -t bool db/msg/mms_send/report_allowed 1
134 vconftool set -t int db/msg/mms_send/reply_charging 0
135 vconftool set -t int db/msg/mms_send/reply_charging_deadline 0
136 vconftool set -t int db/msg/mms_send/reply_charging_size 0
137 vconftool set -t int db/msg/mms_send/delivery_time 0
138 vconftool set -t int db/msg/mms_send/creation_mode 2
139
140 # MMS Receive Options
141 vconftool set -t int db/msg/mms_recv/home_network 0
142 vconftool set -t int db/msg/mms_recv/abroad_network 0
143 vconftool set -t bool db/msg/mms_recv/read_receipt 1
144 vconftool set -t bool db/msg/mms_recv/delivery_receipt 1
145 vconftool set -t bool db/msg/mms_recv/reject_unknown 0
146 vconftool set -t bool db/msg/mms_recv/reject_advertisement 0
147
148 # MMS Receive Options
149 vconftool set -t int db/msg/mms_style/font_size 30
150 vconftool set -t bool db/msg/mms_style/font_style/bold 0
151 vconftool set -t bool db/msg/mms_style/font_style/italic 0
152 vconftool set -t bool db/msg/mms_style/font_style/underline 0
153 vconftool set -t int db/msg/mms_style/font_color/red 0
154 vconftool set -t int db/msg/mms_style/font_color/green 0
155 vconftool set -t int db/msg/mms_style/font_color/blue 0
156 vconftool set -t int db/msg/mms_style/font_color/hue 255
157 vconftool set -t int db/msg/mms_style/bg_color/red 255
158 vconftool set -t int db/msg/mms_style/bg_color/green 255
159 vconftool set -t int db/msg/mms_style/bg_color/blue 255
160 vconftool set -t int db/msg/mms_style/bg_color/hue 255
161 vconftool set -t int db/msg/mms_style/page_dur 2
162 vconftool set -t int db/msg/mms_style/page_custom_dur 0
163 vconftool set -t int db/msg/mms_style/page_dur_manual 0
164
165 # Push Msg Options
166 vconftool set -t bool db/msg/push_msg/recv_option 1
167 vconftool set -t int db/msg/push_msg/service_load 1
168
169 # CB Msg Options
170 vconftool set -t bool db/msg/cb_msg/receive 0
171 vconftool set -t bool db/msg/cb_msg/all_channel 0
172 vconftool set -t int db/msg/cb_msg/max_sim_count 0
173 vconftool set -t int db/msg/cb_msg/channel_count 0
174 vconftool set -t bool db/msg/cb_msg/language/0 0
175 vconftool set -t bool db/msg/cb_msg/language/1 0
176 vconftool set -t bool db/msg/cb_msg/language/2 0
177 vconftool set -t bool db/msg/cb_msg/language/3 0
178 vconftool set -t bool db/msg/cb_msg/language/4 0
179 vconftool set -t bool db/msg/cb_msg/language/5 0
180 vconftool set -t bool db/msg/cb_msg/language/6 0
181 vconftool set -t bool db/msg/cb_msg/language/7 0
182 vconftool set -t bool db/msg/cb_msg/language/8 0
183 vconftool set -t bool db/msg/cb_msg/language/9 0
184
185 # Voice Mail Options
186 vconftool set -t string db/msg/voice_mail/voice_mail_number "12345678"
187
188 # MMS Size Options
189 vconftool set -t int db/msg/size_opt/msg_size 300
190
191 vconftool set -t int db/badge/org.tizen.message 0
192
193 if [ ${USER} == "root" ]
194 then
195
196         # Msg Count
197         vconftool set -t int db/msg/recv_sms 0 -u 0
198         vconftool set -t int db/msg/recv_mms 0 -u 0
199 fi
200
201
202 #cd $CURRENT_PATH
203
204
205 #mkdir /opt/system/msg-service
206
207 #config "msg-service-@MACHINE@"
208