# # spec file for package conman # # Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # # %if 0%{?suse_version} > 1140 %define have_systemd 1 %ifarch x86_64 %define have_freeipmi 1 %endif %endif %if 0%{?have_systemd} %define conman_g %name %define conman_u %name %else %define conman_g root %define conman_u daemon %endif Name: conman Version: 0.2.7 Release: 0 Summary: The Console Manager License: GPL-3.0+ Group: System/Console Url: http://dun.github.io/conman/ Requires: expect Requires: logrotate BuildRequires: tcpd-devel %if 0%{?have_freeipmi} BuildRequires: freeipmi-devel %endif Source0: https://github.com/dun/conman/releases/download/%{name}-%{version}/%{name}-%{version}.tar.bz2 Source1: %{name}.service %if 0%{?have_systemd} BuildRequires: systemd BuildRequires: systemd-rpm-macros %{?systemd_requires} Requires(pre): shadow %endif Patch1: conman-suse-fix-expect-scripts.patch # 8/15/14 karl.w.schulz@intel.com - include prereq %if 0%{?sles_version} || 0%{?suse_version} PreReq: %{fillup_prereq} %endif %description ConMan is a serial console management program designed to support a large number of console devices and simultaneous users. It supports: - local serial devices - remote terminal servers (via the telnet protocol) - IPMI Serial-Over-LAN (via FreeIPMI) - Unix domain sockets - external processes (eg, using Expect for telnet/ssh/ipmi-sol connections) Its features include: - logging (and optionally timestamping) console device output to file - connecting to consoles in monitor (R/O) or interactive (R/W) mode - allowing clients to share or steal console write privileges - broadcasting client output to multiple consoles %prep %setup -q -n %{name}-%{version} %patch1 -p1 %build %configure --with-tcp-wrappers \ %if 0%{?have_freeipmi} --with-freeipmi \ %endif make %{?_smp_mflags} %install %make_install %if 0%{?have_systemd} install -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service rm -rf %{buildroot}%{_sysconfdir}/init.d ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcconman %else awk "/END INIT INFO/ { print \"# Default-Start: 3 5\"; } {print;}" \ %{buildroot}%_sysconfdir/init.d/conman > %{buildroot}%_sysconfdir/init.d/conman.tmp mv %{buildroot}%_sysconfdir/init.d/conman.tmp %{buildroot}%_sysconfdir/init.d/conman ln -s %{_sysconfdir}/init.d/conman %{buildroot}%{_sbindir}/rcconman chmod u+x %{buildroot}%{_sysconfdir}/init.d/conman %endif mkdir -p %{buildroot}/var/adm/fillup-templates mv %{buildroot}%{_sysconfdir}/sysconfig/conman \ %{buildroot}/var/adm/fillup-templates/sysconfig.conman for i in $(find %{buildroot}/usr/lib/conman) ; do if [ -f $i -a -x $i ]; then if ! head -1 $i | grep "^#!"; then echo "#!/usr/bin/expect -f" > /tmp/$(basename $i) cat $i >> /tmp/$(basename $i) mv /tmp/$(basename $i) $i chmod 0755 $i fi fi done if ! grep "^SERVER" %{buildroot}/etc/conman.conf > /dev/null; then cat <> %{buildroot}/etc/conman.conf SERVER keepalive=ON SERVER logdir="/var/log/conman" SERVER logfile="/var/log/conman.log" SERVER loopback=ON SERVER pidfile="/var/run/conman.pid" SERVER resetcmd="powerman -0 %N; sleep 3; powerman -1 %N" SERVER tcpwrappers=ON SERVER timestamp=1h GLOBAL seropts="115200,8n1" GLOBAL log="console.%N" GLOBAL logopts="sanitize,timestamp" EOF fi %if 0%{?have_systemd} %pre %service_add_pre conman.service %define conman_home "%_localstatedir%_rundir/conman" %define conman_descr "Connection Manager service" getent group %conman_g >/dev/null || groupadd -r %conman_g getent passwd %conman_u >/dev/null || useradd -r -g %conman_g -d %conman_home -s /bin/false -c %conman_descr %conman_u exit 0 %endif %preun %if 0%{?have_systemd} %service_del_preun conman.service %else %{stop_on_removal conman} %endif %post %fillup_only conman %if 0%{?have_systemd} %service_add_post conman.service %endif %postun %if 0%{?have_systemd} %service_del_postun conman.service %else %{restart_on_update conman} %endif %files %defattr(-,root,root,-) %doc AUTHORS %doc ChangeLog %doc COPYING %doc DISCLAIMER* %doc FAQ %doc NEWS %doc README %doc THANKS %config(noreplace) %attr(-,%conman_u,%conman_g) %{_sysconfdir}/conman.conf %config(noreplace) %{_sysconfdir}/logrotate.d/conman %{_localstatedir}/adm/fillup-templates/sysconfig.conman %{_bindir}/* %{_sbindir}/* %{_prefix}/lib/conman %if 0%{?have_systemd} %{_prefix}/lib/systemd/* %else %{_sysconfdir}/init.d/* %endif %{_mandir}/*/* %changelog