-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
indimail-access.spec.in
836 lines (766 loc) · 30.8 KB
/
indimail-access.spec.in
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
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
#
#
# $Id: indimail.spec.in,v 1.42 2020-06-02 22:38:20+05:30 Cprogrammer Exp mbhangui $
#
# vim: wrap ic
%undefine _missing_build_ids_terminate_build
%global _unpackaged_files_terminate_build 1
%if %{defined _project}
# define if building on openSUSE build service
%global build_on_obs 1
%global reconf_fetchmail 0
%global reconf_courierimap 0
%global build_cflags "-DOBS_BUILD %{build_cflags}"
%else
%define _project local
%global build_on_obs 0
%global reconf_fetchmail 0
%global reconf_courierimap 0
%global _hardened_build 1
%endif
#global nodebug 1
%if %{defined nodebug}
%global debug_package %{nil}
%endif
%global _prefix @prefix@
%global indimaildir @indimaildir@
%global sysconfdir @sysconfdir@
%global libexecdir @libexecdir@
%global shareddir @prefix@/share/indimail
%global logdir @logdir@
%global servicedir @servicedir@
%global mandir @mandir@
%global defaultDomain @defaultDomain@
%global courier_version @courier_version@
%global fetchmail_version @fetchmail_version@
%global url https://github.com/mbhangui/indimail-virtualdomains
%global nodksignatures 0
%global qcount 5
%global qbase %{indimaildir}/queue
# Packages which do not use autosetup or setup macro
# in the prep section have a problem in enabling debuginfo.
# This isn't documented clearly anywhere. A workaround is
# to define buildsubdir
%if %{undefined nodebug}
%global buildsubdir %{name}-%{version}
%endif
%if 0%{?fedora_version} > 30 || 0%{?centos_version} > 700 || 0%{?rhel_version} > 700 || 0%{?centos_ver} > 7 || 0%{?almalinux_version} > 700 || 0%{?rocky_version} > 700 || 0%{?fedora} > 30 || 0%{?rhel} > 7 || %{defined mgaversion} || %{defined amzn} || %{defined openEuler} || ( 0%{?sle_version} >= 150400 && 0%{?is_opensuse} )
%global pythondir %{python3_sitelib}
%else
%global pythondir %(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
%endif
%if %build_on_obs == 1
%global packager Manvendra Bhangui <@email@>
%endif
Summary: POP3, IMAP Fetchmail Services for IndiMail
Name: indimail-access
Version: @version@
Release: @release@%{?dist}
%if %build_on_obs == 1
License: GPL-3.0+
%else
License: GPLv3
%endif
%if %{undefined suse_version} && %{undefined sles_version}
Group: Applications/Mail
%else
Group: Productivity/Networking/Email/Servers
%endif
Source1: http:https://downloads.sourceforge.net/indimail/courier-imap-%{courier_version}.tar.gz
Source2: http:https://downloads.sourceforge.net/indimail/fetchmail-%{fetchmail_version}.tar.gz
Source3: http:https://downloads.sourceforge.net/indimail/%{name}-rpmlintrc
%if 0%{?suse_version} >= 1120
Source4: http:https://downloads.sourceforge.net/indimail/%{name}-permissions.easy
Source5: http:https://downloads.sourceforge.net/indimail/%{name}-permissions.secure
Source6: http:https://downloads.sourceforge.net/indimail/%{name}-permissions.paranoid
%endif
URL: https://github.com/mbhangui/indimail-virtualdomains
AutoReqProv: Yes
Requires: indimail-mta > 2.6
BuildRequires: openssl-devel rpm gcc gcc-c++ make coreutils grep
BuildRequires: glibc glibc-devel openssl procps binutils
BuildRequires: gzip autoconf automake libtool pkgconfig
BuildRequires: sed findutils procps
BuildRequires: xz bison flex
BuildRequires: gettext-devel
%if 0%{?fedora_version} > 30 || 0%{?centos_version} > 700 || 0%{?rhel_version} > 700 || 0%{?centos_ver} > 7 || 0%{?almalinux_version} > 700 || 0%{?rocky_version} > 700 || 0%{?fedora} > 30 || 0%{?rhel} > 7 || %{defined mgaversion} || %{defined amzn} || %{defined openEuler} || ( 0%{?sle_version} >= 150400 && 0%{?is_opensuse} )
BuildRequires: python3 python3-devel
%else
BuildRequires: python python-devel
%endif
BuildRequires: libgcrypt-devel gdbm-devel libidn2-devel pcre2-devel pam-devel
BuildRequires: perl
%if %{defined fedora_version}
BuildRequires: perl-generators
BuildRequires: glibc-all-langpacks
%endif
Requires: user(qmaill)
Requires: group(nofiles)
%if %build_on_obs == 0
Requires(pre): shadow-utils
Requires(postun): shadow-utils
%endif
%if 0%{?suse_version} >= 1120
Requires: permissions
%endif
################################# OBS ###############################
%if %build_on_obs == 1
%if 0%{?suse_version}
BuildRequires: -post-build-checks
#!BuildIgnore: post-build-checks
#!BuildIgnore: brp-check-suse
%endif
%endif
################################# OBS ###############################
Requires: procps /usr/bin/awk /usr/bin/which
Requires: sed findutils pkgconfig
Requires: coreutils grep /bin/sh glibc openssl
Requires: /usr/bin/hostname
Conflicts: indimail < 3.2
%description
indimail-access package provides IMAP, POP3 and fetchmail
retrieval for IndiMail
IMAP/POP3 protocol is provided by Courier Imap.
Mail retrieval is provided by fetchmail.
IndiMail provides ability for a single domain to have users
across multiple hosts (even across different geographical
locations) and tools to manage virtual domains.
For more details visit %{url}
%prep
%{__mkdir_p} %{_builddir}/%{name}-%{version}
cd %{_builddir}/%{name}-%{version}
for i in fetchmail-%{fetchmail_version} courier-imap-%{courier_version}
do
(
if [ -d $i ] ; then
%{__rm} -rf $i
fi
if [ -f $HOME/rpmbuild/SOURCES/$i.tar.bz2 ] ; then
%{__bzip2} -d -c $HOME/rpmbuild/SOURCES/$i.tar.bz2 | tar xf -
elif [ -f $HOME/rpmbuild/SOURCES/$i.tar.xz ] ; then
xz -d -c $HOME/rpmbuild/SOURCES/$i.tar.xz |tar xf -
elif [ -f $HOME/rpmbuild/SOURCES/$i.tar.gz ] ; then
gunzip -c $HOME/rpmbuild/SOURCES/$i.tar.gz | tar xf -
else
echo "No Source Archive for $i"
exit 1
fi
)
done
%build
cd %{_builddir}/%{name}-%{version}
(
echo "---------------- INFORMATION ------------------------"
echo target %_target
echo target_alias %_target_alias
echo target_cpu %_target_cpu
echo target_os %_target_os
echo target_vendor %_target_vendor
%if 0%{?fedora_version} > 30 || 0%{?centos_version} > 700 || 0%{?rhel_version} > 700 || 0%{?centos_ver} > 7 || 0%{?almalinux_version} > 700 || 0%{?rocky_version} > 700 || 0%{?fedora} > 30 || 0%{?rhel} > 7 || %{defined mgaversion} || %{defined amzn} || %{defined openEuler} || ( 0%{?sle_version} >= 150400 && 0%{?is_opensuse} )
echo pythondir %{python3_sitelib}
%else
echo pythondir %{pythondir}
%endif
echo Project %{_project}
echo Building %{name}-%{version}-%{release} Build %{_build} OS %{_os} lib=%{_lib} libdir=%{_libdir}
echo "------------------------------------------------------"
) > %{name}-rpm.info
(
echo "NAME=%{name}"
echo "Description=\"IndiMail Access Package\""
echo "ACCESS_version=%{version}-%{release}"
echo "ID=%{name}"
echo "HOME_URL=\"https://github.com/mbhangui/indimail-virtualdomains\""
echo "PACKAGE_BUGREPORT=\"'@email@'\""
) > %{name}-release
#### courier-imap ######################
if [ -d courier-imap-%{courier_version} ] ; then
cd courier-imap-%{courier_version}
if [ %{reconf_courierimap} -eq 1 ] ; then
echo "reconfiguring..."
%{__mkdir_p} m4
aclocal -I m4
autoreconf -fiv
%{__cp} libs/unicode/depcomp .
fi
if [ -f /etc/fedora-release ] ; then
export CFLAGS="${CFLAGS} -Wno-implicit-function-declaration"
fi
%configure --prefix=%{_prefix} --libexecdir=%{libexecdir} --bindir=%{_prefix}/bin \
--mandir=%{mandir} --sysconfdir=%{sysconfdir} --libdir=%{_libdir} \
--datarootdir=%{shareddir} --with-certsdir=%{sysconfdir}/certs \
--with-mailer=%{_prefix}/bin/sendmail --disable-root-check --with-redhat \
--without-userdb --without-authcustom --without-authchangepwdir \
--without-authgeneric --with-authshadow --with-authpam --without-authpwd \
--enable-syslog=1
cd ..
fi
#### fetchmail ######################
if [ -d fetchmail-%{fetchmail_version} ] ; then
cd fetchmail-%{fetchmail_version}
if [ %{reconf_fetchmail} -eq 1 ] ; then
echo "reconfiguring..."
%{__mkdir_p} m4
aclocal -I m4
autoreconf -fiv
fi
%configure --prefix=%{_prefix} --libexecdir=%{libexecdir} --sysconfdir=%{sysconfdir} \
--datarootdir=%{shareddir} --mandir=%{mandir} \
--enable-indimail --with-ssl
cd ..
fi
%install
cd %{_builddir}/%{name}-%{version}
for i in fetchmail-%{fetchmail_version} courier-imap-%{courier_version}
do
if [ -d $i ] ; then
cd $i
%{__make} -s %{?_smp_mflags}
%if %{defined nodebug}
%{__make} -s %{?_smp_mflags} DESTDIR=%{buildroot} install-strip
%else
%{__make} -s %{?_smp_mflags} DESTDIR=%{buildroot} install
%endif
cd ..
fi
done
%if ( ( %{defined fedora_version} && 0%{?fedora_version} <= 30 ) || ( %{defined fedora_ver} && 0%{?fedora_ver} <= 30 ) )
echo "Removing pyc for fedora"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%if ( ( %{defined centos_version} && 0%{?centos_version} <= 700 ) || ( %{defined centos_ver} && 0%{?centos_ver} <= 7) )
echo "Removing pyc for centos"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%if ( ( %{defined rhel_version} && 0%{?rhel_version} <= 700 ) || ( %{defined rhel} && 0%{?rhel} <= 7) )
echo "Removing pyc for rhel"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%if ( %{defined almalinux_version} && 0%{?almalinux_version} <= 700 )
echo "Removing pyc for almalinux"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%if ( %{defined rocky_version} && 0%{?rocky_version} <= 700 )
echo "Removing pyc for rocky"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%if ( %{defined scientificlinux_version} && 0%{?scientificlinux_version} <= 700 )
echo "Removing pyc for scientificlinux"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%if ( 0%{?sle_version} < 150400 && 0%{?is_opensuse} )
echo "Removing pyc for opensuse version 150400"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%if %{defined suse_version} && 0%{?suse_version} <= 150400 && !0%{?is_opensuse}
echo "Removing pyc for SLE version 15"
%{__rm} -f %{buildroot}%{pythondir}/fetchmailconf.py
%endif
%{__mkdir_p} %{buildroot}%{sysconfdir}
install -m 0644 %{name}-rpm.info %{buildroot}%{sysconfdir}/%{name}-rpm.info
install -m 0644 %{name}-release %{buildroot}%{sysconfdir}/%{name}-release
%{__rm} -f %{name}-rpm.info %{name}-release
%{__rm} -f %{name}-rpm.info
%if 0%{?suse_version} >= 1120
%{__mkdir_p} %{buildroot}%{_sysconfdir}/permissions.d/
install -m 644 %{S:4} %{buildroot}%{_sysconfdir}/permissions.d/%{name}-permissions
install -m 644 %{S:5} %{buildroot}%{_sysconfdir}/permissions.d/%{name}-permissions.secure
%endif
%{__rm} -f %{buildroot}%{_libdir}/libcourier-unicode.la
%{__rm} -f %{buildroot}%{_libdir}/libcourier-unicode.a
%{__rm} -f %{buildroot}%{_libdir}/libcourier-unicode.so
%{__rm} -f %{buildroot}%{_prefix}/share/aclocal/courier-unicode.m4
%{__rm} -f %{buildroot}%{_prefix}/share/aclocal/courier-unicode-version.m4
%{__rm} -rf %{buildroot}%{_prefix}/include
%{__rm} -rf %{buildroot}%{mandir}/man3
# Compress the man pages
# Create these files so that %%ghost does not complain
%{__mkdir_p} %{buildroot}%{sysconfdir}/tcp
for i in tcp.imap tcp.imap.cdb tcp.pop3 tcp.pop3.cdb
do
if [ ! -f %{buildroot}%{sysconfdir}/tcp/$i ] ; then
touch %{buildroot}%{sysconfdir}/tcp/$i
fi
done
%if %{undefined suse_version} && %{undefined sles_version}
%{__mkdir_p} %{buildroot}%{logdir}
for i in imapd.143 imapd-ssl.993 \
pop3d.110 pop3d-ssl.995
do
%{__mkdir_p} %{buildroot}%{logdir}/$i
touch %{buildroot}%{logdir}/$i/current
done
%{__mkdir_p} %{buildroot}%{logdir}/fetchmail
touch %{buildroot}%{logdir}/fetchmail/current
touch %{buildroot}%{sysconfdir}/fetchmailrc
#%%find_lang fetchmail
%endif
%if %{undefined nodebug}
/bin/chmod -R 0755 %{buildroot}%{_prefix}/bin %{buildroot}%{_prefix}/sbin \
%{buildroot}%{libexecdir}
ln -sf %{_builddir}/%{name}-%{version}/debugsourcefiles.list %{_builddir}/debugsourcefiles.list
%endif
%files
%defattr(-, root, root,-)
#
# Directories
#
# opensuse requres ghost files to be present
%if %{undefined suse_version} && %{undefined sles_version}
%ghost %dir %attr(0755,qmaill,nofiles) %{logdir}
%ghost %dir %attr(0755,qmaill,nofiles) %{logdir}/*
%ghost %attr(-,qmaill,nofiles) %{logdir}/*/*
%endif
%if "%{mandir}" != "/usr/share/man"
%dir %attr(755,root,root) %{mandir}
%dir %attr(755,root,root) %{mandir}/man1
%dir %attr(755,root,root) %{mandir}/man7
%dir %attr(755,root,root) %{mandir}/man8
%endif
%attr(444,root,root) %{sysconfdir}/%{name}-release
%attr(444,root,root) %{sysconfdir}/%{name}-rpm.info
%dir %attr(755,root,root) %{shareddir}/locale
%ghost %config(noreplace,missingok) %{sysconfdir}/fetchmailrc
%ghost %config(noreplace,missingok) %{sysconfdir}/tcp/tcp.imap
%ghost %config(noreplace,missingok) %{sysconfdir}/tcp/tcp.pop3
#
# These files will get removed during uninstallation
#
%ghost %attr(0644,indimail,indimail) %{sysconfdir}/tcp/tcp.imap.cdb
%ghost %attr(0644,indimail,indimail) %{sysconfdir}/tcp/tcp.pop3.cdb
#
%attr(600,root,root) %config(noreplace) %{sysconfdir}/pop3d-ssl.dist
%attr(600,root,root) %config(noreplace) %{sysconfdir}/imapd-ssl.dist
%attr(600,root,root) %config(noreplace) %{sysconfdir}/pop3d.cnf
%attr(600,root,root) %config(noreplace) %{sysconfdir}/imapd.cnf
%attr(600,root,root) %config(noreplace) %{sysconfdir}/pop3d.dist
%attr(600,root,root) %config(noreplace) %{sysconfdir}/imapd.dist
%attr(600,root,root) %config(noreplace) %{sysconfdir}/authmodulelist
%attr(644,root,root) %config(noreplace) %{sysconfdir}/quotawarnmsg.example
%if 0%{?suse_version} >= 1120
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/permissions.d/%{name}-permissions
%attr(644,root,root) %config(noreplace) %{_sysconfdir}/permissions.d/%{name}-permissions.secure
%endif
# courier imap
%attr(755,root,root) %{_prefix}/bin/maildirmake
%attr(755,root,root) %{_prefix}/bin/maildirkw
%attr(755,root,root) %{_prefix}/bin/maildiracl
%attr(755,root,root) %{_prefix}/bin/maildirwatch
%attr(755,root,root) %{_prefix}/bin/deliverquota
%attr(755,root,root) %{_prefix}/bin/couriertls
%attr(755,root,root) %{_prefix}/bin/imapd
%attr(755,root,root) %{_prefix}/bin/pop3d
%attr(755,root,root) %{_prefix}/bin/mailbot
%attr(755,root,root) %{_prefix}/bin/maildrop
%attr(755,root,root) %{_prefix}/bin/reformail
%attr(755,root,root) %{_prefix}/sbin/imaplogin
%attr(755,root,root) %{_prefix}/sbin/pop3login
%attr(755,root,root) %{_prefix}/sbin/sharedindexinstall
%attr(755,root,root) %{_prefix}/sbin/sharedindexsplit
%attr(755,root,root) %{_prefix}/sbin/authenumerate
%attr(755,root,root) %{_prefix}/sbin/authtest
%if 0
%attr(755,root,root) %{libexecdir}/imapmodules/authpwd
%endif
# setuid binary
%if 0%{?suse_version} >= 1120
%verify (not user group mode caps) %attr(4755, root, root) %{libexecdir}/imapmodules/authshadow
%verify (not user group mode caps) %attr(4755, root, root) %{libexecdir}/imapmodules/authpam
%else
%attr(4755,root,root) %{libexecdir}/imapmodules/authshadow
%attr(4755,root,root) %{libexecdir}/imapmodules/authpam
%endif
# fetchmail
%attr(755,root,root) %{_prefix}/bin/fetchmailconf
%attr(755,root,root) %{_prefix}/bin/fetchmail
%attr(755,root,root) %{libexecdir}/pop3d-ssl.rc
%attr(755,root,root) %{libexecdir}/makedatprog
%attr(755,root,root) %{libexecdir}/imapd-ssl.rc
%attr(755,root,root) %{libexecdir}/couriertcpd
%attr(755,root,root) %{libexecdir}/imapd.rc
%attr(755,root,root) %{libexecdir}/pop3d.rc
%attr(755,root,root) %{libexecdir}/mkimapdcert
%attr(755,root,root) %{libexecdir}/mkpop3dcert
%attr(755,root,root) %{libexecdir}/mkdhparams
%attr(755,root,root) %{libexecdir}/courierlogins
%lang(eo) /usr/share/indimail/locale/eo/LC_MESSAGES/fetchmail.mo
%lang(sq) /usr/share/indimail/locale/sq/LC_MESSAGES/fetchmail.mo
%lang(cs) /usr/share/indimail/locale/cs/LC_MESSAGES/fetchmail.mo
%lang(de) /usr/share/indimail/locale/de/LC_MESSAGES/fetchmail.mo
%lang(vi) /usr/share/indimail/locale/vi/LC_MESSAGES/fetchmail.mo
%lang(pl) /usr/share/indimail/locale/pl/LC_MESSAGES/fetchmail.mo
%lang(fr) /usr/share/indimail/locale/fr/LC_MESSAGES/fetchmail.mo
%lang(sv) /usr/share/indimail/locale/sv/LC_MESSAGES/fetchmail.mo
%lang(es) /usr/share/indimail/locale/es/LC_MESSAGES/fetchmail.mo
%lang(ja) /usr/share/indimail/locale/ja/LC_MESSAGES/fetchmail.mo
%lang(ro) /usr/share/indimail/locale/ro/LC_MESSAGES/fetchmail.mo
%lang(sr) /usr/share/indimail/locale/sr/LC_MESSAGES/fetchmail.mo
%if 0%{?fedora_version} > 30 || 0%{?centos_version} > 700 || 0%{?rhel_version} > 700 || 0%{?centos_ver} > 7 || 0%{?almalinux_version} > 700 || 0%{?rocky_version} > 700 || 0%{?fedora} > 30 || 0%{?rhel} > 7 || %{defined mgaversion} || %{defined amzn} || %{defined openEuler} || ( 0%{?sle_version} >= 150400 && 0%{?is_opensuse} )
%attr(644,root,root) %{pythondir}/__pycache__/*.pyc
%attr(755,root,root) %{pythondir}/fetchmailconf.py
%endif
%docdir %{shareddir}/doc
%docdir %{mandir}
%attr(0644,root,root) %{mandir}/man1/fetchmailconf.1.*
%attr(0644,root,root) %{mandir}/man1/fetchmail.1.*
%attr(0644,root,root) %{mandir}/man1/reformail.1.*
%attr(0644,root,root) %{mandir}/man1/makedat.1.*
%attr(0644,root,root) %{mandir}/man1/maildrop.1.*
%attr(0644,root,root) %{mandir}/man1/mailbot.1.*
%attr(0644,root,root) %{mandir}/man1/courierlogins.1.*
%attr(0644,root,root) %{mandir}/man1/couriertls.1.*
%attr(0644,root,root) %{mandir}/man1/couriertcpd.1.*
%attr(0644,root,root) %{mandir}/man1/maildirkw.1.*
%attr(0644,root,root) %{mandir}/man1/sharedindexsplit.1.*
%attr(0644,root,root) %{mandir}/man1/sharedindexinstall.1.*
%attr(0644,root,root) %{mandir}/man1/maildiracl.1.*
%attr(0644,root,root) %{mandir}/man1/maildirmake.1.*
%attr(0644,root,root) %{mandir}/man1/maildirwatch.1.*
%attr(0644,root,root) %{mandir}/man1/authtest.1.*
%attr(0644,root,root) %{mandir}/man1/authenumerate.1.*
%attr(0644,root,root) %{mandir}/man7/maildropgdbm.7.*
%attr(0644,root,root) %{mandir}/man7/maildropfilter.7.*
%attr(0644,root,root) %{mandir}/man7/maildropex.7.*
%attr(0644,root,root) %{mandir}/man7/authlib.7.*
%attr(0644,root,root) %{mandir}/man7/authshadow.7.*
%if 0
%attr(0644,root,root) %{mandir}/man7/authpwd.7.*
%endif
%attr(0644,root,root) %{mandir}/man7/authindi.7.*
%attr(0644,root,root) %{mandir}/man7/authpam.7.*
%attr(0644,root,root) %{mandir}/man7/maildirquota.7.*
%attr(0644,root,root) %{mandir}/man7/courier-unicode.7.*
%attr(0644,root,root) %{mandir}/man8/makeimapaccess.8.*
%attr(0644,root,root) %{mandir}/man8/pop3login.8.*
%attr(0644,root,root) %{mandir}/man8/imaplogin.8.*
%attr(0644,root,root) %{mandir}/man8/pop3d.8.*
%attr(0644,root,root) %{mandir}/man8/imapd.8.*
%attr(0644,root,root) %{mandir}/man8/mkpop3dcert.8.*
%attr(0644,root,root) %{mandir}/man8/mkimapdcert.8.*
%attr(0644,root,root) %{mandir}/man8/mkdhparams.8.*
%attr(0644,root,root) %{mandir}/man8/deliverquota.8.*
%if %build_on_obs == 0
%license %attr(644,root,root) %{shareddir}/doc/courier-imap/COPYING
%license %attr(644,root,root) %{shareddir}/doc/courier-imap/COPYING.GPL
%license %attr(644,root,root) %{shareddir}/doc/COPYING.fetchmail
%else
%attr(644,root,root) %{shareddir}/doc/courier-imap/COPYING
%attr(644,root,root) %{shareddir}/doc/courier-imap/COPYING.GPL
%attr(644,root,root) %{shareddir}/doc/COPYING.fetchmail
%endif
%attr(644,root,root) %{shareddir}/doc/courier-imap/AUTHORS
%attr(644,root,root) %{shareddir}/doc/README.SSL-SERVER.fetchmail
%attr(644,root,root) %{shareddir}/doc/README.SSL.fetchmail
%attr(644,root,root) %{shareddir}/doc/README.NTLM.fetchmail
%attr(644,root,root) %{shareddir}/doc/README.fetchmail
%attr(644,root,root) %{shareddir}/doc/courier-imap/README.sharedfolders.md
%attr(644,root,root) %{shareddir}/doc/courier-imap/README.maildirquota.txt
%attr(644,root,root) %{shareddir}/doc/courier-imap/README.imapkeywords.txt
%attr(644,root,root) %{shareddir}/doc/courier-imap/README.couriertls
%attr(644,root,root) %{shareddir}/doc/courier-imap/README.unicode
%attr(644,root,root) %{shareddir}/doc/courier-imap/README.imap
%attr(644,root,root) %{shareddir}/doc/courier-imap/README.courier-imap
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/lockmail.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/mailbot.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildir.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildiracl.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildirkw.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildirmake.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildrop.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildropex.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildropfilter.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/maildropgdbm.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/makemime.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/manpage.css
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/reformail.html
%attr(644,root,root) %{shareddir}/doc/courier-imap/html/reformime.html
%{_libdir}/libcourier-unicode.so.7
%{_libdir}/libcourier-unicode.so.7.0.0
%clean
%if %{undefined nodebug}
%{__rm} -f %{_builddir}/debugfiles.list %{_builddir}/debuglinks.list \
%{_builddir}/debugsourcefiles.list %{_builddir}/debugsources.list \
%{_builddir}/elfbins.list
%endif
### SCRIPTLET ###############################################################################
%verifyscript
%if 0%{?suse_version} >= 1120
%verify_permissions -e %{libexecdir}/imapmodules/authshadow
%verify_permissions -e %{libexecdir}/imapmodules/authpam
%endif
### SCRIPTLET ###############################################################################
%pretrans
if [ -d /run ] ; then
rundir=/run/svscan
elif [ -d /var/run ] ; then
rundir=/var/run/svscan
else
rundir=%{servicedir}
fi
for i in fetchmail qmail-imapd.143 qmail-imapd-ssl.993 \
qmail-pop3d.110 qmail-pop3d-ssl.995 fetchmail
do
if [ ! -d %{servicedir}/$i ] ; then
continue
fi
%{_prefix}/bin/svstat %{servicedir}/$i >/dev/null 2>&1
if [ $? -eq 0 ] ; then
%{__mkdir_p} ${rundir}/$i
touch ${rundir}/$i/.down
%{_prefix}/bin/svc -d %{servicedir}/$i
fi
done
### SCRIPTLET ###############################################################################
%post
argv1=$1
if [ -z "$argv1" ] ; then
argv1=0
fi
if [ $argv1 -eq 2 ] ; then # upgrade
# we are doing upgrade
(
echo "doing post upgrade activities"
if [ "%{_libdir}" != "/usr/lib64" -a "%{_libdir}" != "/usr/lib" ] ; then
/sbin/ldconfig
fi
# refresh indimail services
svc_list=""
for i in fetchmail qmail-imapd.143 qmail-imapd-ssl.993 \
qmail-pop3d.110 qmail-pop3d-ssl.995
do
if [ ! -d %{servicedir}/$i ] ; then
continue
fi
if [ -z "$svc_list" ] ; then
svc_list="%{servicedir}/$i"
else
svc_list="$svc_list %{servicedir}/$i"
fi
done
if [ -d /run ] ; then
rundir=/run/svscan
elif [ -d /var/run ] ; then
rundir=/var/run/svscan
else
rundir=%{servicedir}
fi
# restart services
%{_prefix}/sbin/svctool --servicedir=%{servicedir} --refreshsvc="$svc_list"
for i in fetchmail qmail-imapd.143 qmail-imapd-ssl.993 \
qmail-pop3d.110 qmail-pop3d-ssl.995 fetchmail
do
if [ ! -d %{servicedir}/$i ] ; then
continue
fi
%{_prefix}/bin/svok %{servicedir}/$i
if [ $? -eq 0 -a -f ${rundir}/$i/.down ] ; then
%{__rm} -f ${rundir}/$i/.down
%{_prefix}/bin/svc -u %{servicedir}/$i
fi
done
) >> /var/log/indimail-access-setup.log 2>&1
exit 0
fi
%if 0%{?suse_version} >= 1120
%if 0%{?set_permissions:1} > 0
%set_permissions %{libexecdir}/imapmodules/authshadow
%set_permissions %{libexecdir}/imapmodules/authpam
%else
%run_permissions
%endif
%endif
echo "Doing Post Install"
echo ""
echo " 1. Configure %{logdir} for multilog"
echo " 2. Configure %{servicedir}"
echo " 3. Configure fetchmail service"
echo " 4. Configure IMAP/POP3 services"
echo " 5. Configure tcprules database for IMAP, POP3"
echo ""
(
# Recreate ld.so links and cache
if [ "%{_libdir}" != "/usr/lib64" -a "%{_libdir}" != "/usr/lib" ] ; then
if [ -d %{_sysconfdir}/ld.so.conf.d ] ; then
echo %{_libdir} > %{_sysconfdir}/ld.so.conf.d/indimail-access-%{_arch}.conf
fi
/sbin/ldconfig
fi
for i in fetchmail imapd.143 imapd-ssl.993 pop3d.110 pop3d-ssl.995
do
%{__mkdir_p} %{logdir}/$i
%{__chown} -R qmaill:nofiles %{logdir}/$i
done
%if %build_on_obs == 0
if [ -x /usr/bin/uname -o -x /bin/uname ] ; then
default_domain=$(echo $([ -n "$HOSTNAME" ] && echo "$HOSTNAME" || uname -n) | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./')
else
default_domain=$([ -n "$HOSTNAME" ] && echo "$HOSTNAME" | sed 's/^\([^\.]*\)\.\([^\.]*\)\./\2\./' || echo %{defaultDomain})
fi
%else
default_domain=%{defaultDomain}
%endif
%ifarch x86_64
%global fetchmail_mem 104857600
%global imap_pop3_mem 104857600
%global imapspop3_mem 104857600
%else
%global fetchmail_mem 52428800
%global imap_pop3_mem 52428800
%global imapspop3_mem 52428800
%endif
# fetchmail
if [ -d /run ] ; then
logfifo="/run/indimail/logfifo"
%{__mkdir_p} /run/indimail
elif [ -d /var/run ] ; then
logfifo="/var/run/indimail/logfifo"
%{__mkdir_p} /var/run/indimail
else
logfifo="/tmp/logfifo"
fi
if [ %nodksignatures -eq 0 ] ; then
if [ -f %{sysconfdir}/control/default ] ; then
ver_opt="both"
else
ver_opt="none"
fi
else
ver_opt="none"
fi
extra_opt=""
if [ -x %{_prefix}/bin/bogofilter ] ; then
extra_opt="--spamfilter=\"%{_prefix}/bin/bogofilter -p -d %{sysconfdir}\""
extra_opt="$extra_opt --logfilter=$logfifo --rejectspam=0 --spamexitcode=0"
fi
if [ -f /usr/sbin/clamd -a -f /usr/bin/clamdscan ] ; then
if [ -d %{_sysconfdir}/clamav ] ; then
mysysconfdir=%{_sysconfdir}/clamav
elif [ -d %{_sysconfdir}/clamd.d ] ; then
mysysconfdir=%{_sysconfdir}/clamd.d
elif [ -d %{sysconfdir} ] ; then
mysysconfdir=%{sysconfdir}
else
mysysconfdir=%{_sysconfdir}
fi
qhpsi="/usr/bin/clamdscan %s --config=${mysysconfdir}/scan.conf --fdpass --quiet --no-summary"
extra_opt="$extra_opt --qhpsi=\"$qhpsi\""
fi
eval %{_prefix}/sbin/svctool --fetchmail --servicedir=%{servicedir} \
--qbase=%{qbase} --qcount=%{qcount} --qstart=1 \
--cntrldir=control --memory=%{fetchmail_mem} --fsync --syncdir \
--dkverify=$ver_opt $extra_opt
#
# user has to create fetchmailrc before which fetchmail cannot be started
#
touch %{servicedir}/fetchmail/down
# IMAP/POP3
%{_prefix}/sbin/svctool --imap=143 --servicedir=%{servicedir} --localip=0 --maxdaemons=40 \
--maxperip=25 --query-cache --memory=%{imap_pop3_mem} --default-domain=${default_domain} \
--starttls --infifo=infifo
%{_prefix}/sbin/svctool --imap=993 --servicedir=%{servicedir} --localip=0 --maxdaemons=40 \
--maxperip=25 --query-cache --memory=%{imapspop3_mem} --default-domain=${default_domain} \
--ssl --infifo=infifo
%{_prefix}/sbin/svctool --pop3=110 --servicedir=%{servicedir} --localip=0 --maxdaemons=40 \
--maxperip=25 --query-cache --memory=%{imap_pop3_mem} --default-domain=${default_domain} \
--starttls --infifo=infifo
%{_prefix}/sbin/svctool --pop3=995 --servicedir=%{servicedir} --localip=0 --maxdaemons=40 \
--maxperip=25 --query-cache --memory=%{imapspop3_mem} --default-domain=${default_domain} \
--ssl --infifo=infifo
# add courier-imap auth module authindi
if [ -f %{libexecdir}/imapmodules/authindi ] ; then
echo "adding authindi as IMAP/POP3 auth module"
for i in `ls -d %{servicedir}/qmail-pop3d* %{servicedir}/qmail-imapd*`
do
if [ -s $i/variables/IMAPMODULES ] ; then
grep authindi $i/variables/IMAPMODULES > /dev/null
if [ $? -ne 0 ] ; then
AUTHM="`cat $i/variables/IMAPMODULES` authindi"
echo $AUTHM > $i/variables/IMAPMODULES
fi
fi
done
fi
# rebuild cdb
for i in imap pop3
do
for j in `/bin/ls %{sysconfdir}/tcp/tcp*.$i 2>/dev/null`
do
t1=`date +'%s' -r $j`
if [ -f $j.cdb ] ; then
t2=`date +'%s' -r $j.cdb`
else
t2=0
fi
if [ $t1 -gt $t2 ] ; then
echo "Creating CDB $j.cdb"
%{_prefix}/bin/tcprules $j.cdb $j.tmp < $j && /bin/chmod 664 $j.cdb \
&& %{__chown} indimail:indimail $j.cdb
fi
done
done
# turn off automatic refresh for services during first time installation
svc_list=""
for i in fetchmail qmail-imapd.143 qmail-imapd-ssl.993 \
qmail-pop3d.110 qmail-pop3d-ssl.995
do
if [ ! -d %{servicedir}/$i ] ; then
continue
fi
svc_list="$svc_list %{servicedir}/$i"
# save variables
%{_prefix}/sbin/svctool --servicedir=%{servicedir} --service-name=$i \
--export-variables=%{servicedir}/$i/variables/.variables --force
done
%{_prefix}/sbin/svctool --servicedir=%{servicedir} --autorefresh="0 $svc_list"
) >> /var/log/indimail-access-setup.log 2>&1
echo
echo "Check /var/log/indimail-access-setup.log for the detailed installation log!!!"
### SCRIPTLET ###############################################################################
%postun
argv1=$1
if [ -z "$argv1" ] ; then
argv1=0
fi
# we are doing upgrade
if [ $argv1 -eq 1 ] ; then
if [ "%{_libdir}" != "/usr/lib64" -a "%{_libdir}" != "/usr/lib" ] ; then
echo "recreating ld.so cache"
/sbin/ldconfig
fi
exit 0
fi
(
echo "removing startup services"
for i in fetchmail qmail-imapd.143 qmail-imapd-ssl.993 \
qmail-pop3d.110 qmail-pop3d-ssl.995 \
qmail-imapd.4143 qmail-pop3d.4110
do
if [ -d %{servicedir}/$i -o -L %{servicedir}/$i ] ; then
touch %{servicedir}/$i/down
svc -dx %{servicedir}/$i
fi
if [ -d %{servicedir}/$i/log -o -L %{servicedir}/$i/log ] ; then
touch %{servicedir}/$i/log/down
svc -dx %{servicedir}/$i/log
fi
if [ -d %{servicedir}/$i -o -L %{servicedir}/$i ] ; then
%{__rm} -rf %{servicedir}/$i || true
fi
done
echo "removing logs"
if [ -h %{logdir} ] ; then
log_dir=`/bin/ls -ld %{logdir} | /usr/bin/awk '{print $10}'`
else
log_dir=%{logdir}
fi
for i in fetchmail imapd.143 imapd-ssl.993
do
%{__rm} -rf $log_dir/$i
done
if [ "%{_libdir}" != "/usr/lib64" -a "%{_libdir}" != "/usr/lib" ] ; then
echo "recreating ld.so cache"
/sbin/ldconfig
fi
) >> /var/log/indimail-setup.log 2>&1
# fix changelog for openSUSE buildservice
%changelog