app-backup/burp: Move scripts out of /etc
authorAmadeusz Żołnowski <aidecoe@gentoo.org>
Thu, 30 Jun 2016 22:54:13 +0000 (23:54 +0100)
committerAmadeusz Żołnowski <aidecoe@gentoo.org>
Sat, 2 Jul 2016 16:11:56 +0000 (17:11 +0100)
Burp needs /etc/burp directory to be writable for its daemon (at least
first time it runs). On the other hand an executable cannot be placed
into a group-writable directory and this is where Burp scripts are
installed by default. Move all scripts to /usr/share/burp/scripts. /etc
is not a good place for scripts anyway.

Gentoo-Bug: 562470

Package-Manager: portage-2.3.0

app-backup/burp/burp-1.4.40-r2.ebuild [new file with mode: 0644]
app-backup/burp/files/burp.initd

diff --git a/app-backup/burp/burp-1.4.40-r2.ebuild b/app-backup/burp/burp-1.4.40-r2.ebuild
new file mode 100644 (file)
index 0000000..da09df4
--- /dev/null
@@ -0,0 +1,108 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit autotools eutils user
+
+DESCRIPTION="Network backup and restore client and server for Unix and Windows"
+HOMEPAGE="http://burp.grke.org/"
+SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2
+       http://burp.grke.org/downloads/${P}/${P}.tar.bz2"
+
+LICENSE="AGPL-3"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="acl afs ipv6 libressl nls tcpd xattr"
+
+DEPEND="
+       !libressl? ( dev-libs/openssl:0= )
+       libressl? ( dev-libs/libressl:0= )
+       dev-libs/uthash
+       sys-libs/libcap
+       <net-libs/librsync-2.0
+       sys-libs/ncurses:0=
+       sys-libs/zlib
+       acl? ( sys-apps/acl )
+       afs? ( net-fs/openafs )
+       nls? ( sys-devel/gettext )
+       tcpd? ( sys-apps/tcp-wrappers )
+       xattr? ( sys-apps/attr )
+       "
+RDEPEND="${DEPEND}
+       virtual/logger
+       "
+
+DOCS=( CONTRIBUTORS DONATIONS UPGRADING )
+PATCHES=(
+       "${FILESDIR}/${PV}-non-zero-or-build-failure.patch"
+       "${FILESDIR}/${PV}-bedup-conf-path.patch"
+       "${FILESDIR}/${PV}-tinfo.patch"
+       )
+
+pkg_setup() {
+       enewgroup "${PN}"
+       enewuser "${PN}" -1 "" "" "${PN}"
+}
+
+src_prepare() {
+       epatch "${PATCHES[@]}"
+       eautoreconf
+}
+
+src_configure() {
+       local myeconfargs=(
+               --sbindir=/usr/sbin
+               --sysconfdir=/etc/burp
+               --enable-largefile
+               $(use_enable acl)
+               $(use_enable afs)
+               $(use_enable ipv6)
+               $(use_enable nls)
+               $(use_enable xattr)
+               $(use_with tcpd tcp-wrappers)
+       )
+       econf "${myeconfargs[@]}"
+}
+
+src_install() {
+       default
+
+       fowners root:burp /etc/burp /var/spool/burp
+       fperms 0775 /etc/burp /var/spool/burp
+       fowners root:burp /etc/burp/clientconfdir
+       fperms 0750 /etc/burp/clientconfdir
+       fowners root:burp /etc/burp/burp-server.conf
+       fperms 0640 /etc/burp/burp-server.conf
+
+       newinitd "${FILESDIR}"/${PN}.initd ${PN}
+       dodoc docs/*
+
+       local scripts_dir=/usr/share/burp/scripts
+       dodir "${scripts_dir}"
+       local script
+       for script in notify_script ssl_extra_checks_script summary_script \
+                       timer_script; do
+               mv "${D}etc/burp/${script}" "${D}${scripts_dir}/"
+               sed -r \
+                       -e "s|(=\\s*)/etc/burp/${script}\\s*$|\1${scripts_dir}/${script}|" \
+                       -i "${D}etc/burp/burp-server.conf"
+       done
+
+       sed -e 's|^# user=graham|user = burp|' \
+               -e 's|^# group=nogroup|group = burp|' \
+               -e 's|^pidfile = .*|lockfile = /run/lock/burp/server.lock|' \
+               -i "${D}etc/burp/burp-server.conf" || die
+}
+
+pkg_postinst() {
+       if [[ ! -e /etc/burp/CA/index.txt ]]; then
+               elog "At first run burp server will generate DH parameters and SSL"
+               elog "certificates.  You should adjust configuration before."
+               elog "Server configuration is located at"
+               elog ""
+               elog "  /etc/burp/burp-server.conf"
+               elog ""
+       fi
+}
index 2820199201256921440681ecebe7f8b6321ac0ba..fda1a75153848b9d72fecb6009c1f050c84c9d66 100644 (file)
@@ -1,5 +1,5 @@
 #!/sbin/openrc-run
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2016 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 # $Id$
 
@@ -24,10 +24,11 @@ depend() {
 }
 
 start_pre() {
-       checkpath -o burp:burp -m 0775 -d /run/lock/burp
        checkpath -o root:burp -m 0775 -d /etc/burp
-       checkpath -o root:burp -m 0750 -d /etc/burp/clientconfdir
        checkpath -o root:burp -m 0640 -f /etc/burp/burp-server.conf
+       checkpath -o root:burp -m 0750 -d /etc/burp/clientconfdir
+       checkpath -o burp:burp -m 0775 -d /run/lock/burp
+       checkpath -o root:burp -m 0750 -d /var/spool/burp
 }
 
 reload() {