summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsiddall <rsiddall>2009-01-01 20:10:24 +0000
committerrsiddall <rsiddall>2009-01-01 20:10:24 +0000
commitcad7c73d70361a99ef6a173aa506e303303d26a4 (patch)
tree0f9e3a0bcbd619fbdb842f5aed0b4e5f4fafb40c
parentec2059f7847d99e9218d97df988c8d68c7afcf55 (diff)
Modifications to let self-service work if you really insist on installing it
on the same machine as the billing server. Also more fixes for SuSE, and a couple of changes to minimize differences from the 1.7 branch.
-rw-r--r--rpm/freeside.spec79
1 files changed, 49 insertions, 30 deletions
diff --git a/rpm/freeside.spec b/rpm/freeside.spec
index 4a65c3e22..d2cd4e13c 100644
--- a/rpm/freeside.spec
+++ b/rpm/freeside.spec
@@ -1,6 +1,6 @@
%{!?_initrddir:%define _initrddir /etc/rc.d/init.d}
%{!?version:%define version 1.9}
-%{!?release:%define release 4}
+%{!?release:%define release 5}
Summary: Freeside ISP Billing System
Name: freeside
@@ -27,13 +27,16 @@ Requires: perl-Fax-Hylafax-Client
%define apache_confdir /etc/httpd/conf.d
%define apache_version 2
%define freeside_document_root /var/www/freeside
+%define freeside_selfservice_document_root /var/www/freeside-selfservice
%else
%define apache_conffile /etc/apache2/uid.conf
%define apache_confdir /etc/apache2/conf.d
%define apache_version 2
%define freeside_document_root /srv/www/freeside
+%define freeside_selfservice_document_root /srv/www/freeside-selfservice
%endif
-%define freeside_cache /var/cache/subsys/freeside
+# Can change this back to /var/cache/subsys/freeside when cache relocation is fixed and released
+%define freeside_cache /etc/freeside
%define freeside_conf /etc/freeside
%define freeside_export /etc/freeside
%define freeside_lock /var/lock/freeside
@@ -46,6 +49,7 @@ Requires: perl-Fax-Hylafax-Client
%define db_types Pg mysql
%define _rpmlibdir /usr/lib/rpm
+%define rpmfiles rpm
%description
Freeside is a flexible ISP billing system written by Ivan Kohler
@@ -118,7 +122,7 @@ Summary: CGI scripts for the self-service interface for %{name}
Group: Applications/Internet
Conflicts: %{name}
Requires: %{name}-selfservice-core
-Prefix: %{freeside_document_root}/selfservice
+Prefix: %{freeside_selfservice_document_root}
%description selfservice-cgi
This package installs the CGI scripts for the self-service interface for %{name}. The scripts use some core libraries packaged in a separate RPM.
@@ -128,7 +132,7 @@ For security reasons, it is set to conflict with %{name} as you should not insta
Summary: Sample PHP files for the self-service interface for %{name}
Group: Applications/Internet
Conflicts: %{name}
-Prefix: %{freeside_document_root}/selfservice
+Prefix: %{freeside_selfservice_document_root}
%description selfservice-php
This package installs the sample PHP scripts for the self-service interface for %{name}.
@@ -138,7 +142,8 @@ For security reasons, it is set to conflict with %{name} as you should not insta
%setup -q
%{__rm} bin/pod2x # Only useful to Ivan Kohler now
perl -pi -e 's|/usr/local/bin|%{_bindir}|g' FS/Makefile.PL
-perl -pi -e 's|\s+-o\s+freeside\s+| |g' Makefile
+# RPM handles changing file ownership, so Makefile shouldn't
+perl -pi -e 's/\s+-o\s+(freeside|root)(\s+-g\s+\$\{\w+\})?\s+/ /g' Makefile
perl -ni -e 'print if !/\s+chown\s+/;' Makefile
# Fix-ups for self-service. Should merge this into Makefile
@@ -229,21 +234,14 @@ touch docs
# Install the init script
%{__mkdir_p} $RPM_BUILD_ROOT%{_initrddir}
-%{__install} init.d/freeside-init $RPM_BUILD_ROOT%{_initrddir}/%{name}
-#%{__make} install-init INSTALLGROUP=root INIT_FILE=$RPM_BUILD_ROOT%{_initrddir}/%{name}
+%{__make} install-init INSTALLGROUP=root INIT_FILE=$RPM_BUILD_ROOT%{_initrddir}/%{name} QUEUED_USER=%{fs_queue_user} SELFSERVICE_USER=%{fs_selfservice_user} SELFSERVICE_MACHINES= INIT_INSTALL=
%{__perl} -pi -e "\
- s/%%%%%%QUEUED_USER%%%%%%/%{fs_queue_user}/g;\
- s/%%%%%%SELFSERVICE_USER%%%%%%/%{fs_selfservice_user}/g;\
- s/%%%%%%SELFSERVICE_MACHINES%%%%%%//g;\
s|/etc/default|/etc/sysconfig|g;\
" $RPM_BUILD_ROOT%{_initrddir}/%{name}
# Install the HTTPD configuration snippet for HTML::Mason
%{__mkdir_p} $RPM_BUILD_ROOT%{apache_confdir}
%{__make} install-apache FREESIDE_DOCUMENT_ROOT=%{freeside_document_root} RT_ENABLED=%{rt_enabled} APACHE_CONF=$RPM_BUILD_ROOT%{apache_confdir} APACHE_VERSION=%{apache_version} FREESIDE_CONF=%{freeside_conf} MASON_HANDLER=%{freeside_conf}/handler.pl
-%{__perl} -pi -e "s|%%%%%%FREESIDE_DOCUMENT_ROOT%%%%%%|%{freeside_document_root}|g" $RPM_BUILD_ROOT%{apache_confdir}/freeside-*.conf
-%{__perl} -pi -e "s|%%%%%%MASON_HANDLER%%%%%%|%{freeside_conf}/handler.pl|g" $RPM_BUILD_ROOT%{apache_confdir}/freeside-*.conf
-%{__perl} -pi -e "s|/usr/local/etc/freeside|%{freeside_conf}|g" $RPM_BUILD_ROOT%{apache_confdir}/freeside-*.conf
%{__perl} -pi -e 'print "Alias /%{name} %{freeside_document_root}\n\n" if /^<Directory/;' $RPM_BUILD_ROOT%{apache_confdir}/freeside-*.conf
%{__perl} -pi -e 'print "SSLRequireSSL\n" if /^AuthName/i;' $RPM_BUILD_ROOT%{apache_confdir}/freeside-*.conf
@@ -278,19 +276,19 @@ fi
%{__install} bin/* $RPM_BUILD_ROOT%{_datadir}/%{name}-%{version}/bin
%{__mkdir_p} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
-%{__install} rpm/freeside.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
-
-%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_document_root}/selfservice
-%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/cgi
-%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/cgi/images
-%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/cgi/misc
-%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/php
-%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/templates
-%{__install} fs_selfservice/FS-SelfService/cgi/{*.cgi,*.html,*.gif} $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/cgi
-%{__install} fs_selfservice/FS-SelfService/cgi/images/* $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/cgi/images
-%{__install} fs_selfservice/FS-SelfService/cgi/misc/* $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/cgi/misc
-%{__install} fs_selfservice/php/* $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/php
-%{__install} fs_selfservice/FS-SelfService/*.template $RPM_BUILD_ROOT%{freeside_document_root}/selfservice/templates
+%{__install} %{rpmfiles}/freeside.sysconfig $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
+
+%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}
+%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi
+%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/images
+%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/misc
+%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/php
+%{__mkdir_p} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/templates
+%{__install} fs_selfservice/FS-SelfService/cgi/{*.cgi,*.html,*.gif} $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi
+%{__install} fs_selfservice/FS-SelfService/cgi/images/* $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/images
+%{__install} fs_selfservice/FS-SelfService/cgi/misc/* $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/cgi/misc
+%{__install} fs_selfservice/php/* $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/php
+%{__install} fs_selfservice/FS-SelfService/*.template $RPM_BUILD_ROOT%{freeside_selfservice_document_root}/templates
# Install the main billing server Perl files
cd FS
@@ -314,7 +312,7 @@ cd ..
# Install the self-service interface Perl files
cd fs_selfservice/FS-SelfService
%{__mkdir_p} $RPM_BUILD_ROOT%{_prefix}/local/bin
-%makeinstall PREFIX=$RPM_BUILD_ROOT%{_prefix}
+%makeinstall
%{__rm} -f `find $RPM_BUILD_ROOT -type f -name perllocal.pod -o -name .packlist`
[ -x %{_rpmlibdir}/brp-compress ] && %{_rpmlibdir}/brp-compress
@@ -330,6 +328,10 @@ if [ "$(cat %{name}-%{version}-%{release}-selfservice-core-filelist)X" = "X" ] ;
fi
cd ../..
+# Install the Apache configuration file for self-service
+%{__install} %{rpmfiles}/freeside-selfservice.conf $RPM_BUILD_ROOT%{apache_confdir}/%{name}-selfservice.conf
+%{__perl} -pi -e "s|%%%%%%FREESIDE_SELFSERVICE_DOCUMENT_ROOT%%%%%%|%{freeside_selfservice_document_root}|g" $RPM_BUILD_ROOT%{apache_confdir}/%{name}-selfservice.conf
+
%pre
if ! %{__id} freeside &>/dev/null; then
/usr/sbin/useradd freeside
@@ -376,8 +378,21 @@ fi
%post mason
# Make local httpd run with User/Group = freeside
if [ -f %{apache_conffile} ]; then
+%if "%{_vendor}" != "suse"
perl -p -i.fsbackup -e 's/^(User|Group) .*/$1 freeside/' %{apache_conffile}
+%else
+ perl -p -i.fsbackup -e 's/^(User) .*/$1 freeside/' %{apache_conffile}
+%endif
fi
+# Fix up environment so pslatex will run
+%if "%{_vendor}" == "suse"
+if ! %{__grep} TEXINPUTS /etc/profile.local >/dev/null; then
+ echo "unset TEXINPUTS" >>/etc/profile.local
+fi
+if ! %{__grep} TEXINPUTS /etc/init.d/apache2 >/dev/null; then
+ perl -p -i.fsbackup -e 'print "unset TEXINPUTS\n\n" if /^httpd_conf\s*=\s*/;' /etc/init.d/apache2
+fi
+%endif
%clean
%{__rm} -rf %{buildroot}
@@ -403,6 +418,7 @@ fi
%files selfservice
%defattr(-, freeside, freeside, 0644)
+%attr(0644,root,root) %config(noreplace) %{apache_confdir}/%{name}-selfservice.conf
%files selfservice-core -f fs_selfservice/FS-SelfService/%{name}-%{version}-%{release}-selfservice-core-filelist
%defattr(-, freeside, freeside, 0644)
@@ -412,14 +428,17 @@ fi
%files selfservice-cgi
%defattr(-, freeside, freeside, 0644)
-%attr(0711,freeside,freeside) %{freeside_document_root}/selfservice/cgi
-%attr(0644,freeside,freeside) %{freeside_document_root}/selfservice/templates
+%attr(0711,freeside,freeside) %{freeside_selfservice_document_root}/cgi
+%attr(0644,freeside,freeside) %{freeside_selfservice_document_root}/templates
%files selfservice-php
%defattr(-, freeside, freeside, 0644)
-%attr(0755,freeside,freeside) %{freeside_document_root}/selfservice/php
+%attr(0755,freeside,freeside) %{freeside_selfservice_document_root}/php
%changelog
+* Mon Dec 22 2008 Richard Siddall <richard.siddall@elirion.net> - 1.9-5
+- Modifications to make self-service work if you really insist on installing it on the same machine as Freeside
+
* Tue Dec 9 2008 Richard Siddall <richard.siddall@elirion.net> - 1.9-4
- Cleaning up after rpmlint