File phpvirtualbox.spec of Package phpvirtualbox

#
# spec file for package phpvirtualbox (Version 4.3-0)
#

%define apxs %{_sbindir}/apxs2
%define ap_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define ap_serverroot %(%{apxs} -q PREFIX)
%define ap_docroot %(%{apxs} -q PREFIX)/htdocs
%define pvb_config %{_sysconfdir}/%{name}/config.php
%if 0%{?suse_version}
%define ap_usr wwwrun
%define ap_grp www
%else
%define ap_usr nobody
%define ap_grp nogroup
%endif

%define subversionnr 1

Name:         phpvirtualbox
License:      GPL-3.0+ 
Group:        Productivity/Networking/Web/Frontends
Autoreqprov:  on
Version:      4.3
Release:      1
Summary:      A web interface for VirtualBox
URL:          http://sourceforge.net/projects/phpvirtualbox/ 
Source:       %{name}-%{version}-%{subversionnr}.tar.bz2
Source1:      README.SUSE
BuildRoot:    %{_tmppath}/%{name}-%{version}-%{subversionnr}
PreReq:         coreutils
BuildRequires:	apache2-devel
BuildRequires:  coreutils
BuildRequires:  tar
BuildRequires:  bzip2
BuildRequires:  fdupes
BuildRequires:  gettext
Requires:     mod_php_any php-soap php-gettext php-openssl php-xml php-pcre php-session
BuildArch:    noarch

%description
an open source, AJAX implementation of the VirtualBox user interface written in PHP. As a modern web interface, it allows you to access and control remote VirtualBox instances. Much of its verbage and some of its code is based on the (inactive) vboxweb project. phpVirtualBox was designed to allow users to administer VirtualBox in a headless environment - mirroring the VirtualBox GUI through its web interface.

phpVirtualBox:

-    is designed to be a web interface replacement of the VirtualBox GUI program
-    is not designed to run in a "hosting" environment where the concept of VM ownership is required - when you are logged in to phpVirtualBox, you have full control over all VMs in the VirtualBox installation
-    aims to perform all VirtualBox administration actions through vboxwebsrv (a SOAP server distributed with VirtualBox)
-    does not directly interact with any files on the VirtualBox host
-    does not have automatic VM start / stop functionality on system boot / shutdown - this functionality is not provided by the VirtualBox API 

%prep
%setup -qn %{name}-%{version}-%{subversionnr}
find . -type d -exec chmod 755 {} +
find . -type f -exec chmod 644 {} +
find . -type f -name '*.txt' -exec perl -pi -e 's/\r\n/\n/' {} + 


%build

%install
install -d -m 0755 $RPM_BUILD_ROOT%{ap_docroot}/%{name}
install -d -m 0755 $RPM_BUILD_ROOT%{_sysconfdir}/%{name}
cp -dR *.php *.html js css images languages lib panes rdpweb $RPM_BUILD_ROOT%{ap_docroot}/%{name}
install -m 0644 config.php-example $RPM_BUILD_ROOT%{pvb_config}
ln -sf  %{pvb_config} $RPM_BUILD_ROOT%{ap_docroot}/%{name}/config.php
install -m 0644 recovery.php-disabled $RPM_BUILD_ROOT%{ap_docroot}/%{name}/recovery.php-disabled
install -Dm 0644 %{S:1} $RPM_BUILD_ROOT%{_defaultdocdir}/README.SUSE
# generate file list
find $RPM_BUILD_ROOT%{ap_docroot}/%{name} -mindepth 1 -maxdepth 1 -type d | sed -e "s|$RPM_BUILD_ROOT||" > FILELIST
find $RPM_BUILD_ROOT%{ap_docroot}/%{name} -maxdepth 1 -type f | grep -v 'config.php' | sed -e "s|$RPM_BUILD_ROOT||" >> FILELIST

%clean
rm -rf $RPM_BUILD_ROOT

%files -f FILELIST
%defattr(-,root,root)
%doc CHANGELOG.txt GPLv3.txt LICENSE.txt README.txt 
%doc %{_defaultdocdir}/README.SUSE
%dir %{ap_docroot}/%{name}
%config %{ap_docroot}/%{name}/config.php
%dir %attr(0750,root,%{ap_grp}) %{_sysconfdir}/%{name}
%config (noreplace) %{pvb_config}

%changelog

openSUSE Build Service is sponsored by