File: postinst

package info (click to toggle)
mailreader 2.3.36-3.1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,632 kB
  • ctags: 131
  • sloc: perl: 3,496; sh: 405; makefile: 68
file content (308 lines) | stat: -rw-r--r-- 13,867 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
#! /bin/sh
# postinst script for mailreader
#
# see: dh_installdeb(1)

set -e
PACKAGE=mailreader

SVRCONF=/etc/${PACKAGE}/server.cfg.dpkg-new
MAINCONF=/etc/${PACKAGE}/main.cfg.dpkg-new

touch /var/log/${PACKAGE}.log
chown www-data /var/log/${PACKAGE}.log
chgrp www-data /var/log/${PACKAGE}.log
chmod 0600 /var/log/${PACKAGE}.log
chmod 0700 /var/lib/${PACKAGE}/smtp
chmod 0700 /var/lib/${PACKAGE}/temp

case "$1" in
    configure)
	if [ ! -s /etc/${PACKAGE}/server.cfg ]; then
	    echo StartDate=`date +%Y%m%d` >>/var/lib/${PACKAGE}/ads/debian/ad.cfg
	    echo EndDate=`date +%Y%m%d -d 'next year'` >>/var/lib/${PACKAGE}/ads/debian/ad.cfg
	fi

	. /usr/share/debconf/confmodule

	db_get ${PACKAGE}/deflang
	if [ "$RET" = "Japanese" ]; then
	    cp /usr/lib/cgi-bin/${PACKAGE}/compose.cgi-japan /usr/lib/cgi-bin/${PACKAGE}/compose.cgi
	    cp /usr/lib/cgi-bin/${PACKAGE}/network.cgi-japan /usr/lib/cgi-bin/${PACKAGE}/network.cgi
	    cp /usr/lib/cgi-bin/${PACKAGE}/nph-mr.cgi-japan /usr/lib/cgi-bin/${PACKAGE}/nph-mr.cgi
	else
	    cp /usr/lib/cgi-bin/${PACKAGE}/compose.cgi-standard /usr/lib/cgi-bin/${PACKAGE}/compose.cgi
	    cp /usr/lib/cgi-bin/${PACKAGE}/network.cgi-standard /usr/lib/cgi-bin/${PACKAGE}/network.cgi
	    cp /usr/lib/cgi-bin/${PACKAGE}/nph-mr.cgi-standard /usr/lib/cgi-bin/${PACKAGE}/nph-mr.cgi
	fi

# begin server.cfg

	echo WWWPath=/var/www/ >${SVRCONF}
	echo HTMLPath=/usr/lib/${PACKAGE}/html/ >>${SVRCONF}
	echo DefaultHTMLFile=index.html >>${SVRCONF}
	echo VirtualGfxPath=/${PACKAGE}/gfx/ >>${SVRCONF}
	echo TempPath=/var/lib/${PACKAGE}/temp/ >>${SVRCONF}
	echo CachePath=/var/lib/${PACKAGE}/cache/ >>${SVRCONF}
	echo CacheHashDepth=2 >>${SVRCONF}
	echo SMTPPath=/var/lib/${PACKAGE}/smtp/ >>${SVRCONF}
	echo LogPath=/var/log/ >>${SVRCONF}
	echo AdvertisementPath=/var/lib/${PACKAGE}/ads/ >>${SVRCONF}
	db_get ${PACKAGE}/deflang
	if [ "$RET" = "Russian Koi8-R" ]; then
		echo Language=russiankoi8 >>${SVRCONF}
	else
		echo Language=`echo $RET |tr [:upper:] [:lower:]` >>${SVRCONF}
	fi
	db_get ${PACKAGE}/feedback
	echo FeedbackEmail=$RET >>${SVRCONF}
	echo AddressBook= >>${SVRCONF}
	echo CreateFakePasswords=2 >>${SVRCONF}
	db_get ${PACKAGE}/smtpserver
	echo SMTPServers=$RET >>${SVRCONF}
	echo FullHTTPHeaders=1 >>${SVRCONF}
	db_get ${PACKAGE}/pop3
	echo DefaultMailserver=$RET >>${SVRCONF}
	db_get ${PACKAGE}/allowpop3
	echo AllowedMailservers=$RET >>${SVRCONF}
	db_get ${PACKAGE}/allowclients
	echo AllowedHosts=$RET >>${SVRCONF}
	echo OutsideConnections=1 >>${SVRCONF}
	echo MaxLoginTime=2 >>${SVRCONF}
	db_get ${PACKAGE}/ads
	if $RET; then
		echo NoAdvertisements=0 >>${SVRCONF}
	else
		echo NoAdvertisements=1 >>${SVRCONF}
	fi
	db_get ${PACKAGE}/afterout
	if [ ! -z "$RET" ]; then
		echo AfterLogout=$RET >>${SVRCONF}
	fi
	echo NoReverseLookup=0 >>server.cfg >>${SVRCONF}
# end of server.cfg

# begin main.cfg

	echo ModifyNotAllowed=ModifyNotAllowed, MaxRecipients, DefaultSave, >${MAINCONF}
	echo +HTMLPath, TempPath, RemoteHost, CachePath, CreateFakePasswords, SMTPServers, >>${MAINCONF}
	echo +OverrideHELO, FullHTTPHeaders, ScriptName, LinkQueryString, UserFile, >>${MAINCONF}
	echo +CacheHashDepth, DefaultMailserver, AllowedHosts, AllowedMailservers, >>${MAINCONF}
	echo +PublicMailreaderURL, POP3SPort, SecurePOP3Allowed, POP3Port, MessageAdvertisement, >>${MAINCONF}
	echo +VirtualGfxPath, LogPath, AdvertisementPath, FeedbackEmail, OverrideMailFrom, POP3SPort, >>${MAINCONF}
	echo +OutsideConnections, MaxLoginTime >>${MAINCONF}
	echo HeadersOnlyLimit=30000 >>${MAINCONF}
	echo MessageLimit=500 >>${MAINCONF}
	echo POP3Port=110 >>${MAINCONF}
	echo Timeout=30 >>${MAINCONF}
	echo SecurePOP3Allowed=1 >>${MAINCONF}
	echo POP3SPort=995 >>${MAINCONF}
	echo SecurePOP3=1 >>${MAINCONF}
	echo AutoMailCheck=5 >>${MAINCONF}
	echo MailreaderEmail=kim@holviala.com >>${MAINCONF}
	db_get ${PACKAGE}/feedback
	echo FeedbackEmail=$RET >>${MAINCONF}
	echo Buttons=both >>${MAINCONF}
	echo ButtonRowLocation=both >>${MAINCONF}
	echo 'QuoteChar=>' >>${MAINCONF}
	echo MessageAdvertisement==================================================================== >>${MAINCONF}
	echo +EASY and FREE access to your email anywhere: http://Mailreader.com/ >>${MAINCONF}
	echo +Powered by Debian: http://www.debian.org >>${MAINCONF}
	echo +=================================================================== >>${MAINCONF}
	echo MaxRecipients=50 >>${MAINCONF}
	echo HideInCompose=replyto, bcc, newsgroups, from >>${MAINCONF}
	echo WordListFile=english.words >>${MAINCONF}
	echo DefaultHTMLFile=index.html >>${MAINCONF}
	echo DefaultSave=AdditionalSave, AddressBook, Signature, RealName, RealEmail, Language, >>${MAINCONF}
	echo +NewMessagesFirst, Buttons, ButtonRowLocation, ReadMessages, RepliedMessages, >>${MAINCONF}
	echo +ShowAllHeaders, ViewSource, NoInlineImages, HideInCompose, VCard, >>${MAINCONF}
	echo +AttachVCard, AlwaysConfirm, NoAutoSave, NoQuotedReply, NoMessageAdvertisement, >>${MAINCONF}
	echo +CustomWords, LoginCount, LastLoginTime, NoOnMouseOver, AdImpressions, AdClicks, >>${MAINCONF}
	echo +AddressBookAfterSave, Draft, NoFastLogout, PreferPlainText, FastLogin, SecurePOP3 >>${MAINCONF}
	db_get ${PACKAGE}/deflang
	if [ "$RET" = "Russian Koi8-R" ]; then
		echo 'LanguageOptions=+<OPTION VALUE="russiankoi8">Russian Koi8-R' >>${MAINCONF}
	else
		echo 'LanguageOptions=+<OPTION VALUE="'`echo $RET |tr [:upper:] [:lower:]`'">'$RET >>${MAINCONF}
	fi
	if [ "$RET" != "Armenian" ]; then
		echo '+<OPTION VALUE="armenian">Armenian' >>${MAINCONF}
	fi
	if [ "$RET" != "Danish" ]; then
		echo '+<OPTION VALUE="danish">Danish' >>${MAINCONF}
	fi
	if [ "$RET" != "Dutch" ]; then
		echo '+<OPTION VALUE="dutch">Dutch' >>${MAINCONF}
	fi
	if [ "$RET" != "English" ]; then
		echo '+<OPTION VALUE="english">English' >>${MAINCONF}
	fi
	if [ "$RET" != "Finnish" ]; then
		echo '+<OPTION VALUE="finnish">Finnish' >>${MAINCONF}
	fi
	if [ "$RET" != "French" ]; then
		echo '+<OPTION VALUE="french">French' >>${MAINCONF}
	fi
	if [ "$RET" != "German" ]; then
		echo '+<OPTION VALUE="german">German' >>${MAINCONF}
	fi
	if [ "$RET" != "Italian" ]; then
		echo '+<OPTION VALUE="italian">Italian' >>${MAINCONF}
	fi
	if [ "$RET" != "Japanese" ]; then
		echo '+<OPTION VALUE="japanese">Japanese' >>${MAINCONF}
	fi
	if [ "$RET" != "Lithuanian" ]; then
		echo '+<OPTION VALUE="lithuanian">Lithuanian' >>${MAINCONF}
	fi
	if [ "$RET" != "Norwegian" ]; then
		echo '+<OPTION VALUE="norwegian">Norwegian' >>${MAINCONF}
	fi
	if [ "$RET" != "Polish" ]; then
		echo '+<OPTION VALUE="polish">Polish' >>${MAINCONF}
	fi
	if [ "$RET" != "Russian" ]; then
		echo '+<OPTION VALUE="russian">Russian' >>${MAINCONF}
	fi
	if [ "$RET" != "Russian Koi8-R" ]; then
		echo '+<OPTION VALUE="russiankoi8">Russian Koi8-R' >>${MAINCONF}
	fi
	if [ "$RET" != "Spanish" ]; then
		echo '+<OPTION VALUE="spanish">Spanish' >>${MAINCONF}
	fi
	if [ "$RET" != "Swedish" ]; then
		echo '+<OPTION VALUE="swedish">Swedish' >>${MAINCONF}
	fi
	echo TableWidth=590 >>${MAINCONF}
	echo 'BigTextStart=<BIG>' >>${MAINCONF}
	echo 'BigTextEnd=</BIG>' >>${MAINCONF}
	echo 'SmallTextStart=<SMALL>' >>${MAINCONF}
	echo 'SmallTextEnd=</SMALL>' >>${MAINCONF}
	echo "TButtonStart=<TT><STRONG><NOBR>" >>${MAINCONF}
	echo 'TButtonEnd=</NOBR></STRONG></TT>' >>${MAINCONF}
	echo 'ReplyRowStart=<EM>' >>${MAINCONF}
	echo 'ReplyRowEnd=</EM>' >>${MAINCONF}
	echo 'MessageLinkStart=<STRONG>' >>${MAINCONF}
	echo 'MessageLinkEnd=</STRONG>' >>${MAINCONF}
	echo 'ComposeFieldWidth=50' >>${MAINCONF}
	echo ComposeBodyColumns=74 >>${MAINCONF}
	echo ComposeBodyRows=16 >>${MAINCONF}
	echo 'ImageTinyLogo=<IMG SRC="{VirtualGfxPath}tinylogo.gif" ALT="Mailreader.com" ALIGN=left WIDTH=100 HEIGHT=65>' >>${MAINCONF}
	echo 'ImageVCardLogo=<IMG SRC="{VirtualGfxPath}vcardlogo.gif" ALT="vCard logo" BORDER=0 WIDTH=70 HEIGHT=70>' >>${MAINCONF}
	echo 'GeneralButtonSize=BORDER=0 WIDTH=40 HEIGHT=40' >>${MAINCONF}
	echo 'ImageUndeleteButton=<IMG SRC="{VirtualGfxPath}undelete_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageCheckmailButton=<IMG SRC="{VirtualGfxPath}checkmail_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageAddressesButton=<IMG SRC="{VirtualGfxPath}addresses_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageOptionsButton=<IMG SRC="{VirtualGfxPath}options_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageKeyEditorButton=<IMG SRC="{VirtualGfxPath}options_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageInboxButton=<IMG SRC="{VirtualGfxPath}inbox_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageLogoutButton=<IMG SRC="{VirtualGfxPath}logout_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageDeleteButton=<IMG SRC="{VirtualGfxPath}delete_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageDeleteSelectedButton=<IMG SRC="{VirtualGfxPath}delete_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageComposeButton=<IMG SRC="{VirtualGfxPath}compose_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageForwardButton=<IMG SRC="{VirtualGfxPath}forward_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageRedirectButton=<IMG SRC="{VirtualGfxPath}redirect_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageReplyButton=<IMG SRC="{VirtualGfxPath}reply_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageReplyAllButton=<IMG SRC="{VirtualGfxPath}replyall_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageSaveDraftButton=<IMG SRC="{VirtualGfxPath}save_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageShowDraftButton=<IMG SRC="{VirtualGfxPath}draft_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageDeleteDraftButton=<IMG SRC="{VirtualGfxPath}delete_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageNextButton=<IMG SRC="{VirtualGfxPath}next_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImagePreviousButton=<IMG SRC="{VirtualGfxPath}previous_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageReadFirstButton=<IMG SRC="{VirtualGfxPath}next_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageSaveButton=<IMG SRC="{VirtualGfxPath}save_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageSpellcheckButton=<IMG SRC="{VirtualGfxPath}checkspelling_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageCancelButton=<IMG SRC="{VirtualGfxPath}cancel_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageSendButton=<IMG SRC="{VirtualGfxPath}ok_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageOKButton=<IMG SRC="{VirtualGfxPath}ok_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImagePreviewButton=<IMG SRC="{VirtualGfxPath}preview_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'ImageHelpButton=<IMG SRC="{VirtualGfxPath}help_0.gif" {GeneralButtonSize}>' >>${MAINCONF}
	echo 'BgrColor=#000099' >>${MAINCONF}
	echo 'TextColor=#FFFFFF' >>${MAINCONF}
	echo 'LinkColor=#ADD8E6' >>${MAINCONF}
	echo 'ALinkColor=#FF8080' >>${MAINCONF}
	echo 'AltTextColor=#FFFF80' >>${MAINCONF}
	echo 'HdrBgrColor=#6699CC' >>${MAINCONF}
	echo 'HdrTextColor=#FFFF80' >>${MAINCONF}
	echo 'CommonStyleSheet=<STYLE TYPE="text/css"><!--' >>${MAINCONF}
	echo '+INPUT {font-family: monospace; font-size: 10pt}' >>${MAINCONF}
	echo '+SELECT {font-family: monospace; font-size: 10pt}' >>${MAINCONF}
	echo '+OPTION {font-family: monospace; font-size: 10pt}' >>${MAINCONF}
	echo '+TEXTAREA {font-family: monospace; font-size: 10pt}' >>${MAINCONF}
	echo '+--></STYLE>' >>${MAINCONF}
	echo "CommonJavaScript=window.onload=preload;" >>${MAINCONF}
	echo "+window.onerror=null;" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+function preload() {" >>${MAINCONF}
	echo "+	if (!document.images) return;" >>${MAINCONF}
	echo "+	firstbtn = ''" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+	for (i = 0; i < document.images.length; i++) {" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+		src = document.images[i].src;" >>${MAINCONF}
	echo "+		if (src.indexOf('_0.gif') == -1) continue;" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+		if (!firstbtn) {" >>${MAINCONF}
	echo "+			firstbtn = src;" >>${MAINCONF}
	echo "+			firstbtn = firstbtn.substring(firstbtn.lastIndexOf('/'), firstbtn.length - 1);" >>${MAINCONF}
	echo "+		}" >>${MAINCONF}
	echo "+		else if (src.indexOf(firstbtn) != -1) break;" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+		src = src.substring(0, src.length - 5) + '1.gif';" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+		eval('image' + i + ' = new Image(40, 40)');" >>${MAINCONF}
	echo "+		eval('image' + i + '.src = src');" >>${MAINCONF}
	echo "+	}" >>${MAINCONF}
	echo "+}" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+function zap(img, what) {" >>${MAINCONF}
	echo "+	if (!document.images) return;" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+	old = document.images[img].src;" >>${MAINCONF}
	echo "+	document.images[img].src = old.substring(0, old.lastIndexOf('_') + 1) + what + '.gif';" >>${MAINCONF}
	echo "+}" >>${MAINCONF}
	echo "+" >>${MAINCONF}
	echo "+function openPopUp(url) {" >>${MAINCONF}
	echo "+	popUpWin = window.open(url, 'popUpWin', 'status=yes,scrollbars=yes,resizable=yes,width=500,height=350');" >>${MAINCONF}
	echo "+	if (popUpWin.focus) popUpWin.focus();" >>${MAINCONF}
	echo "+}" >>${MAINCONF}
	db_get mailreader/confoverride
	if [ -s /etc/${PACKAGE}/server.cfg ]; then
		if $RET; then
			mv /etc/${PACKAGE}/server.cfg /etc/${PACKAGE}/server.cfg.dpkg-old
		fi
	else
		mv ${SVRCONF} /etc/${PACKAGE}/server.cfg
	fi
	if [ -s /etc/${PACKAGE}/main.cfg ]; then
		if $RET; then
			mv /etc/${PACKAGE}/main.cfg /etc/${PACKAGE}/main.cfg.dpkg-old
		fi
	else
		mv ${MAINCONF} /etc/${PACKAGE}/main.cfg
	fi
	if $RET; then
		mv ${SVRCONF} /etc/${PACKAGE}/server.cfg
		mv ${MAINCONF} /etc/${PACKAGE}/main.cfg
	fi
	db_reset mailreader/confoverride
    ;;

    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