commit:     ee05fd6e5dabc192452af2f91ba49c2797d29115
Author:     Marc Schiffbauer <mschiff <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  5 14:51:29 2023 +0000
Commit:     Marc Schiffbauer <mschiff <AT> gentoo <DOT> org>
CommitDate: Tue Dec  5 14:52:19 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee05fd6e

www-apps/bareos-webui: new package, add 22.1.0, 9999

Closes: https://bugs.gentoo.org/724390
Signed-off-by: Marc Schiffbauer <mschiff <AT> gentoo.org>

 www-apps/bareos-webui/Manifest                   |   1 +
 www-apps/bareos-webui/bareos-webui-22.1.0.ebuild | 110 +++++++++++++++++++++++
 www-apps/bareos-webui/bareos-webui-9999.ebuild   | 110 +++++++++++++++++++++++
 www-apps/bareos-webui/files/apache.conf          |  50 +++++++++++
 www-apps/bareos-webui/files/nginx.include        |  17 ++++
 www-apps/bareos-webui/files/postinstall-en.txt   |  36 ++++++++
 www-apps/bareos-webui/metadata.xml               |  11 +++
 7 files changed, 335 insertions(+)

diff --git a/www-apps/bareos-webui/Manifest b/www-apps/bareos-webui/Manifest
new file mode 100644
index 000000000000..ede21f58a067
--- /dev/null
+++ b/www-apps/bareos-webui/Manifest
@@ -0,0 +1 @@
+DIST bareos-22.1.0.tar.gz 14719993 BLAKE2B 
38e354d3227d401c69ffb003c83ae90c2067720490af089d529da636bc300e2fb5042451ab439b8b102f6850aeadbe8dedc4311dba13f800eab0bc77d89f809d
 SHA512 
dea64c6eb34a93f1a93eb6b0ac628a75101ac8873e06800a256f226e8f3a556fe39ce4e500246f9c51de30a2b0907732f789c6394f29b7bb9d983a64c709ad2c

diff --git a/www-apps/bareos-webui/bareos-webui-22.1.0.ebuild 
b/www-apps/bareos-webui/bareos-webui-22.1.0.ebuild
new file mode 100644
index 000000000000..3fa8560579d8
--- /dev/null
+++ b/www-apps/bareos-webui/bareos-webui-22.1.0.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CMAKE_WARN_UNUSED_CLI=no
+CMAKE_MAKEFILE_GENERATOR="emake"
+
+MY_PV=${PV/_/-}
+MY_PN="bareos"
+MY_P="${MY_PN}-${MY_PV}"
+
+if [[ ${PV} == 9999 ]]; then
+       inherit cmake webapp git-r3
+       S=${WORKDIR}/${PF}/webui
+       SRC_URI=""
+       EGIT_REPO_URI="https://github.com/${MY_PN}/${MY_PN}.git";
+       KEYWORDS=""
+else
+       inherit cmake webapp
+       S=${WORKDIR}/${MY_PN}-Release-${PV}/webui
+       
SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/Release/${MY_PV}.tar.gz 
-> ${MY_P}.tar.gz"
+       KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="Featureful client/server network backup suite"
+HOMEPAGE="https://www.bareos.org/";
+RESTRICT="mirror"
+
+LICENSE="AGPL-3"
+
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}
+       
dev-lang/php[bzip2,ctype,curl,fileinfo,filter,fpm,gd,iconv,intl,mhash,nls,pdo,postgres,session,simplexml,ssl,xml,xmlreader,xmlwriter,zip]
+       virtual/httpd-php
+"
+
+need_httpd
+
+pkg_setup() {
+       webapp_pkg_setup
+}
+
+src_prepare() {
+       # fix missing VERSION
+       sed -i "s/@BAREOS_FULL_VERSION@/${PV}/g" version.php.in || die
+
+       cmake_src_prepare
+       default
+}
+
+src_configure() {
+       if [[ ${PV} == 9999 ]]; then
+               pushd "${WORKDIR}/${PF}"
+       else
+               pushd "${S}"/..
+       fi
+       CURRENT_VERSION=$(echo $(cmake -P get_version.cmake) | sed 's/[- ]//g')
+       popd
+       local mycmakeargs=(
+               -DVERSION_STRING=${CURRENT_VERSION}
+               -Wno-dev
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       webapp_src_preinst
+
+       dodoc README.md doc/README-TRANSLATION.md
+
+       dodir /etc/bareos/bareos-dir.d
+       cp -r install/bareos/bareos-dir.d/* "${D}"/etc/bareos/bareos-dir.d
+
+       webapp_server_configfile nginx "${FILESDIR}"/nginx.include
+       webapp_server_configfile apache "${FILESDIR}"/apache.conf
+
+       insinto /etc/"${PN}"
+       doins install/{configuration,directors}.ini
+
+       insinto "${MY_HTDOCSDIR#${EPREFIX}}"
+       doins -r .
+
+       webapp_configfile 
"${MY_HTDOCSDIR#${EPREFIX}}"/config/application.config.php
+       webapp_configfile 
"${MY_HTDOCSDIR#${EPREFIX}}"/config/autoload/global.php
+
+       keepdir "${MY_HTDOCSDIR#${EPREFIX}}"/data
+       webapp_serverowned "${MY_HTDOCSDIR#${EPREFIX}}"/data
+
+       # cleanup
+       find  "${D}/${MY_HTDOCSDIR#${EPREFIX}}" -name "*.in" -delete
+       rm -rf 
"${D}/${MY_HTDOCSDIR#${EPREFIX}}"/{CMakeLists.txt,install,cmake,phpunit.xml,scripts,doc,tests}
+
+       webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
+
+       webapp_src_install
+}
+
+pkg_postinst() {
+       einfo ""
+       einfo "The webui uses 'webapp-config' to be installed to the webservers 
docroot"
+       einfo "E.g. to install webapp-config may be called like so:"
+       einfo ""
+       einfo "  ~# webapp-config -h localhost -d bareos-webui -I bareos-webui 
${PV}"
+       einfo ""
+       einfo "See 'man webapp-config' for details."
+       einfo ""
+}

diff --git a/www-apps/bareos-webui/bareos-webui-9999.ebuild 
b/www-apps/bareos-webui/bareos-webui-9999.ebuild
new file mode 100644
index 000000000000..3fa8560579d8
--- /dev/null
+++ b/www-apps/bareos-webui/bareos-webui-9999.ebuild
@@ -0,0 +1,110 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+CMAKE_WARN_UNUSED_CLI=no
+CMAKE_MAKEFILE_GENERATOR="emake"
+
+MY_PV=${PV/_/-}
+MY_PN="bareos"
+MY_P="${MY_PN}-${MY_PV}"
+
+if [[ ${PV} == 9999 ]]; then
+       inherit cmake webapp git-r3
+       S=${WORKDIR}/${PF}/webui
+       SRC_URI=""
+       EGIT_REPO_URI="https://github.com/${MY_PN}/${MY_PN}.git";
+       KEYWORDS=""
+else
+       inherit cmake webapp
+       S=${WORKDIR}/${MY_PN}-Release-${PV}/webui
+       
SRC_URI="https://github.com/${MY_PN}/${MY_PN}/archive/Release/${MY_PV}.tar.gz 
-> ${MY_P}.tar.gz"
+       KEYWORDS="~amd64 ~x86"
+fi
+
+DESCRIPTION="Featureful client/server network backup suite"
+HOMEPAGE="https://www.bareos.org/";
+RESTRICT="mirror"
+
+LICENSE="AGPL-3"
+
+IUSE=""
+
+DEPEND=""
+RDEPEND="${DEPEND}
+       
dev-lang/php[bzip2,ctype,curl,fileinfo,filter,fpm,gd,iconv,intl,mhash,nls,pdo,postgres,session,simplexml,ssl,xml,xmlreader,xmlwriter,zip]
+       virtual/httpd-php
+"
+
+need_httpd
+
+pkg_setup() {
+       webapp_pkg_setup
+}
+
+src_prepare() {
+       # fix missing VERSION
+       sed -i "s/@BAREOS_FULL_VERSION@/${PV}/g" version.php.in || die
+
+       cmake_src_prepare
+       default
+}
+
+src_configure() {
+       if [[ ${PV} == 9999 ]]; then
+               pushd "${WORKDIR}/${PF}"
+       else
+               pushd "${S}"/..
+       fi
+       CURRENT_VERSION=$(echo $(cmake -P get_version.cmake) | sed 's/[- ]//g')
+       popd
+       local mycmakeargs=(
+               -DVERSION_STRING=${CURRENT_VERSION}
+               -Wno-dev
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       webapp_src_preinst
+
+       dodoc README.md doc/README-TRANSLATION.md
+
+       dodir /etc/bareos/bareos-dir.d
+       cp -r install/bareos/bareos-dir.d/* "${D}"/etc/bareos/bareos-dir.d
+
+       webapp_server_configfile nginx "${FILESDIR}"/nginx.include
+       webapp_server_configfile apache "${FILESDIR}"/apache.conf
+
+       insinto /etc/"${PN}"
+       doins install/{configuration,directors}.ini
+
+       insinto "${MY_HTDOCSDIR#${EPREFIX}}"
+       doins -r .
+
+       webapp_configfile 
"${MY_HTDOCSDIR#${EPREFIX}}"/config/application.config.php
+       webapp_configfile 
"${MY_HTDOCSDIR#${EPREFIX}}"/config/autoload/global.php
+
+       keepdir "${MY_HTDOCSDIR#${EPREFIX}}"/data
+       webapp_serverowned "${MY_HTDOCSDIR#${EPREFIX}}"/data
+
+       # cleanup
+       find  "${D}/${MY_HTDOCSDIR#${EPREFIX}}" -name "*.in" -delete
+       rm -rf 
"${D}/${MY_HTDOCSDIR#${EPREFIX}}"/{CMakeLists.txt,install,cmake,phpunit.xml,scripts,doc,tests}
+
+       webapp_postinst_txt en "${FILESDIR}"/postinstall-en.txt
+
+       webapp_src_install
+}
+
+pkg_postinst() {
+       einfo ""
+       einfo "The webui uses 'webapp-config' to be installed to the webservers 
docroot"
+       einfo "E.g. to install webapp-config may be called like so:"
+       einfo ""
+       einfo "  ~# webapp-config -h localhost -d bareos-webui -I bareos-webui 
${PV}"
+       einfo ""
+       einfo "See 'man webapp-config' for details."
+       einfo ""
+}

diff --git a/www-apps/bareos-webui/files/apache.conf 
b/www-apps/bareos-webui/files/apache.conf
new file mode 100644
index 000000000000..60eea6e12fd0
--- /dev/null
+++ b/www-apps/bareos-webui/files/apache.conf
@@ -0,0 +1,50 @@
+#
+# Bareos WebUI Apache configuration file
+#
+
+# Environment Variable for Application Debugging
+# Set to "development" to turn on debugging mode or
+# "production" to turn off debugging mode.
+<IfModule env_module>
+       SetEnv "APPLICATION_ENV" "production"
+</IfModule>
+
+Alias /bareos-webui /var/www/localhost/htdocs/bareos-webui/public
+
+<Directory /var/www/localhost/htdocs/bareos-webui>
+
+       Options FollowSymLinks
+       AllowOverride None
+
+       <IfModule mod_authz_core.c>
+               <IfModule mod_access_compat.c>
+                   Order deny,allow
+               </IfModule>
+               Require all granted
+       </IfModule>
+
+       #<IfModule mod_rewrite.c>
+       <IfModule rewrite_module>
+               RewriteEngine on
+               RewriteBase /bareos-webui
+               RewriteCond %{REQUEST_FILENAME} -s [OR]
+               RewriteCond %{REQUEST_FILENAME} -l [OR]
+               RewriteCond %{REQUEST_FILENAME} -d
+               RewriteRule ^.*$ - [NC,L]
+               RewriteRule ^.*$ index.php [NC,L]
+       </IfModule>
+
+       <IfDefine PROXY>
+               <FilesMatch "\.php$">
+                       SetHandler 
"proxy:unix:/var/run/php-fpm/www.sock|fcgi://localhost"
+               </FilesMatch>
+
+               # Set it to handle the files
+               <IfModule mime_module>
+                       AddHandler application/x-httpd-php .php .php5 .phtml
+                       AddHandler application/x-httpd-php-source .phps
+               </IfModule>
+
+               DirectoryIndex index.php index.phtml
+       </IfDefine>
+</Directory>

diff --git a/www-apps/bareos-webui/files/nginx.include 
b/www-apps/bareos-webui/files/nginx.include
new file mode 100644
index 000000000000..2d6ab2978ba1
--- /dev/null
+++ b/www-apps/bareos-webui/files/nginx.include
@@ -0,0 +1,17 @@
+server {
+
+       listen          9100;
+       server_name     bareos;
+       root            /var/www/localhost/htdocs/bareos-webui/public;
+
+       location / {
+               index index.php;
+               try_files $uri $uri/ /index.php?$query_string;
+       }
+
+       location ~ .php$ {
+               snippets/fastcgi-php.conf
+               fastcgi_pass unix:/var/run/php5-fpm.sock;
+               fastcgi_param APPLICATION_ENV production;
+       }
+}

diff --git a/www-apps/bareos-webui/files/postinstall-en.txt 
b/www-apps/bareos-webui/files/postinstall-en.txt
new file mode 100644
index 000000000000..cd8b10f3b530
--- /dev/null
+++ b/www-apps/bareos-webui/files/postinstall-en.txt
@@ -0,0 +1,36 @@
+1. Edit webui ini files
+
+  - if your bareos-dir is not running on localhost you need
+    to edit /etc/bareos-webui/directors.ini
+
+  - maybe you want to edit the webui settings in
+    /etc/bareos-webui/configuration.ini
+
+  NOTE: If you want to run more than one instance of bareos-webui and
+        you need to use different ini-files per vhost you can set
+        BAREOS_WEBUI_CONFDIR in the webserver env to point to another
+        directory than /etc/bareos-webui.
+
+2. Edit bareos-dir configuration
+
+  - some required bareos-dir config snippets have been installed
+    to /etc/bareos/bareos-dir.d. You need at least to 
+    cp /etc/bareos/bareos-dir.d/console/admin.conf{.example,}
+    and edit /etc/bareos/bareos-dir.d/console/admin.conf to set
+    login credentials for webui login
+
+  - don't forget to reload bareos-dir
+
+3. Edit webserver configuration
+
+  - starting from bareos 23, using php-fpm is a requirement
+    so be sure to have a working php-fpm setup
+
+  - as a starting point you may include a config from
+    /usr/share/webapps/${PN}/${PVR}/conf
+
+  - IMPORTANT: make sure the docroot of your webserver points to
+    the public/ folder within webapp htdocs directory
+
+For more details about how to setup the bareos webui, see:
+https://docs.bareos.org/IntroductionAndTutorial/InstallingBareosWebui.html

diff --git a/www-apps/bareos-webui/metadata.xml 
b/www-apps/bareos-webui/metadata.xml
new file mode 100644
index 000000000000..4a5a7ed6d64f
--- /dev/null
+++ b/www-apps/bareos-webui/metadata.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM 'http://www.gentoo.org/dtd/metadata.dtd'>
+<pkgmetadata>
+       <maintainer type="person">
+               <email>msch...@gentoo.org</email>
+               <name>Marc Schiffbauer</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">bareos/bareos</remote-id>
+       </upstream>
+</pkgmetadata>

Reply via email to