net-misc/gerbera: Fix up init script #629962
authorIan Whyman <thev00d00@gentoo.org>
Tue, 5 Sep 2017 19:17:09 +0000 (20:17 +0100)
committerIan Whyman <thev00d00@gentoo.org>
Tue, 5 Sep 2017 19:17:17 +0000 (20:17 +0100)
Thanks to Michael Orlitzky for the suggestions.

Package-Manager: Portage-2.3.8, Repoman-2.3.3

net-misc/gerbera/files/gerbera-1.0.0.confd
net-misc/gerbera/files/gerbera-1.0.0.initd
net-misc/gerbera/files/gerbera.tmpfiles [deleted file]
net-misc/gerbera/gerbera-1.0.0-r2.ebuild [moved from net-misc/gerbera/gerbera-1.0.0-r1.ebuild with 86% similarity]
net-misc/gerbera/gerbera-9999.ebuild

index 4c4a442203518b1e0915e6a9bb239797ed22dbc7..3f4bdf16a75f82157aeee0bfc9fccb9b641b47a3 100644 (file)
@@ -6,14 +6,6 @@
 # NOTE: The minimum value allowed is 49152
 GERBERA_PORT=49152
 
-# Run Gerbera as this user.
-# NOTE: For security reasons do not run Gerbera as root.
-GERBERA_USER="gerbera"
-
-# Run Gerbera as this group.
-# NOTE: For security reasons do not run Gerbera as root.
-GERBERA_GROUP="gerbera"
-
 # Path to Gerbera config file.
 GERBERA_CONFIG="/etc/gerbera/config.xml"
 
@@ -21,5 +13,8 @@ GERBERA_CONFIG="/etc/gerbera/config.xml"
 GERBERA_LOGFILE="/var/log/gerbera.log"
 
 # Other options you want to pass to Gerbera.
-# Add "--interface ${GERBERA_INTERFACE}" to bind to a named interface.
+# Add "--interface eth0" to bind to a named interface.
 GERBERA_OPTIONS=""
+
+# Uncomment if you are running Gerbera against a local MySQL
+# rc_need="mysql"
index faee5e3c56cc19a5419a4b6b704311c98a824c0a..758b0c8101e8e6b3fbdcc1e47a7a7c7df2ade433 100644 (file)
@@ -2,38 +2,23 @@
 # Copyright 1999-2017 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
+command="/usr/bin/gerbera"
+command_args="--logfile ${GERBERA_LOGFILE}
+             --config ${GERBERA_CONFIG}
+             --port ${GERBERA_PORT}
+             ${GERBERA_OPTIONS}"
+command_user="gerbera:gerbera"
+command_background=true
+start_stop_daemon_args="--wait 500"
+retry="10"
+pidfile="/run/${RC_SVCNAME}.pid"
+
 depend() {
        need net
-       # In order to properly support this (need vs use), we would have to
-       # parse ${GERBERA_CONFIG} and see if mysql is enabled and if it is
-       # pointing to the local system.  #368409
-       use mysql
-}
-
-start() {
-       ebegin "Starting Gerbera"
-
-       checkpath --directory --owner "${GERBERA_USER}:${GERBERA_GROUP}" --mode 0755 /run/gerbera
-       checkpath --file --owner "${GERBERA_USER}:${GERBERA_GROUP}" --mode 0644 "${GERBERA_LOGFILE}"
-
-       start-stop-daemon \
-               --start \
-               --exec /usr/bin/gerbera \
-               --user ${GERBERA_USER} \
-               --group ${GERBERA_GROUP} \
-               --background \
-               --wait 500 \
-               -- \
-               --pidfile /run/gerbera/gerbera.pid \
-               --logfile ${GERBERA_LOGFILE} \
-               --config ${GERBERA_CONFIG} \
-               --port ${GERBERA_PORT} \
-               ${GERBERA_OPTIONS}
-       eend $?
 }
 
-stop () {
-       ebegin "Stopping Gerbera"
-       start-stop-daemon --stop --retry 10 --quiet --pidfile /run/gerbera/gerbera.pid
-       eend $?
+start_pre() {
+       checkpath --owner "gerbera:gerbera" \
+                         --mode 0644 \
+                         --file "${GERBERA_LOGFILE}"
 }
diff --git a/net-misc/gerbera/files/gerbera.tmpfiles b/net-misc/gerbera/files/gerbera.tmpfiles
deleted file mode 100644 (file)
index fcc9b5d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-d /run/gerbera 0755 gerbera gerbera -
\ No newline at end of file
similarity index 86%
rename from net-misc/gerbera/gerbera-1.0.0-r1.ebuild
rename to net-misc/gerbera/gerbera-1.0.0-r2.ebuild
index 2d2a5ecf2c14560c591a11f475cad88566ebbc7a..98b91521521ecc2465d22c473c7da7aab246fa89 100644 (file)
@@ -6,12 +6,12 @@ EAPI=6
 inherit cmake-utils eutils linux-info systemd tmpfiles user
 
 if [[ ${PV} == 9999 ]]; then
-       EGIT_REPO_URI="https://github.com/v00d00/${PN}.git"
+       EGIT_REPO_URI="https://github.com/gerbera/${PN}.git"
        KEYWORDS=""
        SRC_URI=""
        inherit git-r3
 else
-       SRC_URI="https://github.com/v00d00/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+       SRC_URI="https://github.com/gerbera/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
        KEYWORDS="~amd64 ~x86"
        S="${WORKDIR}/${P}"
 fi
@@ -78,18 +78,15 @@ src_install() {
        use mysql && systemd_dounit "${S}/scripts/systemd/${PN}-mysql.service"
 
        newinitd "${FILESDIR}/${PN}-1.0.0.initd" "${PN}"
-       use mysql || sed -i -e "/use mysql/d" "${ED}/etc/init.d/${PN}"
        newconfd "${FILESDIR}/${PN}-1.0.0.confd" "${PN}"
 
        insinto /etc/${PN}
        newins "${FILESDIR}/${PN}-1.0.0.config" config.xml
-       fperms 0600 /etc/${PN}/config.xml
-       fowners gerbera:gerbera /etc/${PN}/config.xml
+       fperms 0640 /etc/${PN}/config.xml
+       fowners root:gerbera /etc/${PN}/config.xml
 
        keepdir /var/lib/${PN}
        fowners ${PN}:${PN} /var/lib/${PN}
-
-       newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf
 }
 
 pkg_postinst() {
index 2d2a5ecf2c14560c591a11f475cad88566ebbc7a..98b91521521ecc2465d22c473c7da7aab246fa89 100644 (file)
@@ -6,12 +6,12 @@ EAPI=6
 inherit cmake-utils eutils linux-info systemd tmpfiles user
 
 if [[ ${PV} == 9999 ]]; then
-       EGIT_REPO_URI="https://github.com/v00d00/${PN}.git"
+       EGIT_REPO_URI="https://github.com/gerbera/${PN}.git"
        KEYWORDS=""
        SRC_URI=""
        inherit git-r3
 else
-       SRC_URI="https://github.com/v00d00/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+       SRC_URI="https://github.com/gerbera/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
        KEYWORDS="~amd64 ~x86"
        S="${WORKDIR}/${P}"
 fi
@@ -78,18 +78,15 @@ src_install() {
        use mysql && systemd_dounit "${S}/scripts/systemd/${PN}-mysql.service"
 
        newinitd "${FILESDIR}/${PN}-1.0.0.initd" "${PN}"
-       use mysql || sed -i -e "/use mysql/d" "${ED}/etc/init.d/${PN}"
        newconfd "${FILESDIR}/${PN}-1.0.0.confd" "${PN}"
 
        insinto /etc/${PN}
        newins "${FILESDIR}/${PN}-1.0.0.config" config.xml
-       fperms 0600 /etc/${PN}/config.xml
-       fowners gerbera:gerbera /etc/${PN}/config.xml
+       fperms 0640 /etc/${PN}/config.xml
+       fowners root:gerbera /etc/${PN}/config.xml
 
        keepdir /var/lib/${PN}
        fowners ${PN}:${PN} /var/lib/${PN}
-
-       newtmpfiles "${FILESDIR}"/${PN}.tmpfiles ${PN}.conf
 }
 
 pkg_postinst() {