%global optflags %{optflags} -Wno-parentheses
+%{!?_release_number: %define _release_number 1}
Name: trust_router
-Version: 1.3.2
-Release: 1%{?dist}
+Version: 3.4.0~3
+Release: %{_release_number}%{?dist}
Summary: Moonshot Trust Router
Group: System Environment/Libraries
Source0: %{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: krb5-devel
+BuildRequires: autoconf, automake, m4, libtool
+BuildRequires: krb5-devel, glib2-devel
BuildRequires: jansson-devel >= 2.4
-BuildRequires: sqlite-devel, openssl-devel, libtalloc-devel
-Requires: moonshot-gss-eap, sqlite
+BuildRequires: sqlite-devel, openssl-devel, libtalloc-devel, libevent-devel
+%{?el7:BuildRequires: systemd}
+Requires: moonshot-gss-eap >= 0.9.3, sqlite
%description
The trust router provides a mechanism for discovering the topology of
%prep
%setup -q
-
+autoreconf -f -i
%build
%configure --disable-static
# Install config files
install -D -m 755 redhat/init $RPM_BUILD_ROOT/%{_initrddir}/trust_router
-install -D -m 755 tids.initd $RPM_BUILD_ROOT/%{_initrddir}/tids
-install -D -m 640 redhat/trusts.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/trusts.cfg
-install -D -m 640 redhat/default-main.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/main.cfg
-install -D -m 640 redhat/tr-test-main.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/tr-test/main.cfg
+install -D -m 640 redhat/organizations.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/organizations.cfg
+install -D -m 640 redhat/default-internal.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/internal.cfg
+install -D -m 640 redhat/tr-test-internal.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/tr-test/internal.cfg
install -D -m 640 redhat/sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/trust_router
install -D -m 640 redhat/sysconfig.tids $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/tids
+install -D -m 755 redhat/tids.init $RPM_BUILD_ROOT/%{_initrddir}/tids
# Link shared config
-ln -s ../../trusts.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/trusts.cfg
-ln -s ../../trusts.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/tr-test/trusts.cfg
+ln -s ../../organizations.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/organizations.cfg
+ln -s ../../organizations.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/tr-test/organizations.cfg
# Install wrapper scripts
install -D -m 755 redhat/tidc-wrapper $RPM_BUILD_ROOT/%{_bindir}/tidc-wrapper
%pre
getent group trustrouter > /dev/null || groupadd -r trustrouter
-getent passwd trustrouter > /dev/null || useradd -r -g trustrouter -d /var/lib/trustrouter -s /sbin/nologin -c "GSS-EAP Trust Router service account" trustrouter
+getent passwd trustrouter > /dev/null || useradd -r -g trustrouter -d /var/lib/trust_router -s /sbin/nologin -c "GSS-EAP Trust Router service account" trustrouter
exit 0
%post
# Data directory
-test -d /var/lib/trust_router ||mkdir /var/lib/trust_router
-chown trustrouter:trustrouter /var/lib/trust_router
-sqlite3 </usr/share/trust_router/schema.sql /var/lib/trust_router/keys
-chown trustrouter:trustrouter /var/lib/trust_router/keys
-chmod 660 /var/lib/trust_router/keys
+tr_home=/var/lib/trust_router
+tr_schema=${tr_home}/.schema_1.5.2
+test -d ${tr_home} ||mkdir ${tr_home}
+chown trustrouter:trustrouter ${tr_home}
+test -e $tr_schema || rm -f $tr_home/keys
+sqlite3 </usr/share/trust_router/schema.sql ${tr_home}/keys
+touch $tr_schema
+chown trustrouter:trustrouter ${tr_home}/keys
+chmod 660 ${tr_home}/keys
# Log Directory
test -d /var/log/trust_router ||mkdir /var/log/trust_router
%files
%defattr(-,root,root,-)
%doc README
+#%{_bindir}/tidc
+#%{_bindir}/tidc-wrapper
+#%{_bindir}/tids
+#%{_bindir}/tids-wrapper
+#%{_bindir}/trmon
+#%{_bindir}/trust_router
+#%{_bindir}/trust_router-wrapper
%{_bindir}/*
%{_datadir}/trust_router/schema.sql
-#/lib/systemd/system/tids.service
-%{_initrddir}/trust_router
%{_initrddir}/tids
+%{_initrddir}/trust_router
+
+%{?el7:%{_unitdir}/tids.service}
-%config(noreplace) %{_sysconfdir}/sysconfig/trust_router
%config(noreplace) %{_sysconfdir}/sysconfig/tids
+%config(noreplace) %{_sysconfdir}/sysconfig/trust_router
%dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router
%dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router/conf.d/
%dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router/conf.d/default
%dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router/conf.d/tr-test
-%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/trusts.cfg
-%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/default/main.cfg
-%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/tr-test/main.cfg
-%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/default/trusts.cfg
-%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/tr-test/trusts.cfg
+%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/organizations.cfg
+%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/default/internal.cfg
+%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/tr-test/internal.cfg
+%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/default/organizations.cfg
+%attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/tr-test/organizations.cfg
%files libs
%defattr(-,root,root,-)