source: ProjectBuilder/projects/fossology/pbconf/trunk/fossology/rpm/fossology.spec@ 795

Last change on this file since 795 was 795, checked in by Bruno Cornec, 15 years ago
  • Fix ntp info for VE locally
  • Fix postgresql issue at startup by defering conf file modification. THis allows a non already installed postgresql to setup the conf correctly and then modification and restart is possible
File size: 4.3 KB
Line 
1#
2# $Id$
3#
4
5Name: PBREALPKG
6Version: PBVER
7Release: PBTAGPBSUF
8License: PBLIC
9Group: PBGRP
10Url: PBURL
11Source: PBREPO/PBSRC
12#PBPATCHSRC
13BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
14Requires: postgresql php php-pear php-pgsql libxml2 binutils bzip2 cpio mkisofs poppler-utils rpm tar unzip gzip httpd which PBDEP
15BuildRequires: postgresql-devel libxml2 gcc make perl PBBUILDDEP
16Summary: FOSSology is a licenses exploration tool
17Summary(fr): FOSSology est un outil d'exploration de licenses
18
19%package devel
20Summary: Devel part of FOSSology (a licenses exploration tool)
21Summary(fr): Partie dedévelopment de FOSSology, outil d'exploration de licenses
22Group: PBGRP
23
24%description
25PBDESC
26
27%description -l fr
28FOSSology est un outil d'exploration de licenses
29
30%description devel
31Devel part.
32PBDESC
33
34%description -l fr devel
35Partie développement de FOSSology, outil d'exploration de licenses
36
37%prep
38%setup -q
39#PBPATCHCMD
40
41%build
42make SYSCONFDIR=%{_sysconfdir} PREFIX=%{_usr} LOCALSTATEDIR=%{_var}
43#make %{?_smp_mflags} SYSCONFDIR=%{_sysconfdir}
44
45%install
46%{__rm} -rf $RPM_BUILD_ROOT
47make DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_usr} SYSCONFDIR=%{_sysconfdir} LOCALSTATEDIR=%{_var} LIBDIR=%{_libdir} install
48mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d
49cat > $RPM_BUILD_ROOT/%{_sysconfdir}/httpd/conf.d/PBPROJ.conf << EOF
50Alias /repo/ /usr/share/PBPROJ/www/
51<Directory "/usr/share/PBPROJ/www">
52 AllowOverride None
53 Options FollowSymLinks MultiViews
54 Order allow,deny
55 Allow from all
56 # uncomment to turn on php error reporting
57 #php_flag display_errors on
58 #php_value error_reporting 2039
59</Directory>
60EOF
61cp utils/fo-cleanold $RPM_BUILD_ROOT/%{_usr}/lib/PBPROJ/
62
63#rm -f $RPM_BUILD_ROOT/%{_sysconfdir}/default/PBPROJ
64
65%clean
66%{__rm} -rf $RPM_BUILD_ROOT
67
68%files
69%defattr(-,root,root)
70%doc ChangeLog
71%doc COPYING COPYING.LGPL HACKING README INSTALL INSTALL.multi LICENSE
72#AUTHORS NEWS
73%config(noreplace) %{_sysconfdir}/httpd/conf.d/*.conf
74%config(noreplace) %{_sysconfdir}/cron.d/*
75%config(noreplace) %{_sysconfdir}/PBPROJ/*
76%dir %{_sysconfdir}/PBPROJ
77%dir %{_usr}/lib/PBPROJ
78%dir %{_datadir}/PBPROJ
79%{_sysconfdir}/init.d/*
80%{_usr}/lib/PBPROJ/*
81%{_datadir}/PBPROJ/*
82%{_bindir}/*
83%{_mandir}/man1/*
84
85%files devel
86%{_includedir}/*
87%{_libdir}/*.a
88
89%post
90
91# Check postgresql is running
92LANGUAGE=C /etc/init.d/postgresql status 2>&1 | grep -q stop
93if [ $? -eq 0 ]; then
94 /etc/init.d/postgresql start
95fi
96chkconfig --add postgresql
97
98# We suppose that we use the local postgresql installed on the same machine.
99cat >> /var/lib/pgsql/data/pg_hba.conf << EOF
100# Added for FOSSology connection
101# Local connections
102local all all md5
103# IPv4 local connections:
104host all all 127.0.0.1/32 md5
105
106EOF
107# Comment previous setup
108perl -pi -e 's|(host\s+all\s+all\s+127.0.0.1/32\s+ident\s+sameuser)|#$1|' /var/lib/pgsql/data/pg_hba.conf
109perl -pi -e 's|(local\s+all\s+all\s+127.0.0.1/32\s+ident\s+sameuser)|#$1|' /var/lib/pgsql/data/pg_hba.conf
110
111# Now restart again postgresql
112# We have do it here in order to let postgresql configure itself correctly
113# in case it wasn't already installed
114/etc/init.d/postgresql restart
115
116# To avoid fossology setup to fail, leave it time to start
117sleep 3
118
119# Add apache config for fossology (described in detail in section 2.1.6) - done in install
120# Run the postinstall script
121/usr/lib/PBPROJ/fo-postinstall
122
123# Adds user httpd to fossy group
124#useradd -G fossy httpd
125perl -pi -e 's/^fossy:x:([0-9]+):(.+)/fossy:x:$1:httpd,$2/' /etc/group
126perl -pi -e 's/^fossy:x:([0-9]+):$/fossy:x:$1:httpd/' /etc/group
127
128# httpd is also assumed to run locally
129LANGUAGE=C /etc/init.d/httpd status 2>&1 | grep -q stop
130if [ $? -eq 0 ]; then
131 /etc/init.d/httpd start
132else
133 /etc/init.d/httpd reload
134fi
135chkconfig --add httpd
136
137# Create logfile to avoid issues later on
138touch %{_var}/log/PBPROJ
139# Handle logfile owner correctly
140chown fossy:fossy %{_var}/log/PBPROJ
141
142# Test that things are installed correctly
143/usr/lib/PBPROJ/fossology-scheduler -t
144if [ $? -ne 0 ]; then
145 exit -1
146fi
147
148chkconfig --add PBPROJ
149/etc/init.d/PBPROJ start
150
151%preun
152# If FOSSology is running, stop it before removing.
153/etc/init.d/PBPROJ stop
154chkconfig --del PBPROJ 2>&1 > /dev/null
155
156# We should do some cleanup here (fossy account ...)
157/usr/lib/PBPROJ/fo-cleanold
158
159%changelog
160PBLOG
Note: See TracBrowser for help on using the repository browser.