Skip to content
Snippets Groups Projects
Commit 80e5e28d authored by Simon F's avatar Simon F Committed by Francesco Colista
Browse files

community/bareos: Upgrade to 18.2.6

parent efabab84
No related branches found
No related tags found
No related merge requests found
# Contributor: Pedro Filipe <xpecex@outlook.com>
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
_php=php7
pkgname=bareos-webui
pkgver=17.2.5
pkgrel=0
pkgdesc="Bareos Web User Interface"
url="http://www.bareos.org/en/bareos-webui.html"
arch="noarch"
options="!check"
license="AGPL-3.0"
depends="$_php-bz2 $_php-ctype $_php-curl $_php-dom $_php-fileinfo $_php-gettext $_php-gd
$_php-iconv $_php-intl $_php-json $_php-mbstring $_php-openssl $_php-session
$_php-simplexml $_php-xml $_php-xmlreader $_php-xmlwriter $_php-zip
"
makedepends="apache2-dev findutils gettext"
subpackages="$pkgname-apache2 $pkgname-nginx"
source="$pkgname-$pkgver.tar.gz::https://github.com/bareos/$pkgname/archive/Release/$pkgver.tar.gz
nginx-conf.patch"
builddir="$srcdir"/$pkgname-Release-$pkgver
prepare() {
default_prepare
sed -i -e "s/mod_php5/mod_$_php/" "$builddir"/install/apache/$pkgname.conf
sed -i -e "s/-dir//" "$builddir"/install/directors.ini
}
build() {
cd "$builddir"
./configure --prefix=/usr \
--with-httpd-conf=/etc/apache2/conf.d
make
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install
mv "$pkgdir"/etc/bareos/bareos-dir.d/console/admin.conf.example \
"$pkgdir"/etc/bareos/bareos-dir.d/console/admin.conf
}
apache2() {
pkgdesc="$pkgdesc (apache2 configuration files)"
depends="$pkgname $_php-apache2"
mkdir -p "$subpkgdir"/etc/
mv "$pkgdir"/etc/apache2 "$subpkgdir"/etc/
}
nginx() {
pkgdesc="$pkgdesc (nginx configuration files)"
depends="$pkgname nginx"
install -Dm644 "$builddir"/install/nginx/$pkgname.conf "$subpkgdir"/etc/nginx/conf.d/$pkgname.conf
}
sha512sums="904ebc549bd2bf0837fca2ecda8c1ff561628c568dda4eca96f40a2e6956db026e6c8a5cd55d129100696fcadd08bc3ff1f4c0d2ce0867c14ffce269c8a097a8 bareos-webui-17.2.5.tar.gz
f015fed04d1ab2d1410d3abe37329d2b48ecc54cd5fa0a0dd560c83ce0b9f04383219e6fa77d6a42752aeec8c26f9a27d53048edf0672435ef1e0cadaf2bae17 nginx-conf.patch"
......@@ -2,25 +2,32 @@
# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=bareos
pkgver=17.2.7
pkgrel=2
pkgver=18.2.6
pkgrel=0
pkgdesc="Bareos - Backup Archiving REcovery Open Sourced"
url="http://www.bareos.org"
arch="all"
options="!check"
license="AGPL-3.0"
depends="perl"
makedepends="file libtool libintl libpcap-dev lzo-dev \
sqlite-dev postgresql-dev gnutls-dev mariadb-connector-c-dev acl-dev \
qt-dev python-dev readline-dev ncurses-dev jansson-dev"
depends=""
makedepends="cmake gawk
lzo-dev acl-dev gettext-dev
readline-dev ncurses-dev jansson-dev
sqlite-dev postgresql-dev mariadb-connector-c-dev
php7"
install="$pkgname.pre-install $pkgname.post-install"
subpackages="$pkgname-dev $pkgname-doc $pkgname-trayicon"
subpackages="$pkgname-dev $pkgname-doc $pkgname-openrc $pkgname-dbg
$pkgname-mysql:_mysql $pkgname-sqlite:_sqlite $pkgname-postgresql:_postgresql
$pkgname-webui:_webui:noarch $pkgname-webui-apache2:_webui_apache2:noarch $pkgname-webui-nginx:_webui_nginx:noarch"
pkgusers=$pkgname
pkggroups=$pkgname
source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/Release/$pkgver.tar.gz
$pkgname-dir.initd
$pkgname-sd.initd
$pkgname-fd.initd
detect-alpine.patch
add-libintl.patch
nginx-conf.patch
path-mounted.patch
fix-bsmtp-segfault.patch
pthread-double-detach.patch
......@@ -28,72 +35,68 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/$pkgname/$pkgname/archive/Re
builddir="$srcdir"/${pkgname}-Release-${pkgver}
prepare() {
update_config_guess
default_prepare
cd "$builddir"
mkdir -pv core/platforms/alpine
touch core/platforms/alpine/CMakeLists.txt
# cleanup stale builddir and recreate
[ -d cmake-build ] && rm -rfv cmake-build
mkdir cmake-build
}
build() {
cd "$builddir"
./configure \
--prefix=/usr \
--sysconfdir=/etc \
--localstatedir=/var \
--with-basename=$pkgname \
--with-hostname=localhost \
--with-confdir=/etc/$pkgname \
--with-archivedir=/var/lib/$pkgname/archive \
--with-scriptdir=/etc/$pkgname/scripts \
--with-working-dir=/var/lib/$pkgname \
--with-plugindir=/usr/lib/$pkgname \
--with-backenddir=/usr/lib/$pkgname \
--with-pid-dir=/run/$pkgname \
--with-logdir=/var/log/$pkgname \
--with-subsys-dir=/var/lock \
--enable-smartalloc \
--enable-largefile \
--enable-readline \
--enable-traymonitor \
--enable-batch-insert \
--enable-acl \
--enable-xattr \
--enable-scsi-crypto \
--enable-lmdb \
--enable-ipv6 \
--enable-dynamic-cats-backends \
--enable-dynamic-debian-package-list \
--enable-sql-pooling \
--enable-includes \
--disable-conio \
--disable-nls \
--disable-rpath \
--with-postgresql \
--with-mysql \
--with-sqlite3 \
--with-gnutls \
--with-python \
--without-openssl \
--without-systemd \
--with-dir-user=$pkgname \
--with-dir-group=$pkgname \
--with-sd-user=$pkgname \
--with-sd-group=$pkgname \
--with-fd-user=root \
--with-fd-group=$pkgname
# work around parallel build issue
for i in src scripts src/lib src/findlib src/lmdb src/filed \
src/qt-tray-monitor src/console src/plugins/filed \
src/cats; do
make -C "$i"
done
cd "$builddir"/cmake-build
cmake .. \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DCMAKE_INSTALL_LIBDIR:PATH=/usr/lib \
-DBUILD_SHARED_LIBS:BOOL=ON \
-Dsysconfdir=/etc \
-Dbasename=$pkgname \
-Dhostname=localhost \
-Dconfdir=/etc/$pkgname \
-Dlibdir=/usr/lib \
-Darchivedir=/var/lib/$pkgname/archive \
-Dworkingdir=/var/lib/$pkgname \
-Dscriptdir=/etc/$pkgname/scripts \
-Dplugindir=/usr/lib/$pkgname \
-Dbackenddir=/usr/lib/$pkgname \
-Dlogdir=/var/log/$pkgname \
-Dpiddir=/run/$pkgname \
-Dbsrdir=/run/$pkgname \
-Dsubsysdir=/var/lock \
-Dsmartalloc=yes \
-Dbatch-insert=yes \
-Dscsi-crypto=yes \
-Dlmdb=yes \
-Dipv6=yes \
-Ddynamic-cats-backends=yes \
-Dpostgresql=yes \
-Dmysql=yes \
-Dsqlite3=yes \
-Dopenssl=yes \
-Dtraymonitor=no \
-Dsystemd=no \
-Dndmp=no \
-Ddir-user=$pkgname \
-Ddir-group=$pkgname \
-Dsd-user=$pkgname \
-Dsd-group=$pkgname \
-Dfd-user=root \
-Dfd-group=$pkgname
make
}
package() {
cd "$builddir"
cd "$builddir"/cmake-build
make DESTDIR="$pkgdir" install
mkdir -p "$pkgdir"/usr/sbin
mkdir -p "$pkgdir"/usr/bin
mkdir -p "$pkgdir"/var/lib/bareos
mkdir -p "$pkgdir"/var/log/bareos
local daemon; for daemon in dir sd fd; do
install -Dm755 "$srcdir"/$pkgname-$daemon.initd \
......@@ -101,34 +104,94 @@ package() {
done
# Install logrotate script
install -Dm644 scripts/logrotate "$pkgdir"/etc/logrotate.d/$pkgname
install -Dm644 ../core/scripts/logrotate "$pkgdir"/etc/logrotate.d/$pkgname
# Fix job to use shell script instead of perl script
sed -i -e 's/make_catalog_backup.pl/make_catalog_backup/' \
"$pkgdir"/etc/bareos/bareos-dir.d/job/BackupCatalog.conf
# remove perl script
rm "$pkgdir"/etc/bareos/scripts/make_catalog_backup.pl
# remove http configuration
rm -r "$pkgdir"/etc/httpd
}
_mysql() {
description="$description (mysql driver)"
mkdir -p "$subpkgdir"/usr/lib/bareos
mv "$pkgdir"/usr/lib/bareos/libbareoscats-mysql.so "$subpkgdir"/usr/lib/bareos/
for _i in creates grants updates; do
mkdir -p "$subpkgdir"/etc/bareos/scripts/ddl/$_i
mv "$pkgdir"/etc/bareos/scripts/ddl/$_i/mysql*.sql "$subpkgdir"/etc/bareos/scripts/ddl/$_i/
done
}
_sqlite() {
description="$description (sqlite driver)"
mkdir -p "$subpkgdir"/usr/lib/bareos
mv "$pkgdir"/usr/lib/bareos/libbareoscats-sqlite3.so "$subpkgdir"/usr/lib/bareos/
for _i in creates updates; do
mkdir -p "$subpkgdir"/etc/bareos/scripts/ddl/$_i
mv "$pkgdir"/etc/bareos/scripts/ddl/$_i/sqlite3*.sql "$subpkgdir"/etc/bareos/scripts/ddl/$_i/
done
}
trayicon() {
local dir
provides="$pkgname-tray-monitor"
depends="$pkgname"
pkgdesc="$pkgdesc (qt tray monitor)"
mkdir -p "$subpkgdir"/etc/$pkgname "$subpkgdir"/usr/bin
mv "$pkgdir"/usr/share "$subpkgdir"/usr
mv "$pkgdir"/etc/xdg "$subpkgdir"/etc
mv "$pkgdir"/etc/$pkgname/tray-monitor.d "$subpkgdir"/etc/$pkgname
mv "$pkgdir"/usr/bin/bareos-tray-monitor "$subpkgdir"/usr/bin
for dir in bareos-dir.d/console bareos-fd.d/director bareos-sd.d/director; do
mkdir -p "$subpkgdir"/etc/$pkgname/$dir
mv "$pkgdir"/etc/$pkgname/$dir/bareos-mon.conf \
"$subpkgdir"/etc/$pkgname/$dir
_postgresql() {
description="$description (postgresql driver)"
mkdir -p "$subpkgdir"/usr/lib/bareos
mv "$pkgdir"/usr/lib/bareos/libbareoscats-postgresql.so "$subpkgdir"/usr/lib/bareos/
for _i in creates grants updates; do
mkdir -p "$subpkgdir"/etc/bareos/scripts/ddl/$_i
mv "$pkgdir"/etc/bareos/scripts/ddl/$_i/postgresql*.sql "$subpkgdir"/etc/bareos/scripts/ddl/$_i/
done
}
sha512sums="254eddacb067ef7e82b7a54bdfcbffd5cfa033fa045f697c7e5b5c28dd064b5e1ce9f6aa946282c60f59972beae0b1b7901882b77c3f71cf16efdd73934135cc bareos-17.2.7.tar.gz
_webui() {
description="$description (webui)"
depends="php7"
mkdir -p "$subpkgdir"/usr/share
mv "$pkgdir"/bareos-webui "$subpkgdir"/usr/share/
mkdir -p "$subpkgdir"/etc
mv "$pkgdir"/etc/bareos-webui "$subpkgdir"/etc/
mkdir -p "$subpkgdir"/etc/bareos/bareos-dir.d/console/
mv "$pkgdir"/etc/bareos/bareos-dir.d/console/admin.conf.example "$subpkgdir"/etc/bareos/bareos-dir.d/console/
mkdir -p "$subpkgdir"/etc/bareos/bareos-dir.d/profile/
mv "$pkgdir"/etc/bareos/bareos-dir.d/profile/webui-admin.conf "$subpkgdir"/etc/bareos/bareos-dir.d/profile/
}
_webui_apache2() {
description="$description (webui apache2 configuration)"
depends="$pkgname-webui php7-apache2"
mkdir -p "$subpkgdir"/etc/apache2/conf.d
cp "$builddir"/webui/install/apache/bareos-webui.conf "$subpkgdir"/etc/apache2/conf.d/
}
_webui_nginx() {
description="$description (webui apache2 configuration)"
depends="$pkgname-webui nginx"
mkdir -p "$subpkgdir"/etc/nginx/conf.d
cp "$builddir"/webui/install/nginx/bareos-webui.conf "$subpkgdir"/etc/nginx/conf.d/
}
sha512sums="b6618173a803db4cfc3fe7edfe8c9e4e4128195f44383cd7df5b9866da4290686ed7cb42499edec957a5d9ab8bbd92d26258ce58f13fba84fb569167956768c3 bareos-18.2.6.tar.gz
eb1e7072b579bf9ae21f2e351d6900abb277db64e373f4760bac8188b82929376e4a196d2c935cefe1ae4cc2c396f2fcba1a25642b26e2f92a0d008fbdc4b5f2 bareos-dir.initd
c770b1d041fafef93d4eb0269ba8d9733e85ef465657fe8dd5d5c68a27ec773cec9c5c582d4a16596d95bbf6dbd3f7194dc9c0d8ed73138e9fb438fba9aa9445 bareos-sd.initd
c6347079dbcef5f4a69ec0c4ecc31803520d715d599d89c6bbfbb3741a86c50d7295c30432889b13ee9c16f2feaa84b1c6ae992cfee6505d569c6493d7e85a5b bareos-fd.initd
eac4614c1b29ff0f12061837e425ae495890076021b6d1b0f1beb93501cfb905170342dac5dab69b09f825d5b9416eea25fa02e2174b5a704315c7feb08ff3d3 path-mounted.patch
0974ce1ad1a7acd834d75253fe1decdcf40fb1fc0a9248f848514fb201d8482af5319a91b3d0032ee91f6e034225a46ddd9c8058d7f86a514a261408c84f31d1 fix-bsmtp-segfault.patch
1487e1294ade656e63877994d33621c8cc22258c8db7e95c2e1fdc16a0c5cf6ce77d6a232f46642fe5b3672c404a6f3a79628a983aa01dc4192882bda0e8c51e pthread-double-detach.patch"
1251d81d142b58bb2f5ab2ea762068fe2273aa5face9dfd314011706e9c2189ecab36b80f76317a595679f164b124cff85623c1ec98cc6997e350b6223f2a524 detect-alpine.patch
1439b8f72e39ca27689dbcc1a58c63f22b7dc4d4bee480408a4c388e30c0c3434915e5162fa7e55d16b3a80c9e4727b96263ab5edc9dda52acb38737e136f147 add-libintl.patch
0f73f38237a2320785b565d92c175de2c0c333081723c98b026f188b67ad738b5157222bc233811c6dafda3ddcdabf6849d5eeccc6723e0506e35923309cbcee nginx-conf.patch
2fb3d059185efb9c492d865ed79810971992ea2d8609639b4260b3338cbd0e89dc8ad0b3031be868d13b21ed9a93ff444703332f0864bbec7ce3e691210d05f7 path-mounted.patch
fe7973601f3883bac5dbfe03c5f30a64de977733d4d57069fb92736f95771af5434ddb376e0f7834c136509b76646b6803d69a47e2c983e6351aa238f460d28d fix-bsmtp-segfault.patch
73f059f9b821877e70b79f92ced63cfe8339171012531061d1dfccf7541be81706b89b2b1a3d41bd82fd95d6b097ca1ccae629a8a6d09f5054c2da32fe3dcc5b pthread-double-detach.patch"
Patch from fcolista
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index ae33cd0..2fe8906 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -103,6 +103,8 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(HAVE_LINUX_OS 1)
set(PSCMD "ps -e")
include_directories(/usr/include/tirpc)
+ link_directories(/usr/lib)
+ link_libraries(intl)
endif()
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
Patch from fcolista
diff --git a/core/cmake/distname.sh b/core/cmake/distname.sh
index d52308c..603d249 100755
--- a/core/cmake/distname.sh
+++ b/core/cmake/distname.sh
@@ -45,7 +45,7 @@ else
DISTNAME=univention
;;
*)
- DISTNAME=""
+ DISTNAME="alpine"
;;
esac
@@ -165,6 +165,10 @@ else
elif test "$CYGWIN" = yes
then
DISTNAME=cygwin
+ elif test -f /etc/alpine-release
+ then
+ DISTNAME=alpine
+ DISTVER=`cat /etc/alpine-release`
else
DISTNAME=unknown
DISTVER=unknown
Patch from Michael Cassaniti, posted here:
https://bugs.alpinelinux.org/issues/10156#note-5
Until this issue is fixed upstream this patch is needed.
diff --git a/src/lib/jcr.c b/src/lib/jcr.c
index 00bfe8c87..338f90e59 100644
--- a/src/lib/jcr.c
+++ b/src/lib/jcr.c
@@ -77,6 +77,7 @@ static pthread_mutex_t jcr_lock = PTHREAD_MUTEX_INITIALIZER;
--- old/core/src/lib/jcr.cc
+++ new/core/src/lib/jcr.cc
@@ -79,6 +79,7 @@
static pthread_mutex_t job_start_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t last_jobs_mutex = PTHREAD_MUTEX_INITIALIZER;
+static bool jcr_initialized = false;
#ifdef HAVE_WIN32
static bool tsd_initialized = false;
static pthread_key_t jcr_key; /* Pointer to jcr for each thread */
@@ -351,6 +352,8 @@ static void create_jcr_key()
berrno be;
Jmsg1(NULL, M_ABORT, 0, _("pthread key create failed: ERR=%s\n"),
be.bstrerror(status));
+ } else {
+ jcr_initialized = true;
}
static pthread_key_t jcr_key; /* Pointer to jcr for each thread */
@@ -324,6 +325,8 @@
if (status != 0) {
BErrNo be;
Jmsg1(nullptr, M_ABORT, 0, _("pthread key create failed: ERR=%s\n"), be.bstrerror(status));
+ } else {
+ jcr_initialized = true;
}
}
@@ -719,7 +722,10 @@ void set_jcr_in_tsd(JCR *jcr)
@@ -681,7 +684,10 @@
*/
JCR *get_jcr_from_tsd()
JobControlRecord *get_jcr_from_tsd()
{
- JCR *jcr = (JCR *)pthread_getspecific(jcr_key);
+ JCR *jcr = (JCR *)INVALID_JCR;
+ if (jcr_initialized){
+ jcr = (JCR *)pthread_getspecific(jcr_key);
+ }
/*
* Set any INVALID_JCR to NULL which the rest of BAREOS understands
@@ -736,7 +742,7 @@ JCR *get_jcr_from_tsd()
- JobControlRecord *jcr = (JobControlRecord *)pthread_getspecific(jcr_key);
+ JobControlRecord *jcr = (JobControlRecord *)INVALID_JCR;
+ if (jcr_initialized){
+ jcr = (JobControlRecord *)pthread_getspecific(jcr_key);
+ }
/*
* Set any INVALID_JCR to nullptr which the rest of BAREOS understands
@@ -696,7 +702,7 @@
*/
uint32_t get_jobid_from_tsd()
uint32_t GetJobidFromTsd()
{
- JCR *jcr = (JCR *)pthread_getspecific(jcr_key);
+ JCR *jcr = get_jcr_from_tsd();
uint32_t JobId = 0;
if (jcr && jcr != INVALID_JCR) {
- JobControlRecord *jcr = (JobControlRecord *)pthread_getspecific(jcr_key);
+ JobControlRecord *jcr = get_jcr_from_tsd();
uint32_t JobId = 0;
if (jcr && jcr != INVALID_JCR) { JobId = (uint32_t)jcr->JobId; }
--- a/install/nginx/bareos-webui.conf
+++ b/install/nginx/bareos-webui.conf
--- old/webui/install/nginx/bareos-webui.conf
+++ new/webui/install/nginx/bareos-webui.conf
@@ -2,7 +2,7 @@
listen 9100;
......
diff --git a/src/lib/mntent_cache.c b/src/lib/mntent_cache.c
index 69cc9f9..b14c8a1 100644
--- a/src/lib/mntent_cache.c
+++ b/src/lib/mntent_cache.c
--- a/core/src/lib/mntent_cache.cc
+++ b/core/src/lib/mntent_cache.cc
@@ -54,6 +54,10 @@
* Marco van Wieringen, August 2009
*/
......@@ -10,6 +8,6 @@ index 69cc9f9..b14c8a1 100644
+# define _PATH_MOUNTED "/proc/mounts"
+#endif
+
#include "bareos.h"
#include "include/bareos.h"
#include "mntent_cache.h"
This patch fixes a double pthread_detach(), which is undefined behaviour
and leads to a segfault when running with musl libc.
Until this issue is fixed upstream this patch is needed.
--- a/src/dird/ua_server.c
+++ b/src/dird/ua_server.c
@@ -73,7 +73,15 @@
UAContext *ua;
JCR *jcr;
--- old/core/src/dird/job.cc
+++ new/core/src/dird/job.cc
@@ -455,7 +455,16 @@
{
JobControlRecord *jcr = (JobControlRecord *)arg;
- pthread_detach(pthread_self());
+ /* only detach if not yet detached */
......@@ -18,15 +14,16 @@ Until this issue is fixed upstream this patch is needed.
+ if(_detachstate != PTHREAD_CREATE_DETACHED) {
+ pthread_detach(pthread_self());
+ }
+
Dsm_check(100);
jcr = new_control_jcr("-Console-", JT_CONSOLE);
--- a/src/dird/job.c
+++ b/src/dird/job.c
@@ -420,7 +420,16 @@
Dmsg0(200, "=====Start Job=========\n");
--- old/core/src/dird/ua_server.cc
+++ new/core/src/dird/ua_server.cc
@@ -77,7 +77,15 @@
*/
void *HandleUserAgentClientRequest(BareosSocket *user_agent_socket)
{
JCR *jcr = (JCR *)arg;
- pthread_detach(pthread_self());
+ /* only detach if not yet detached */
+ int _detachstate;
......@@ -37,7 +34,6 @@ Until this issue is fixed upstream this patch is needed.
+ if(_detachstate != PTHREAD_CREATE_DETACHED) {
+ pthread_detach(pthread_self());
+ }
+
Dsm_check(100);
Dmsg0(200, "=====Start Job=========\n");
JobControlRecord *jcr = new_control_jcr("-Console-", JT_CONSOLE);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment