2017-01-04 17:47:22 +01:00
|
|
|
#
|
|
|
|
# spec file for package conman
|
|
|
|
#
|
2018-01-10 22:22:38 +01:00
|
|
|
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
|
2017-01-04 17:47:22 +01:00
|
|
|
#
|
|
|
|
# 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/
|
2017-08-14 16:07:03 +02:00
|
|
|
#
|
|
|
|
|
|
|
|
|
2017-01-04 17:47:22 +01:00
|
|
|
#
|
2017-11-29 17:21:27 +01:00
|
|
|
#Compat macro for new _fillupdir macro introduced in Nov 2017
|
|
|
|
%if ! %{defined _fillupdir}
|
|
|
|
%define _fillupdir /var/adm/fillup-templates
|
|
|
|
%endif
|
|
|
|
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?suse_version} > 1140
|
|
|
|
%define have_systemd 1
|
|
|
|
%ifarch x86_64
|
|
|
|
%define have_freeipmi 1
|
|
|
|
%endif
|
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
|
2017-08-14 16:07:03 +02:00
|
|
|
%if 0%{?have_systemd}
|
2017-10-09 09:17:36 +02:00
|
|
|
%if 0%{?sle_version} >= 150000 || 0%{?is_opensuse}
|
2018-01-10 22:22:38 +01:00
|
|
|
%define conmandir conman/
|
2017-10-09 09:17:36 +02:00
|
|
|
%define conman_g %name
|
|
|
|
%define conman_u %name
|
|
|
|
%else
|
|
|
|
%define conman_g root
|
|
|
|
%define conman_u root
|
|
|
|
%endif
|
2017-08-14 16:07:03 +02:00
|
|
|
%else
|
|
|
|
%define conman_g root
|
|
|
|
%define conman_u daemon
|
|
|
|
%endif
|
|
|
|
|
2017-01-04 17:47:22 +01:00
|
|
|
Name: conman
|
2017-10-06 16:31:51 +02:00
|
|
|
Version: 0.2.8
|
2017-01-04 17:47:22 +01:00
|
|
|
Release: 0
|
|
|
|
|
|
|
|
Summary: The Console Manager
|
|
|
|
License: GPL-3.0+
|
2017-08-14 16:07:03 +02:00
|
|
|
Group: System/Console
|
|
|
|
Url: http://dun.github.io/conman/
|
2017-01-04 17:47:22 +01:00
|
|
|
|
|
|
|
Requires: expect
|
|
|
|
Requires: logrotate
|
|
|
|
|
|
|
|
BuildRequires: tcpd-devel
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_freeipmi}
|
2017-01-04 17:47:22 +01:00
|
|
|
BuildRequires: freeipmi-devel
|
|
|
|
%endif
|
2017-10-06 16:31:51 +02:00
|
|
|
Source0: https://github.com/dun/conman/archive/%{name}-%{version}.tar.gz
|
2017-10-09 09:17:36 +02:00
|
|
|
Source1: %{name}.service.in
|
2017-08-14 16:37:52 +02:00
|
|
|
%if 0%{?have_systemd}
|
2017-08-14 16:07:03 +02:00
|
|
|
BuildRequires: systemd
|
|
|
|
BuildRequires: systemd-rpm-macros
|
|
|
|
%{?systemd_requires}
|
2017-08-14 17:51:06 +02:00
|
|
|
Requires(pre): shadow
|
2017-02-02 19:27:41 +01:00
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
|
2017-08-14 16:07:03 +02:00
|
|
|
Patch1: conman-suse-fix-expect-scripts.patch
|
|
|
|
|
2017-01-04 17:47:22 +01:00
|
|
|
# 8/15/14 karl.w.schulz@intel.com - include prereq
|
|
|
|
%if 0%{?sles_version} || 0%{?suse_version}
|
2017-08-14 16:07:03 +02:00
|
|
|
PreReq: %{fillup_prereq}
|
2017-01-04 17:47:22 +01:00
|
|
|
%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
|
2017-10-06 16:31:51 +02:00
|
|
|
%setup -q -n %{name}-%{name}-%{version}
|
2017-08-14 16:07:03 +02:00
|
|
|
%patch1 -p1
|
2017-01-04 17:47:22 +01:00
|
|
|
|
|
|
|
%build
|
|
|
|
%configure --with-tcp-wrappers \
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_freeipmi}
|
2017-01-04 17:47:22 +01:00
|
|
|
--with-freeipmi \
|
|
|
|
%endif
|
|
|
|
|
|
|
|
make %{?_smp_mflags}
|
|
|
|
|
|
|
|
%install
|
2017-02-02 19:27:41 +01:00
|
|
|
%make_install
|
2017-01-04 17:47:22 +01:00
|
|
|
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_systemd}
|
2017-10-09 09:17:36 +02:00
|
|
|
mkdir -p %{buildroot}%{_unitdir}
|
|
|
|
sed -e "s/@conman_u@/%conman_u/" -e "s/@conman_g@/%conman_g/" <%{SOURCE1} >%{buildroot}%{_unitdir}/%{name}.service
|
|
|
|
chmod 0644 %{buildroot}%{_unitdir}/%{name}.service
|
2017-01-04 17:47:22 +01:00
|
|
|
rm -rf %{buildroot}%{_sysconfdir}/init.d
|
2017-02-20 21:16:02 +01:00
|
|
|
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcconman
|
2017-02-02 19:27:41 +01:00
|
|
|
%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
|
2017-11-29 17:21:27 +01:00
|
|
|
mkdir -p %{buildroot}%{_fillupdir}
|
2017-02-20 21:16:02 +01:00
|
|
|
mv %{buildroot}%{_sysconfdir}/sysconfig/conman \
|
2017-11-29 17:21:27 +01:00
|
|
|
%{buildroot}%{_fillupdir}/sysconfig.conman
|
2017-01-04 17:47:22 +01:00
|
|
|
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
|
2018-01-10 22:22:38 +01:00
|
|
|
|
|
|
|
%if 0%{?conmandir:1}
|
|
|
|
mkdir -p %{buildroot}%{_tmpfilesdir}
|
|
|
|
cat >> %{buildroot}%{_tmpfilesdir}/%{name}.conf <<EOF
|
|
|
|
d %_localstatedir%_rundir/%{name} 0755 %{conman_u} %{conman_g} -
|
|
|
|
EOF
|
|
|
|
mkdir -p %{buildroot}%{_localstatedir}/log/conman
|
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
if ! grep "^SERVER" %{buildroot}/etc/conman.conf > /dev/null; then
|
|
|
|
cat <<EOF >> %{buildroot}/etc/conman.conf
|
|
|
|
SERVER keepalive=ON
|
2018-01-10 22:22:38 +01:00
|
|
|
SERVER logdir="/var/log/%{conmandir}"
|
|
|
|
SERVER logfile="/var/log/%{conmandir}conman.log"
|
2017-01-04 17:47:22 +01:00
|
|
|
SERVER loopback=ON
|
2018-01-10 22:22:38 +01:00
|
|
|
SERVER pidfile="/var/run/%{conmandir}conman.pid"
|
2017-08-14 16:37:52 +02:00
|
|
|
SERVER tcpwrappers=ON
|
2017-01-04 17:47:22 +01:00
|
|
|
SERVER timestamp=1h
|
|
|
|
GLOBAL seropts="115200,8n1"
|
|
|
|
GLOBAL log="console.%N"
|
|
|
|
GLOBAL logopts="sanitize,timestamp"
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_systemd}
|
2017-08-14 16:37:52 +02:00
|
|
|
%pre
|
2017-01-04 17:47:22 +01:00
|
|
|
%service_add_pre conman.service
|
2018-01-10 22:22:38 +01:00
|
|
|
%if 0%{?conmandir:1}
|
|
|
|
%define conman_home "%_localstatedir%_rundir/%conmandir"
|
2017-08-14 16:07:03 +02:00
|
|
|
%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
|
2018-01-10 22:22:38 +01:00
|
|
|
%endif
|
2017-08-14 16:07:03 +02:00
|
|
|
exit 0
|
2017-08-14 17:51:06 +02:00
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
|
|
|
|
%preun
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_systemd}
|
2017-01-04 17:47:22 +01:00
|
|
|
%service_del_preun conman.service
|
2017-02-02 19:27:41 +01:00
|
|
|
%else
|
|
|
|
%{stop_on_removal conman}
|
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
|
|
|
|
%post
|
|
|
|
%fillup_only conman
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_systemd}
|
2018-01-10 22:22:38 +01:00
|
|
|
%{?tmpfiles_create:%{tmpfiles_create %{_tmpfilesdir}/%{name}.conf}}
|
2017-01-04 17:47:22 +01:00
|
|
|
%service_add_post conman.service
|
2018-01-10 22:22:38 +01:00
|
|
|
if [ $1 -eq 2 ]; then
|
|
|
|
tmpfile=$(mktemp /tmp/tmp-XXXX)
|
|
|
|
sed -e "s@^\(server\)\|\(SERVER\) \+logdir=.*@SERVER logdir=\"/var/log/%{conmandir}\"@" \
|
|
|
|
-e "s@^\(server\)\|\(SERVER\) \+logfile=.*@SERVER logfile=\"/var/log/%{conmandir}conman.log\"@" \
|
|
|
|
-e "s@^\(server\)\|\(SERVER\) \+pidfile=.*@SERVER pidfile=\"/var/run/%{conmandir}conman.pid\"@" \
|
|
|
|
< /etc/conman.conf > $tmpfile
|
|
|
|
if ! cmp /etc/conman.conf $tmpfile; then
|
|
|
|
mv $tmpfile /etc/conman.conf
|
|
|
|
chown %conman_u:%conman_g /etc/conman.conf
|
|
|
|
else
|
|
|
|
rm $tmpfile
|
|
|
|
fi
|
|
|
|
fi
|
2017-02-02 19:27:41 +01:00
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
|
|
|
|
%postun
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_systemd}
|
2017-01-04 17:47:22 +01:00
|
|
|
%service_del_postun conman.service
|
2017-02-02 19:27:41 +01:00
|
|
|
%else
|
|
|
|
%{restart_on_update conman}
|
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
|
|
|
|
%files
|
|
|
|
%defattr(-,root,root,-)
|
|
|
|
%doc AUTHORS
|
|
|
|
%doc DISCLAIMER*
|
|
|
|
%doc FAQ
|
2017-10-06 16:31:51 +02:00
|
|
|
%doc COPYING
|
2017-01-04 17:47:22 +01:00
|
|
|
%doc NEWS
|
|
|
|
%doc README
|
2017-10-06 16:31:51 +02:00
|
|
|
%doc PLATFORMS
|
|
|
|
%doc README.md
|
2017-01-04 17:47:22 +01:00
|
|
|
%doc THANKS
|
2017-08-14 16:07:03 +02:00
|
|
|
%config(noreplace) %attr(-,%conman_u,%conman_g) %{_sysconfdir}/conman.conf
|
2017-01-04 17:47:22 +01:00
|
|
|
%config(noreplace) %{_sysconfdir}/logrotate.d/conman
|
2018-01-10 22:22:38 +01:00
|
|
|
%if 0%{?conmandir:1}
|
|
|
|
%dir %attr(-,%conman_u,%conman_g) %{_localstatedir}/log/conman
|
|
|
|
%{_tmpfilesdir}/%{name}.conf
|
|
|
|
%endif
|
2017-11-29 17:21:27 +01:00
|
|
|
%{_fillupdir}/sysconfig.conman
|
2017-01-04 17:47:22 +01:00
|
|
|
%{_bindir}/*
|
|
|
|
%{_sbindir}/*
|
|
|
|
%{_prefix}/lib/conman
|
2017-02-17 11:46:09 +01:00
|
|
|
%if 0%{?have_systemd}
|
2017-01-04 17:47:22 +01:00
|
|
|
%{_prefix}/lib/systemd/*
|
2017-02-02 19:27:41 +01:00
|
|
|
%else
|
|
|
|
%{_sysconfdir}/init.d/*
|
|
|
|
%endif
|
2017-01-04 17:47:22 +01:00
|
|
|
%{_mandir}/*/*
|
2017-08-14 16:07:03 +02:00
|
|
|
|
|
|
|
%changelog
|