aboutsummaryrefslogtreecommitdiffstats
path: root/community
diff options
context:
space:
mode:
authorValery Kartel <valery.kartel@gmail.com>2017-08-27 18:06:08 +0300
committerFrancesco Colista <fcolista@alpinelinux.org>2017-08-28 06:46:19 +0000
commitc6464a23fcc6deb83d8e120b026c26ae49c2dffb (patch)
treefe62b3ca8a9916547fc078b75a7f1b30f18b33f1 /community
parentb32c9583cb6819cf1d07a6ae5b232b7bf35203d5 (diff)
downloadaports-c6464a23fcc6deb83d8e120b026c26ae49c2dffb.tar.bz2
aports-c6464a23fcc6deb83d8e120b026c26ae49c2dffb.tar.xz
community/bareos: fix APKBUILD and init-scripts
- remove unneeded scripts - fix permissions for config-dirs, scripts and binaries - fix init-scripts to run with non-root user
Diffstat (limited to 'community')
-rw-r--r--community/bareos/APKBUILD41
-rw-r--r--community/bareos/bareos-dir.initd9
-rw-r--r--community/bareos/bareos-fd.initd9
-rw-r--r--community/bareos/bareos-sd.initd9
4 files changed, 55 insertions, 13 deletions
diff --git a/community/bareos/APKBUILD b/community/bareos/APKBUILD
index 19e8dbd286..e8a0f813c6 100644
--- a/community/bareos/APKBUILD
+++ b/community/bareos/APKBUILD
@@ -35,13 +35,15 @@ build() {
--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 \
+ --with-pid-dir=/run/$pkgname \
--with-logdir=/var/log/$pkgname \
--with-subsys-dir=/var/lock \
--enable-bat \
@@ -73,7 +75,7 @@ build() {
--with-sd-user=$pkgname \
--with-sd-group=$pkgname \
--with-fd-user=root \
- --with-fd-group=root
+ --with-fd-group=$pkgname
make
}
@@ -89,11 +91,29 @@ package() {
# Install logrotate script
install -Dm644 scripts/logrotate "$pkgdir"/etc/logrotate.d/$pkgname
- local dir; for dir in /var/lib/$pkgname /var/lib/$pkgname/archive \
- /etc/$pkgname/scripts/make_catalog_backup* \
- /etc/$pkgname/scripts/mtx-changer*; do
- chown $pkgname:$pkgname "$pkgdir"/$dir || return 1
- done
+ # 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 unneeded scripts
+ rm "$pkgdir"/usr/sbin/bareos \
+ "$pkgdir"/usr/sbin/bconsole "$pkgdir"/usr/sbin/bregex \
+ "$pkgdir"/usr/sbin/bsmtp "$pkgdir"/usr/sbin/bwild \
+ "$pkgdir"/etc/$pkgname/scripts/bareos \
+ "$pkgdir"/etc/$pkgname/scripts/bconsole \
+ "$pkgdir"/etc/$pkgname/scripts/btraceback* \
+ "$pkgdir"/etc/$pkgname/scripts/bareos-ctl-* \
+ "$pkgdir"/etc/$pkgname/scripts/bareos_config \
+ "$pkgdir"/etc/$pkgname/scripts/make_catalog_backup.pl
+
+ # Fix premissions
+ chown :$pkgname "$pkgdir"/etc/$pkgname/scripts/* \
+ "$pkgdir"/etc/$pkgname/*.conf \
+ "$pkgdir"/usr/sbin/* \
+ "$pkgdir"/usr/bin/*
+ chown $pkgname:$pkgname -R "$pkgdir"/etc/$pkgname/bareos-*.d \
+ "$pkgdir"/var/lib/$pkgname \
+ "$pkgdir"/var/log/$pkgname
}
bat() {
@@ -110,6 +130,8 @@ bat() {
}
trayicon() {
+ local dir
+ provides="$pkgname-tray-monitor"
depends="$pkgname"
pkgdesc="$pkgdesc (qt tray monitor)"
mkdir -p "$subpkgdir"/etc/$pkgname "$subpkgdir"/usr/bin
@@ -117,6 +139,11 @@ trayicon() {
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
+ done
}
sha512sums="f379fd1d568260b1ad3c426b7b80b1d33a1b078db1aa03b847a4e1dc262cf0155419f20f7105bc095167bb5e64169d5e6b0bcfa3e3913d5e4b5f8f23f4fde750 bareos-16.2.6.tar.gz
diff --git a/community/bareos/bareos-dir.initd b/community/bareos/bareos-dir.initd
index 1ea2b6aecc..b4649ddabe 100644
--- a/community/bareos/bareos-dir.initd
+++ b/community/bareos/bareos-dir.initd
@@ -1,11 +1,16 @@
#!/sbin/openrc-run
-name="Bareos Director"
+name="Bareos Director daemon"
+pidfile=/run/bareos/bareos-dir.9101.pid
command=/usr/sbin/bareos-dir
-pidfile=/run/$RC_SVCNAME.pid
+command_args="-u bareos -g bareos"
depend() {
need net
after firewall
use dns bareos-fd bareos-sd postgresql mariadb
}
+
+start_pre() {
+ checkpath -dm750 -o bareos "${pidfile%/*}"
+}
diff --git a/community/bareos/bareos-fd.initd b/community/bareos/bareos-fd.initd
index dc899b38c1..84eb1b1c1a 100644
--- a/community/bareos/bareos-fd.initd
+++ b/community/bareos/bareos-fd.initd
@@ -1,10 +1,15 @@
#!/sbin/openrc-run
-name="Bareos File"
+name="Bareos File daemon"
+pidfile=/run/bareos/bareos-fd.9102.pid
command=/usr/sbin/bareos-fd
-pidfile=/run/$RC_SVCNAME.pid
+command_args="-u root -g bareos"
depend() {
need net
use dns
}
+
+start_pre() {
+ checkpath -dm750 -o bareos "${pidfile%/*}"
+} \ No newline at end of file
diff --git a/community/bareos/bareos-sd.initd b/community/bareos/bareos-sd.initd
index cc8331b05e..abbf951cdd 100644
--- a/community/bareos/bareos-sd.initd
+++ b/community/bareos/bareos-sd.initd
@@ -1,10 +1,15 @@
#!/sbin/openrc-run
-name="Bareos Storage"
+name="Bareos Storage daemon"
+pidfile=/run/bareos/bareos-sd.9103.pid
command=/usr/sbin/bareos-sd
-pidfile=/run/$RC_SVCNAME.pid
+command_args="-u bareos -g bareos"
depend() {
need net
use dns
}
+
+start_pre() {
+ checkpath -dm750 -o bareos "${pidfile%/*}"
+}