Merge pull request #38 from kajtzu/main

miscellaneous fixes to building and packaging on ELx
This commit is contained in:
Davide Cavalca 2023-10-05 15:40:39 -07:00 committed by GitHub
commit 572e489f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 110 additions and 23 deletions

View File

@ -1,21 +1,43 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
%global debug_package %{nil}
# tcp_wrappers do not exist on stock EL8/EL9
%define libwrap 0
%define systemd 0
%if 0%{?el6}
%define libwrap 1
%endif
%if 0%{?el7}
%define libwrap 1
%endif
%if 0%{?el8}
%define systemd 1
%endif
%if 0%{?el9}
%define systemd 1
%endif
Summary: TACACS+ Daemon
Name: tacacs
Group: Networking/Servers
Version: F4.0.4.28
Release: 7fb
Release: 1%{?dist}
License: Cisco
Packager: Facebook Networking <neteng@fb.com>
Vendor: Facebook Inc.
Source: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: gcc, bison, flex, m4, pam-devel, tcp_wrappers, tcp_wrappers-devel, systemd, python
Requires: pam, tcp_wrappers, tcp_wrappers-devel, tcp_wrappers-libs
BuildRequires: gcc, bison, flex, m4, pam-devel, libtool, autoconf, automake, python-rpm-macros
%if 0%{?libwrap}
BuildRequires: tcp_wrappers, tcp_wrappers-devel
%endif
%if 0%{?systemd}
Requires: systemd
%endif
%description
Tacacs+ Daemon for Linux
@ -24,50 +46,115 @@ Tacacs+ Daemon for Linux
%setup
%build
export CFLAGS="-DHAVE_PAM"
export CFLAGS="-DHAVE_PAM -fPIE"
libtoolize --force
autoreconf --install
automake --add-missing
autoreconf
%if 0%{?libwrap}
%configure --enable-acls --enable-uenable
%else
%configure --enable-acls --enable-uenable --without-libwrap
%endif
%{__make}
%install
export DONT_STRIP=1
%{__rm} -rf %{buildroot}
%makeinstall
%{__install} -Dp -m0755 tac_plus.sysvinit %{buildroot}%{_initrddir}/tac_plus
%if 0%{systemd}
%{__install} -Dp -m0644 tac_plus.service %{buildroot}%{_unitdir}/tac_plus.service
%else
%{__install} -Dp -m0755 tac_plus.sysvinit %{buildroot}%{_initrddir}/tac_plus
%endif
# no need to do anything on el6
%if 0%{?el7}
%py_byte_compile %{__python} %{buildroot}%{_datadir}/tacacs/do_auth.py
%endif
%if 0%{?el8}
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/tacacs/do_auth.py
%endif
%if 0%{?el9}
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/tacacs/do_auth.py
%endif
### Clean up buildroot
%{__rm} -f %{buildroot}%{_infodir}/dir
%{__rm} -f %{buildroot}%{_libdir}/*.a
%{__rm} -f %{buildroot}%{_libdir}/*.la
%post
%if 0%{?el6}
/sbin/chkconfig --add tac_plus
%else
%systemd_post tac_plus.service
%endif
%preun
%if 0%{?el6}
# real uninstall, nothing is left behind
if [ $1 -eq 0 ] ; then
/sbin/service tac_plus stop
fi
%else
%systemd_preun tac_plus.service
%endif
%postun
%if 0%{?el6}
:
%else
%systemd_postun_with_restart tac_plus.service
%endif
%clean
%{__rm} -rf %{buildroot}
%files
%if 0%{?systemd}
%{_unitdir}/tac_plus.service
/usr/include/tacacs.h
/usr/bin/tac_pwd
/usr/sbin/tac_plus
/usr/share/tacacs/users_guide
/usr/share/tacacs/tac_convert
/usr/share/tacacs/do_auth.py
/usr/share/tacacs/do_auth.pyc
/usr/share/tacacs/do_auth.pyo
/usr/share/man/man5/tac_plus.conf.5.gz
/usr/share/man/man8/tac_pwd.8.gz
/usr/share/man/man8/tac_plus.8.gz
%else
%{_initddir}/tac_plus
%endif
%{_includedir}/tacacs.h
%{_bindir}/tac_pwd
%{_sbindir}/tac_plus
%{_datadir}/tacacs/users_guide
%{_datadir}/tacacs/tac_convert
%{_mandir}/man5/tac_plus.conf.5.gz
%{_mandir}/man8/tac_pwd.8.gz
%{_mandir}/man8/tac_plus.8.gz
%{_libdir}/libtacacs.so.1.0.0
%{_libdir}/libtacacs.so.1
%{_libdir}/libtacacs.so
%{_libdir}/libtacacs.a
%{_libdir}/libtacacs.la
/etc/rc.d/init.d/tac_plus
%{_datadir}/tacacs/do_auth.py
%if 0%{?el6}
%{_datadir}/tacacs/do_auth.pyc
%{_datadir}/tacacs/do_auth.pyo
%endif
%if 0%{?el7}
%{_datadir}/tacacs/do_auth.pyc
%{_datadir}/tacacs/do_auth.pyo
%endif
%if 0%{?el9}
%{_datadir}/tacacs/__pycache__/do_auth.cpython-3*.pyc
%endif
%changelog
* Wed May 17 2023 Kaj Niemi <kajtzu@basen.net> - F4.0.4.28-7fb
- tcpwrappers does not exist on EL9 anymore
- run autoconf, libtool, automake to create everything from scratch
- other small fixes