Package qico.xe: Specfile

%define origname qico
%define branch xe
%define bversion 0.57.1
%define cvsdate 20070810
Name: %origname.%branch
Version: %bversion
%define buildrel 11
%define rel     alt%buildrel	

Summary: qico, an FTN-compatible mailer
Release: %rel
License: BSD
Group: System/Servers
URL: http://193.232.248.13:8080/qicoxe/

Packager: Anton Gorlov <stalker@altlinux.ru>

%ifdef cvsdate
Source: %origname-%bversion%branch-%cvsdate.tar.bz2
%else
Source: %origname-%bversion%branch.tar.bz2
%endif

Patch0: qico.conf.diff
#Patch1: fix.build.alt
Source1: %origname.init
Source2: %origname.fido
Source3: %origname.binkp
Source4: %origname.subst
Source5: %origname.passwd
Source6: %origname

Conflicts: %origname

# Automatically added by buildreq on Thu Sep 15 2005
BuildRequires: flex libncurses-devel libtinfo-devel

%description
Qico is an FidoNet Technology Network (FTN) compatible mailer for Unix
systems. It has some original features. Full list of features you can
find in README file. It works well (i.e. was runned at least once ;)
under Linux, FreeBSD and even BeOS.

%package xinetd
Summary: xinetd service %origname for incoming ftn-over-ip sessions
Group: System/Servers
Requires: %name = %version-%release
PreReq: xinetd

%description xinetd
Qico is an FidoNet Technology Network (FTN) compatible mailer for Unix
systems. It has some original features. Full list of features you can
find in README file. It works well (i.e. was runned at least once ;)
under Linux, FreeBSD and even BeOS.

This package contains xinetd service %origname for incoming ftn-over-ip
sessions

%prep
%setup -q -n %origname-%bversion%branch

%ifdef cvsdate
find . \( -type d -a -name CVS \) -print0 | \
xargs -r0 %__rm -rvf --

find . \( -type f -a -name .cvsignore \) -print0 | \
xargs -r0 %__rm -rvf --
%endif

%patch0 -p1
#%patch1 -p1
%_buildshell autogen.sh

%build
export LDFLAGS="$LDFLAGS -Wl,--as-needed"
%configure --with-config=%_sysconfdir/ftn/%name/%origname.conf
%make_build

%install
%make_install DESTDIR=%buildroot install
%__install -d %buildroot{%_sysconfdir/{ftn/%name,xinetd.d,logrotate.d},%_initdir}
%__install -d %buildroot%_var/run/qico

%__install -m755 %SOURCE1 %buildroot%_initdir/%origname
%__install -m644 %SOURCE2 %buildroot%_sysconfdir/xinetd.d/%origname-ifc
%__install -m644 %SOURCE3 %buildroot%_sysconfdir/xinetd.d/%origname-binkp
%__install -m600 %origname.conf.sample %buildroot%_sysconfdir/ftn/%name/%origname.conf
%__install -m600 %SOURCE4 %buildroot%_sysconfdir/ftn/%name/
%__install -m600 %SOURCE5 %buildroot%_sysconfdir/ftn/%name/
%__install -m644 %SOURCE6 %buildroot%_sysconfdir/logrotate.d/

%__rm -f stuff/Makefile{,.in,.am}

%post
%post_service %origname

for i in qico-master.log qico.log history; do
  if [ ! -f "%_logdir/ftn/$i" ]; then
    :>> "%_logdir/ftn/$i"
    %__chown ftn:ftn "%_logdir/ftn/$i"
    %__chmod 640 "%_logdir/ftn/$i"
  fi
done ||:

for i in emsi.log; do
  if [ ! -f "%_logdir/ftn/$i" ]; then
    :>> "%_logdir/ftn/$i"
    %__chown ftn:ftn "%_logdir/ftn/$i"
    %__chmod 600 "%_logdir/ftn/$i"
  fi
done ||:

%preun
%preun_service %origname

%files
%doc stuff README FAQ ChangeLog Changes
%config(noreplace) %_initdir/%origname
%config(noreplace) %_sysconfdir/logrotate.d/%origname
%attr(770,root,ftn) %_var/run/qico
%dir %attr (770,ftn,ftn) %_sysconfdir/ftn/%name
%attr(640,root,ftn) %config(noreplace) %_sysconfdir/ftn/%name/qico.conf
%attr(600,ftn,root) %config(noreplace) %_sysconfdir/ftn/%name/qico.passwd
%attr(640,root,ftn) %config(noreplace) %_sysconfdir/ftn/%name/qico.subst
%_bindir/qcc
%_bindir/qctl
%_sbindir/qico
%_man8dir/*

%files xinetd
%config(noreplace) %_sysconfdir/xinetd.d/%origname-ifc
%config(noreplace) %_sysconfdir/xinetd.d/%origname-binkp

%changelog
* Fri Aug 10 2007 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt11
- updated from CVS
- 

* Sun Aug 06 2006 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt10
- updated from CVS

* Thu Jul 06 2006 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt9
- updated from CVS

* Thu Apr 20 2006 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt8
- updated from CVS

* Wed Mar 29 2006 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt7
- updated from CVS
- remove patch (merged upstream)

* Tue Mar 07 2006 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt6
- Fix build

* Tue Jan 03 2006 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt5
- Updated from CVS

* Sat Dec 03 2005 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt4
- Updated from CVS
- some spec-file change

* Thu Dec 01 2005 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt3
- Updated from CVS
- cancall switch to never from default
- some spec-file cleanup

* Sat Sep 17 2005 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt2
- Fix# 7985 binkp doesn't work with default config for xinetd

* Tue Sep 13 2005 Anton Gorlov <stalker@altlinux.ru> 0.57.1-alt1
- New version
- Config moved to /etc/ftn/qico.xe
- Some spec-file cleanup
- Fix /etc/ftn/qico* - permissions and ownership (Bug#7953)

* Mon Aug 8 2005 Anton Gorlov <stalker@altlinux.ru> 0.57-alt2
- Some spec-file cleanup

* Fri Jul 22 2005 Anton Gorlov <stalker@altlinux.ru> 0.57-alt1
- initial build for ALT LINUX Sisyphus
- Added xinetd service config for binkp

* Sun Sep 07 2003 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt1
- CVS snapshot 20030714
- Removed patches (merged upstream):
  + ipc
  + alt-SIGTERM-fixes
  + alt-check-config

* Sat May 17 2003 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.9
- Added -t option to daemon - check config file and exit
- Compile nodelists on start and check config on restart/reload
- Daemon now can be restarted upon uprade

* Sun May 04 2003 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.8
- Fix initscript

* Sun May 04 2003 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.7
- CVS snapshot 20030420
- Replaced perl -pi -e with %%__subst
- Rewritten start/stop script to new rc scheme (stolen from vixie-cron ;-)

* Thu Feb 06 2003 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.6
- CVS snapshot 20030109
- Fixed logrotate config (shame on me!)
- Fixed %%post script (log creation)

* Sun Feb 02 2003 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.5
- Leave xinetd alone!
- Logrotate script
- Added Packager tag
- Spec cleantup

* Thu Nov 14 2002 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.4
- Fixed %%pre script (closes #0001556)

* Sun Oct 27 2002 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.3
- CVS snapshot 20020809
- Create default logfiles with right permittions upon install
- BuildRequires updated
- Some SPP fixes
- Default configs

* Wed Jul 03 2002 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.2.20020702
- Fixed qico-ifc config

* Tue Jul 02 2002 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.1.20020702
- CVS snapshot 20020702
- Added patch by Vickenty Fesunov (2:5020/3996.3) that adds some
  qipc_done() calls before exit on error
- Some cosmetic changes in spec

* Thu May 02 2002 Sir Raorn <raorn@altlinux.ru> 0.49.10-alt0.0.20020501
- CVS snapshot 20020501
- Service ftn renamed to qico
  (service ftn should be stopped before upgrading from qico <= 0.49.9-alt1!)
- Added xinetd service config
- Fixed problems with automatic restart
  (no autorestart - no problems :-)

* Wed Apr 10 2002 Sir Raorn <raorn@altlinux.ru> 0.49.9-alt1
- [0.49.9]

* Mon Dec 03 2001 Sir Raorn <raorn@altlinux.ru> 0.49.9-alt0.pre.20010907.1
- Built for Sisyphus