Update trust_router.spec, fix version in configure.ac
[trust_router.git] / trust_router.spec
1 %global optflags %{optflags} -Wno-parentheses
2 Name:           trust_router
3 Version:        2.0.0
4 Release:        1%{?dist}
5 Summary:        Moonshot Trust Router
6
7 Group:          System Environment/Libraries
8 License:        BSD
9 URL:            http://www.project-moonshot.org/
10 Source0:        %{name}-%{version}.tar.gz
11 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
12
13 BuildRequires:  krb5-devel, glib2-devel
14 BuildRequires: jansson-devel >= 2.4
15 BuildRequires: sqlite-devel, openssl-devel, libtalloc-devel, libevent-devel
16 %{?el7:BuildRequires: systemd}
17 Requires:       moonshot-gss-eap >= 0.9.3, sqlite
18
19 %description
20 The trust router provides a mechanism for discovering the topology of
21 trust graphs in a topology and establishing temporary identities
22 between them.
23
24
25 %package        devel
26 Summary:        Development files for %{name}
27 Group:          Development/Libraries
28 Requires:       %{name}-libs = %{version}-%{release}
29
30 %description    devel
31 The %{name}-devel package contains libraries and header files for
32 developing applications that use %{name}-libs.
33
34 %package libs
35 Summary: Libraries needed by %{Name}
36
37 %description libs
38 This package includes libraries needed by the %{Name} package or
39 packages that wish trust_router functionality.
40
41
42
43
44 %prep
45 %setup -q
46 autoreconf -f -i
47
48 %build
49 %configure --disable-static
50 make %{?_smp_mflags}
51
52
53 %install
54 rm -rf $RPM_BUILD_ROOT
55 make install DESTDIR=$RPM_BUILD_ROOT
56 find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
57
58 # Install config files
59 install -D -m 755 redhat/init $RPM_BUILD_ROOT/%{_initrddir}/trust_router
60 install -D -m 640 redhat/trusts.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/trusts.cfg
61 install -D -m 640 redhat/default-main.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/main.cfg
62 install -D -m 640 redhat/tr-test-main.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/tr-test/main.cfg
63 install -D -m 640 redhat/sysconfig $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/trust_router
64 install -D -m 640 redhat/sysconfig.tids $RPM_BUILD_ROOT/%{_sysconfdir}/sysconfig/tids
65 install -D -m 755 redhat/tids.init $RPM_BUILD_ROOT/%{_initrddir}/tids
66
67 # Link shared config
68 ln -s ../../trusts.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/default/trusts.cfg
69 ln -s ../../trusts.cfg $RPM_BUILD_ROOT/%{_sysconfdir}/trust_router/conf.d/tr-test/trusts.cfg
70
71 # Install wrapper scripts
72 install -D -m 755 redhat/tidc-wrapper $RPM_BUILD_ROOT/%{_bindir}/tidc-wrapper
73 install -D -m 755 redhat/tids-wrapper $RPM_BUILD_ROOT/%{_bindir}/tids-wrapper
74 install -D -m 755 redhat/trust_router-wrapper $RPM_BUILD_ROOT/%{_bindir}/trust_router-wrapper
75
76 # As we're building an RPM, we don't need the init scripts etc. in /usr/share
77 rm -rf $RPM_BUILD_ROOT/%{_datadir}/trust_router/redhat
78
79
80 %clean
81 rm -rf $RPM_BUILD_ROOT
82
83
84 %pre
85 getent group trustrouter > /dev/null || groupadd -r trustrouter
86 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
87 exit 0
88
89
90 %post libs -p /sbin/ldconfig
91
92 %postun libs -p /sbin/ldconfig
93
94 %post
95 # Data directory
96 tr_home=/var/lib/trust_router
97 tr_schema=${tr_home}/.schema_1.5.2
98 test -d ${tr_home} ||mkdir ${tr_home}
99 chown trustrouter:trustrouter ${tr_home}
100 test -e $tr_schema || rm -f $tr_home/keys
101 sqlite3 </usr/share/trust_router/schema.sql ${tr_home}/keys
102 touch $tr_schema
103 chown trustrouter:trustrouter ${tr_home}/keys
104 chmod 660 ${tr_home}/keys
105
106 # Log Directory
107 test -d /var/log/trust_router ||mkdir /var/log/trust_router
108 chown root:trustrouter /var/log/trust_router
109 chmod 770 /var/log/trust_router
110
111
112
113 %files
114 %defattr(-,root,root,-)
115 %doc README
116 #%{_bindir}/tidc
117 #%{_bindir}/tidc-wrapper
118 #%{_bindir}/tids
119 #%{_bindir}/tids-wrapper
120 #%{_bindir}/trust_router
121 #%{_bindir}/trust_router-wrapper
122 %{_bindir}/*
123 %{_datadir}/trust_router/schema.sql
124
125 %{_initrddir}/tids
126 %{_initrddir}/trust_router
127
128 %{?el7:%{_unitdir}/tids.service}
129
130 %config(noreplace) %{_sysconfdir}/sysconfig/tids
131 %config(noreplace) %{_sysconfdir}/sysconfig/trust_router
132
133 %dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router
134 %dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router/conf.d/
135 %dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router/conf.d/default
136 %dir %attr(755,root,trustrouter) %{_sysconfdir}/trust_router/conf.d/tr-test
137
138 %attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/trusts.cfg
139 %attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/default/main.cfg
140 %attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/tr-test/main.cfg
141 %attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/default/trusts.cfg
142 %attr(640,root,trustrouter) %config(noreplace) %{_sysconfdir}/trust_router/conf.d/tr-test/trusts.cfg
143
144 %files libs
145 %defattr(-,root,root,-)
146 %{_libdir}/*.so.*
147
148 %files devel
149 %defattr(-,root,root,-)
150 %{_includedir}/*
151 %{_libdir}/*.so