b5c7fc
Name:               conman
75d562
Version:            0.2.8
75d562
Release:            1%{?dist}
b5c7fc
Summary:            ConMan - The Console Manager
b5c7fc
b5c7fc
Group:              Applications/System
75d562
License:            GPLv3+
75d562
URL:                https://dun.github.io/conman/
75d562
Source0:            https://github.com/dun/%{name}/archive/%{name}-%{version}.tar.gz#/%{name}-%{version}.tar.gz
b5c7fc
Source1:            %{name}.service
b5c7fc
Source2:            %{name}.logrotate
bd2909
b5c7fc
BuildRoot:          %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
b5c7fc
b5c7fc
Requires:           logrotate
b5c7fc
Requires(post): systemd-units
b5c7fc
Requires(preun): systemd-units
b5c7fc
Requires(postun): systemd-units
b5c7fc
BuildRequires:      tcp_wrappers
b33baa
BuildRequires:      systemd-units
b1ea76
BuildRequires:      freeipmi-devel
b5c7fc
b5c7fc
%description
b5c7fc
ConMan is a serial console management program designed to support a large
b5c7fc
number of console devices and simultaneous users.  It currently supports
b5c7fc
local serial devices and remote terminal servers (via the telnet protocol).
b5c7fc
Its features include:
b5c7fc
b5c7fc
  - mapping symbolic names to console devices
b5c7fc
  - logging all output from a console device to file
b5c7fc
  - supporting monitor (R/O), interactive (R/W), and
b5c7fc
    broadcast (W/O) modes of console access
b5c7fc
  - allowing clients to join or steal console "write" privileges
b5c7fc
  - executing Expect scripts across multiple consoles in parallel
b5c7fc
b5c7fc
%prep
75d562
%setup -qn %{name}-%{name}-%{version}
75d562
75d562
# fix paths
75d562
sed -i -e 's|lib\/|share\/|g' lib/examples/*.exp
75d562
75d562
# fix shebang
75d562
sed -i -e 's|\/usr\/bin\/env perl|\/usr\/bin\/perl|g' conmen
75d562
b5c7fc
b5c7fc
%build
b5c7fc
bd2909
# This is a bit rough, it builds as PIE client tool (conman)
bd2909
# in addition to PIEing daemon (conmand). But for finer granularity,
bd2909
# we'd need to patch Makefile.in to make it possible to have different
bd2909
# CFLAGS et al for these two binaries.
bd2909
%ifarch s390 s390x sparcv9 sparc64
bd2909
export PIECFLAGS="-fPIE"
bd2909
%else
bd2909
export PIECFLAGS="-fpie"
bd2909
%endif
bd2909
export RELRO="-Wl,-z,relro,-z,now"
bd2909
bd2909
%configure --with-tcp-wrappers CFLAGS="$CFLAGS $PIECFLAGS $RELRO" CXXFLAGS="$CXXFLAGS $PIECFLAGS $RELRO" LDFLAGS="$LDFLAGS -pie"
b5c7fc
make %{?_smp_mflags}
b5c7fc
b5c7fc
%install
b5c7fc
rm -rf $RPM_BUILD_ROOT
b5c7fc
make install DESTDIR=$RPM_BUILD_ROOT
b5c7fc
# put in our own initscript and logrotate
b5c7fc
install -D -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
b5c7fc
rm -rf $RPM_BUILD_ROOT%{_sysconfdir}/init.d
b5c7fc
install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/%{name}
b5c7fc
# make log directories
b5c7fc
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}
b5c7fc
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log/%{name}.old
75d562
75d562
# examples don't belong in libdir...
75d562
rm -rf $RPM_BUILD_ROOT%/usr/lib/%{name}/examples
75d562
# move scripts to proper place
75d562
mv $RPM_BUILD_ROOT/usr/lib/%{name} $RPM_BUILD_ROOT%{_datadir}/%{name}
75d562
b1ea76
## these shouldn't be executable
b1ea76
#chmod -x $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
b1ea76
# rhel7 uses systemd instead of sysV init, /etc/sysconfig/conman
b1ea76
# is not used. Remove it to reduce user's confusion:
b1ea76
rm -f $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
b1ea76
rmdir $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
b5c7fc
# adjust perms on main config file
b5c7fc
chmod 644 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}.conf
b5c7fc
b5c7fc
%clean
b5c7fc
rm -rf "$RPM_BUILD_ROOT"
b5c7fc
b5c7fc
%post
b5c7fc
if [ $1 -eq 1 ] ; then 
b5c7fc
    # Initial installation 
b5c7fc
    /bin/systemctl daemon-reload >/dev/null 2>&1 || :
b5c7fc
fi
b5c7fc
b5c7fc
%preun
b5c7fc
if [ $1 -eq 0 ] ; then
b5c7fc
    # Package removal, not upgrade
b5c7fc
    /bin/systemctl --no-reload disable conman.service > /dev/null 2>&1 || :
b5c7fc
    /bin/systemctl stop conman.service > /dev/null 2>&1 || :
b5c7fc
fi
b5c7fc
b5c7fc
%postun
b5c7fc
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
b5c7fc
if [ $1 -ge 1 ] ; then
b5c7fc
    # Package upgrade, not uninstall
b5c7fc
    /bin/systemctl try-restart conman.service >/dev/null 2>&1 || :
b5c7fc
fi
b5c7fc
b5c7fc
%triggerun -- conman < 0.2.7-1
b5c7fc
# Save the current service runlevel info
b5c7fc
# User must manually run systemd-sysv-convert --apply conman
b5c7fc
# to migrate them to systemd targets
b5c7fc
/usr/bin/systemd-sysv-convert --save conman >/dev/null 2>&1 ||:
b5c7fc
b5c7fc
# Run these because the SysV package being removed won't do them
b5c7fc
/sbin/chkconfig --del conman >/dev/null 2>&1 || :
b5c7fc
/bin/systemctl try-restart conman.service >/dev/null 2>&1 || :
b5c7fc
b5c7fc
%files
b5c7fc
%defattr(-,root,root,-)
75d562
%license COPYING
75d562
%doc AUTHORS FAQ NEWS
75d562
%doc lib/examples
b5c7fc
%config(noreplace) %{_sysconfdir}/%{name}.conf
b1ea76
# rhel7 does not use this file:
b1ea76
#%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
b5c7fc
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
b5c7fc
%{_unitdir}/%{name}.service
b5c7fc
%{_localstatedir}/log/%{name}
b5c7fc
%{_localstatedir}/log/%{name}.old
b5c7fc
%{_bindir}/*
b5c7fc
%{_sbindir}/*
b5c7fc
%{_datadir}/%{name}
b5c7fc
%{_mandir}/*/*
b5c7fc
b5c7fc
%changelog
75d562
* Tue Aug 29 2017 Ondrej Vasik <ovasik@redhat.com> - 0.2.8-1
75d562
- updated to 0.2.8, spec cleanups, drop overflow hack(#1435840)
75d562
bd2909
* Fri May 13 2016 David Sommerseth <davids@redhat.com> - 0.2.7-15
bd2909
- Fix lost CFFLAGS/CXXFLAGS/LDFLAGS from RELRO/PIE fixes in 0.2.7-13 (1092546)
bd2909
bd2909
* Fri May 13 2016 David Sommerseth <davids@redhat.com> - 0.2.7-14
bd2909
- Fix buffer overflow issue triggered by PIE/RELRO builds (1092546)
bd2909
bd2909
* Mon Sep 14 2015 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-13
bd2909
- Build executables with RELRO and PIE (1092546)
bd2909
b1ea76
* Fri Jul 17 2015 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-12
b1ea76
- Remove unused /etc/sysconfig/conman.
b1ea76
- Resolves: rhbz#1244219.
b1ea76
b1ea76
* Fri Jul 17 2015 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-11
b1ea76
- Ensure that num_threads <= IPMICONSOLE_THREAD_COUNT_MAX.
b1ea76
- Resolves: rhbz#1244189.
b1ea76
b1ea76
* Wed Jul  1 2015 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-10
b1ea76
- Enable IPMI feature.
b1ea76
- Resolves: rhbz#1084116.
b1ea76
b1ea76
* Wed Apr  8 2015 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-9
b1ea76
- Added commented-out "LimitNOFILE=" directive to conman.service.
b1ea76
- This is systemd-esque way to change process limits for serivces.
b1ea76
- Also and a comment when to use it.
b1ea76
- Resolves: rhbz#1035228.
b1ea76
b33baa
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 0.2.7-8
b33baa
- Mass rebuild 2014-01-24
b33baa
b33baa
* Tue Jan  7 2014 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-7
b33baa
- Added "BuildRequires: systemd-units" to fix _unitdir expansion.
b33baa
- Resolves: rhbz#1048854.
b33baa
b33baa
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 0.2.7-6
b33baa
- Mass rebuild 2013-12-27
b33baa
b5c7fc
* Tue May  7 2013 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-5
b5c7fc
- Again fixed "License:" in spec file (GPLv2+ -> GPLv3+).
b5c7fc
b5c7fc
* Tue May  7 2013 Denys Vlasenko <dvlasenk@redhat.com> - 0.2.7-4
b5c7fc
- Forward-porting fixes from RHEL6.
b5c7fc
- Enlarge buffer used for formatting date in a string format.
b5c7fc
- Resolves: rhbz#891938.
b5c7fc
- Allow configuration of the maximum number of open files.
b5c7fc
- Resolves: rhbz#738967.
b5c7fc
b5c7fc
* Wed Feb 13 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.7-3
b5c7fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
b5c7fc
b5c7fc
* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.7-2
b5c7fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
b5c7fc
b5c7fc
* Tue Apr 17 2012 Jon Ciesla <limburgher@gmail.com> - 0.2.7-1
b5c7fc
- Migrate to systemd, BZ 771474.
b5c7fc
b5c7fc
* Sun Apr 15 2012 Steven M. Parrish <smparrish@gmail.com> - 0.2.7-0
b5c7fc
- New upstream release
b5c7fc
b5c7fc
* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.5-4
b5c7fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
b5c7fc
b5c7fc
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.5-3
b5c7fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
b5c7fc
b5c7fc
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.5-2
b5c7fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
b5c7fc
b5c7fc
* Mon Jun 08 2009 Steven M. Parrish <tuxbrewr@fedoraproject.org> - 0.2.5-0
b5c7fc
- New upstream release
b5c7fc
b5c7fc
* Mon Apr 20 2009 Steven M. Parrish <tuxbrewr@fedoraproject.org> - 0.2.4.1-1
b5c7fc
- New upstream release
b5c7fc
b5c7fc
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.2-3
b5c7fc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
b5c7fc
b5c7fc
* Mon Oct 06 2008 Jarod Wilson <jarod@redhat.com> 0.2.2-2
b5c7fc
- The console option in conman.conf is case-insensitive, so relax
b5c7fc
  defined consoles check in initscript (Mark McLoughlin, #465777)
b5c7fc
b5c7fc
* Mon Sep 08 2008 Steven M. Parrish <smparrish@shallowcreek.net> 0.2.2-1
b5c7fc
- New upstream release
b5c7fc
b5c7fc
* Fri May 02 2008 Jarod Wilson <jwilson@redhat.com> 0.2.1-1
b5c7fc
- New upstream release
b5c7fc
b5c7fc
* Wed Feb 13 2008 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-8
b5c7fc
- Bump and rebuild for gcc 4.3
b5c7fc
b5c7fc
* Thu Apr 26 2007 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-7
b5c7fc
- Update project urls
b5c7fc
- Fix up initscript exit codes (#237936)
b5c7fc
b5c7fc
* Tue Sep 05 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-6
b5c7fc
- Bump for new glibc
b5c7fc
b5c7fc
* Fri Jul 28 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-5
b5c7fc
- Properly enable smp_mflags this time
b5c7fc
b5c7fc
* Fri Jul 28 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-4
b5c7fc
- Add Reqs on chkconfig and service
b5c7fc
- Turn on smp_mflags
b5c7fc
- Initial build for RHEL5
b5c7fc
b5c7fc
* Wed Jul 05 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-3
b5c7fc
- Add missing condrestart fuction to initscript
b5c7fc
b5c7fc
* Tue Jun 27 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-2
b5c7fc
- Don't strip bins on make install, leave for find-debug.sh
b5c7fc
b5c7fc
* Tue Jun 27 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.2-1
b5c7fc
- Update to 0.1.9.2
b5c7fc
b5c7fc
* Tue Jun 20 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.1-3
b5c7fc
- Add Requires: logrotate
b5c7fc
- Ugh, conmand exits cleanly if no CONSOLE(s) are defined in
b5c7fc
  /etc/conman.conf, add check to initscript to report failure
b5c7fc
  if none are defined
b5c7fc
b5c7fc
* Wed Jun 14 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.1-2
b5c7fc
- Create log directories and install working logrotate config
b5c7fc
- Use a much cleaner RH/FC-specific initscript
b5c7fc
b5c7fc
* Tue Jun 13 2006 Jarod Wilson <jwilson@redhat.com> 0.1.9.1-1
b5c7fc
- Initial build for Fedora Extras