File: postinst

package info (click to toggle)
postaci 1.1.3-4
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,176 kB
  • ctags: 1,382
  • sloc: php: 6,083; sql: 1,035; sh: 488; makefile: 47; pascal: 24
file content (573 lines) | stat: -rw-r--r-- 21,505 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
#! /bin/sh 
# postinst  script  for postaci 
# Written  by Murat  Demirten <demirten@bilmuh.ege.edu.tr>
# see: dh_installdeb(1)

set -e

# summary of how this script can be called:
#        * <postinst> `configure' <most-recently-configured-version>
#        * <old-postinst> `abort-upgrade' <new version>
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
#          <new-version>
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
#          <failed-install-package> <version> `removing'
#          <conflicting-package> <version>
# for details, see /usr/doc/packaging-manual/
#
# quoting from the policy:
#     Any necessary prompting should almost always be confined to the
#     post-installation script, and should be protected with a conditional
#     so that unnecessary prompting doesn't happen if a package's
#     installation fails and the `postinst' is called with `abort-upgrade',
#     `abort-remove' or `abort-deconfigure'.

# We will use debconf
. /usr/share/debconf/confmodule
db_version 2.0
db_capb multiselect


case "$1" in
    configure)

db_title "Postaci 1.1.3 Setup"

db_input "high" postaci/server || true
db_go
db_get "postaci/server"
server="$RET"

db_input "high" postaci/protocol || true
db_go
db_get "postaci/protocol"
protocol="$RET"

cyrus="false"
courier="false"
if [ "$protocol" = "IMAP" ]; then
db_input "high" postaci/cyrus || true
db_go
db_get "postaci/cyrus"
cyrus="$RET"

db_input "high" postaci/courier || true
db_go
db_get "postaci/courier"
courier="$RET"
fi

db_input "high" postaci/qmail || true
db_go
db_get "postaci/qmail"
qmail="$RET"

db_input "high" postaci/dbserver || true
db_go
db_get "postaci/dbserver"
dbserver="$RET"

db_input "high" smtpserver || true
db_go
db_get "postaci/smtpserver"
smtpserver="$RET"

db_input "high" postaci/dbtype || true
db_go
db_get "postaci/dbtype"
dbtype="$RET"

## Already have a database
check="false"

## MySQL start
if [ "$dbtype" = "MySQL" ]; then
dbtype="mysql"
db_input "high" postaci/grant || true
db_go

db_input "high" postaci/database || true
db_go
db_get "postaci/database"
database="$RET"

if [ "$dbserver" = "localhost" ]; then
    if [ -d /var/lib/mysql/$database ]; then
    check="true"
    fi
db_input "high" postaci/mysql-password || true
db_go
db_get "postaci/mysql-password"
mysql_pass="$RET"
db_reset "postaci/mysql-password"
fi

db_input "high" postaci/user || true
db_go
db_get "postaci/user"
dbuser="$RET"
db_reset "postaci/user"

db_input "high" postaci/userpass || true
db_go
db_get "postaci/userpass"
userpass="$RET"
db_reset "postaci/userpass"
fi
## MySQL end

## PostgreSQL start
if [ "$dbtype" = "PostgreSQL" ]; then
dbtype="postgresql"

db_input "high" postaci/database || true
db_go
db_get "postaci/database"
database="$RET"
if [ "$dbserver" = "localhost" ]; then
    if [ -d /var/lib/postgres/data/base/$database ]; then
    check="true"
    fi
fi
db_input "high" postaci/pguser || true
db_go
db_get "postaci/pguser"
dbuser="$RET"
db_reset "postaci/pguser"

db_input "high" postaci/pguserpass || true
db_go
db_get "postaci/pguserpass"
userpass="$RET"
db_reset "postaci/pguserpass"
fi
## PostgreSQL end

db_input "high" postaci/domain || true
db_go
db_get "postaci/domain"
domain="$RET"

db_input "high" postaci/langs || true
db_go
db_get "postaci/langs"
langs="$RET"

if echo "$langs" | grep -e "," >/dev/null 
then 
db_subst postaci/deflang langs $langs
db_input "high" postaci/deflang || true
db_go
db_get "postaci/deflang"
deflang="$RET"
else
deflang="$langs"
fi

db_input "critical" postaci/critical || true
db_go
    
echo ""
echo "You must read /usr/share/doc/postaci/README.Debian"


# Now is the configuration time :)
##################################

DIR="/var/www/postaci"

if [ "$protocol" = "IMAP" ]; then
protocol="imap"
port="143"
fi
if [ "$protocol" = "POP3" ]; then
protocol="pop3"
port="110"
fi


turkce="false"
english="false"
francais="false"
deutsch="false"
polski="false"
espanol="false"
portugues="false"
dutch="false"
norsk="false"
italiano="false"
if echo "$langs" | grep -e "turkce" >/dev/null
then
turkce="true"
fi
if echo "$langs" | grep -e "english" >/dev/null
then
english="true"
fi
if echo "$langs" | grep -e "francais" >/dev/null
then
francais="true"
fi
if echo "$langs" | grep -e "deutsch" >/dev/null
then
deutsch="true"
fi
if echo "$langs" | grep -e "polski" >/dev/null
then
polski="true"
fi
if echo "$langs" | grep -e "espanol" >/dev/null
then
espanol="true"
fi
if echo "$langs" | grep -e "portugues" >/dev/null
then
portugues="true"
fi
if echo "$langs" | grep -e "dutch" >/dev/null
then
dutch="true"
fi
if echo "$langs" | grep -e "norsk" >/dev/null
then
norsk="true"
fi
if echo "$langs" | grep -e "italiano" >/dev/null
then
italiano="true"
fi


# Create postaci database
## Our main if structure

if [ "$dbserver" = "localhost" ]; then

# Create the tblDomains.sql

echo "INSERT INTO tblDomains VALUES(1,'$domain');" > tblDomains.sql
mv -f tblDomains.sql $DIR/queries/
chown root.www-data $DIR/queries/tblDomains.sql

# Setup for MySQL database

if [ "$dbtype" = "mysql" ]; then

if [ "$check" = "false" ]; then
    /usr/bin/mysqladmin -u root --password="$mysql_pass" create $database > /dev/null 2>&1

    # Create the tables

    /usr/bin/mysql -u root --password="$mysql_pass" $database < $DIR/queries/postaci-mysql-1.1.sql >/dev/null 2>&1

    /usr/bin/mysql -u root --password="$mysql_pass" $database < $DIR/queries/tblDomains.sql >/dev/null 2>&1
fi

# Access level to postaci database configuring
# And change the $dbuser's password

/usr/bin/mysql -u root --password="$mysql_pass" -f -e "grant usage on $database.* to $dbuser@localhost IDENTIFIED BY '$userpass'" >/dev/null 2>&1

/usr/bin/mysql -u root --password="$mysql_pass" -f -e "grant select,insert,delete,update on $database.* to $dbuser@localhost" >/dev/null 2>&1

# Reload the database
/usr/bin/mysqladmin -u root --password="$mysql_pass" reload >/dev/null 2>&1

fi
## End of MySQL config
## PostgreSQL config start
if [ "$dbtype" = "postgresql" ]; then
    if [ -f /etc/postgresql/postmaster.init ]; then
    /bin/sed -e 's#\# PGALLOWTCPIP=no#PGALLOWTCPIP=yes#; s#\# PGALLOWTCPIP=yes#PGALLOWTCPIP=yes#' /etc/postgresql/postmaster.init >/etc/postgresql/postmaster.init.bak
    cp /etc/postgresql/postmaster.init /etc/postgresql/postmaster.init.postaci.bak > /dev/null 2>&1
    if grep "PGALLOWTCPIP=yes" /etc/postgresql/postmaster.init.bak >/dev/null 2>&1; then
    mv -f /etc/postgresql/postmaster.init.bak /etc/postgresql/postmaster.init >/dev/null 2>&1;
    /etc/init.d/postgresql restart >/dev/null 2>&1
    fi
    echo "Configuring PostgreSQL database"
    /bin/sed -e "s#@database@#$database#" $DIR/queries/postaci-pgsql-1.1.in.sql > $DIR/queries/postaci-pgsql-1.1.sql
    rm $DIR/queries/postaci-pgsql-1.1.in.sql
    chown postgres $DIR/queries/postaci-pgsql-1.1.sql
    ##    su - postgres -c "echo -e \"$userpass\n$userpass\" | /usr/bin/createuser -A -d -q -P $dbuser >/dev/null 2>&1"
QUERY="insert into pg_shadow \
      (usename, usesysid, usecreatedb, usetrace, usesuper, usecatupd,passwd) \
      values \
      ('$dbuser', 46, 't', 't', 't','t','$userpass')"

    su postgres -c "/usr/bin/psql -c \"$QUERY\" template1 >/dev/null 2>&1"
    if [ "$check" = "false" ]; then
	su postgres -c "/usr/bin/psql -q -f $DIR/queries/postaci-pgsql-1.1.sql template1 >/dev/null 2>&1"
	su postgres -c "/usr/bin/psql -q -f $DIR/queries/tblDomains.sql $database >/dev/null 2>&1"

    fi
    chown root.www-data $DIR/queries/postaci-pgsql-1.1.sql
    else
    echo "      **** WARNING ****  "
    echo "You stated your using PostgreSQL as a database and"
    echo "that it is local yet the install program cannot seem"
    echo "to find the config files for it."
    echo ""
    echo "Please press <ENTER> to continue..."
    read q
    fi
fi
fi 
## end of if dbserver = localhost

# Attachment
if [ -d /var/www/postaci/attachment ]; then
already=true
else
mkdir /var/www/postaci/attachment
    mkdir /var/www/postaci/attachment/send
    mkdir /var/www/postaci/attachment/store
fi
# Lets create the includes/global.inc

TMPFILE=`mktemp /tmp/global-inc.XXXXXX` || exit 1

echo "<?" >> $TMPFILE 2>&1
echo "/*" >> $TMPFILE 2>&1
echo "   File name         : global.inc" >> $TMPFILE 2>&1
echo "   Version           : 1.1.3" >> $TMPFILE 2>&1
echo "   Last Modified By  : Umut Gokbayrak" >> $TMPFILE 2>&1
echo "   e-mail            : umut@trlinux.com" >> $TMPFILE 2>&1
echo "   Purpose           : Global configuration File for Postaci Webmail v1.1.3" >> $TMPFILE 2>&1
echo "   Last modified     : 7 Nov 2000" >> $TMPFILE 2>&1
echo "*/" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 1." >> $TMPFILE 2>&1
echo "  // you should select the default language. version 1.1.3 defaults to English" >> $TMPFILE 2>&1
echo "  // Possible values : english, portugues, dutch, deutsch, italiano, turkce
" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$default_lang = \"$deflang\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 2." >> $TMPFILE 2>&1
echo "  // Select the database engine. Possible values are postgresql, mysql, msql, sybase, mssql." >> $TMPFILE 2>&1
echo "  // You can find the default sql queries in queries directory for mysql, postgresql and mssql" >> $TMPFILE 2>&1
echo "  // MS SQL support is under test please report any errors/improvements to" >> $TMPFILE 2>&1
echo "  // \"Umut Gokbayrak\" <umut@trlinux.com>" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$database_type = \"$dbtype\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 3." >> $TMPFILE 2>&1
echo "  // Specify the hostname where database is located. It may be an IP number, hostname or dns name" >> $TMPFILE 2>&1
echo "  // You should grant usage to the webmail server (IP) and database user the select, insert, delete," >> $TMPFILE 2>&1
echo "  // update permissions in order to install Postaci if the database server is a remote one." >> $TMPFILE 2>&1
echo "  // See INSTALL file for details. If Postaci is on the database server no need to change this." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$database_host = \"$dbserver\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 4. The database name, username and password." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$database_user = \"$dbuser\";" >> $TMPFILE 2>&1
echo "  \$database_user_pass = \"$userpass\";" >> $TMPFILE 2>&1
echo "  \$database_name = \"$database\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 5." >> $TMPFILE 2>&1
echo "  // You should select which protocol to use. Postaci supports both IMAP and POP3 mailboxes." >> $TMPFILE 2>&1
echo "  // Possible values : imap, pop3" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$default_protocol = \"$protocol\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 6." >> $TMPFILE 2>&1
echo "  // The POP3/IMAP servername, IP or DNS name. If Postaci is on the POP3/IMAP server, no need to change this" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$default_host = \"$server\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 7." >> $TMPFILE 2>&1
echo "  // Default port for IMAP access is 143 and it is 110 for POP3. If yours is different simply" >> $TMPFILE 2>&1
echo "  // change this value. If you are not sure leave as default." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$default_port = \"$port\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 8." >> $TMPFILE 2>&1
echo "  // SMTP host information. Postaci can use another relay server for sending mail. If \$smtp_host is" >> $TMPFILE 2>&1
echo "  // left as default value (localhost) things will go slightly faster. If you want to use another SMTP" >> $TMPFILE 2>&1
echo "  // server for sending e-mail you can use the IP, hostname or DNS name here." >> $TMPFILE 2>&1
echo "  // If a remote server is defined here, Postaci will try to connect to the server via SMTP port and" >> $TMPFILE 2>&1
echo "  // try to deliver the mail. This is work in progress, so please report any success or failure." >> $TMPFILE 2>&1
echo "  // SMTP servers normally reside on port 25. So you normally don' t need to change \$smtp port value." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$smtp_host = \"$smtpserver\";" >> $TMPFILE 2>&1
echo "  \$smtp_port = \"25\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 9." >> $TMPFILE 2>&1
echo "  // \$attach_directory is the place where Postaci uploads the attachments to be sent for temporary storage." >> $TMPFILE 2>&1
echo "  // DO NOT FORGET THE TAILING SLASH!!!, YOU REALLY NEED TO CHANGE THIS." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$attach_directory = \"/var/www/postaci/attachment/send/\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 10." >> $TMPFILE 2>&1
echo "  // postaci_directory is where the Postaci installation resides on your directory structure." >> $TMPFILE 2>&1
echo "  // This varible is really important. If you do not set it you will get an empty screen." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$postaci_directory = \"/var/www/postaci/\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 11." >> $TMPFILE 2>&1
echo "  // Although Cyrus IMAP has some slight differences, Postaci seems to work with all IMAP servers." >> $TMPFILE 2>&1
echo "  // In case you need it set this value to true and please report any incompatibilities." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$cyrus_imap_server = $cyrus;" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 12." >> $TMPFILE 2>&1
echo "  // If you are using POP3 protocol, you should have a non-web accessable directory for" >> $TMPFILE 2>&1
echo "  // storing attachments. This directory' s permissions should be 600 and the owner should be nobody" >> $TMPFILE 2>&1
echo "  // (the user that runs the httpd). Although you don' t use POP3 this directory should lead to an" >> $TMPFILE 2>&1
echo "  // existing directory." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$pop3_attach_dir = \"/var/www/postaci/attachment/store/\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 13." >> $TMPFILE 2>&1
echo "  // You set the title here." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$title = \"Postaci Webmail 1.1.3\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 14." >> $TMPFILE 2>&1
echo "  // Seperator is the value used for limiting the number of messages to be shown at each page." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$seperator = 15;" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 15." >> $TMPFILE 2>&1
echo "  // Operating system. As from version 1.1.1, Postaci both supports Unix/Linux/BSD and Windows systems." >> $TMPFILE 2>&1
echo "  // You can select you operating system here." >> $TMPFILE 2>&1
echo "  // Possible values : windows, unix" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$operating_system = \"unix\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 16." >> $TMPFILE 2>&1
echo "  // This is the error value for PHP configuration. If you think you have found a bug or want to" >> $TMPFILE 2>&1
echo "  // contact the author, comment the following line with two slashes and e-mail the error/warning messages to" >> $TMPFILE 2>&1
echo "  // \"Umut Gokbayrak <umut@trlinux.com>\"" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  error_reporting(32);" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 17." >> $TMPFILE 2>&1
echo "  // Please enter your TEMP directory here. This directory is used for temprarily storing session files." >> $TMPFILE 2>&1
echo "  // Windows port of PHP doesn't handle TEMP directories by itself so Windows users need to specify it here." >> $TMPFILE 2>&1
echo "  // It can be any directory with appropriate permissions. Just uncomment it (delete two slashes) and assing" >> $TMPFILE 2>&1
echo "  // the correct value." >> $TMPFILE 2>&1
echo "  // WINDOWS USERS NEED THIS." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // \$temp_directory = \"c:\\\temp\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 18." >> $TMPFILE 2>&1
echo "  // If you want to remove that sponsored by... banner simply change this value to true." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$show_sponsor = false;" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 19." >> $TMPFILE 2>&1
echo "  // Qmail users which store accounts and messages in databases require special login format. In order to avoid" >> $TMPFILE 2>&1
echo "  // this imcompatibility simply change this value to true." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$qmail_support = $qmail;" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 20." >> $TMPFILE 2>&1
echo "  // You can specify a footer text for every message outgoing from the server." >> $TMPFILE 2>&1
echo "  // This field is optinal. If you need a new line in the text, use \\n for the purpose." >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$footer_message = \"---------------------------------------\\nThis message was sent by Postaci Webmail. See www.trlinux.com for details.\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 21." >> $TMPFILE 2>&1
echo "  // To cope with courier-imap personal folders" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$courier_imap_support = $courier;" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // The following only are considered if courier-imap support is on" >> $TMPFILE 2>&1
echo "  // If php imap supports NAMESPACE server extension (RFC2342) this" >> $TMPFILE 2>&1
echo "  // could be configured automatically." >> $TMPFILE 2>&1
echo "  // DO NOT FORGET THE TRAILING PERIOD" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$personal_namespace = \"INBOX.\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  // 22." >> $TMPFILE 2>&1
echo "  // Decide which language selections to show in the main page." >> $TMPFILE 2>&1
echo "  // If any language is set to true a button will appear" >> $TMPFILE 2>&1
echo "  // on the intro screen which will let you use Postaci using that language settings." >> $TMPFILE 2>&1
echo "  // Possible values : true and false" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$turkce_support     = $turkce;" >> $TMPFILE 2>&1
echo "  \$english_support    = $english;" >> $TMPFILE 2>&1
echo "  \$francais_support   = $francais;" >> $TMPFILE 2>&1
echo "  \$deutsch_support    = $deutsch;" >> $TMPFILE 2>&1
echo "  \$polski_support     = $polski;" >> $TMPFILE 2>&1
echo "  \$espanol_support    = $espanol;" >> $TMPFILE 2>&1
echo "  \$portugues_support  = $portugues;" >> $TMPFILE 2>&1
echo "  \$dutch_support      = $dutch;" >> $TMPFILE 2>&1
echo "  \$norsk_support      = $norsk;" >> $TMPFILE 2>&1
echo "  \$italiano_support   = $italiano;" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "/**************************************************************/" >> $TMPFILE 2>&1
echo "/*          No Need to change anything below.                 */" >> $TMPFILE 2>&1
echo "/**************************************************************/" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  if (\$operating_system == \"windows\") {" >> $TMPFILE 2>&1
echo "    session_save_path(\$temp_directory);" >> $TMPFILE 2>&1
echo "  }" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  session_start();" >> $TMPFILE 2>&1
echo "  \$to_folder = \"Sent Items\";" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  if (trim(\$l) != \"\" && trim(\$l) != '\$lang_choice') {" >> $TMPFILE 2>&1
echo "    \$lang_choice = \$l;" >> $TMPFILE 2>&1
echo "  } else {" >> $TMPFILE 2>&1
echo "    if (\$lang_choice == \"\") {" >> $TMPFILE 2>&1
echo "      \$lang_choice = \$default_lang;" >> $TMPFILE 2>&1
echo "    }" >> $TMPFILE 2>&1
echo "  }" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  switch (\$lang_choice) {" >> $TMPFILE 2>&1
echo "    case \"portugues\":" >> $TMPFILE 2>&1
echo "    case \"dutch\":" >> $TMPFILE 2>&1
echo "    case \"deutsch\":" >> $TMPFILE 2>&1
echo "    case \"italiano\":" >> $TMPFILE 2>&1
echo "    case \"francais\":" >> $TMPFILE 2>&1
echo "    case \"norsk\":" >> $TMPFILE 2>&1
echo "    case \"turkce\":" >> $TMPFILE 2>&1
echo "    case \"espanol\":" >> $TMPFILE 2>&1
echo "    case \"polski\":" >> $TMPFILE 2>&1
echo "    case \"english\":" >> $TMPFILE 2>&1
echo "      include(\"\$postaci_directory\" . \"lang/\" . \"\$lang_choice\" . \".inc\");" >> $TMPFILE 2>&1
echo "      break;" >> $TMPFILE 2>&1
echo "    default:" >> $TMPFILE 2>&1
echo "      die(\"<center><font color='red'><p><b>Invalid language selection</b></p></font></conter>\");" >> $TMPFILE 2>&1
echo "  }" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  include(\"\$postaci_directory\" . \"classes/phpDB.inc\");" >> $TMPFILE 2>&1
echo "" >> $TMPFILE 2>&1
echo "  \$db = new phpDB();" >> $TMPFILE 2>&1
echo "  \$db->pconnect(\"\$database_host\", \"\$database_user\", \"\$database_user_pass\", \"\$database_name\") or die (\"<center><font color='red'><p><b>\$text75</b></p></font></center>\");" >> $TMPFILE 2>&1
echo "?>" >> $TMPFILE 2>&1

mv -f $TMPFILE "$DIR/includes/global.inc" > /dev/null 2>&1
chmod 640 $DIR/includes/global.inc
## includes/global.inc is prepared

chown -R root.www-data /var/www/postaci
chmod 660 "$DIR/includes/global.inc"
chmod -R 700 /var/www/postaci/attachment
chown -R www-data.www-data /var/www/postaci/attachment

db_stop
exit 0

   ;;

   abort-upgrade|abort-remove|abort-deconfigure)

   ;;

   *)
        echo "postinst called with unknown argument \`$1'" >&2
	exit 0
   ;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

exit 0