commit:     6761e0a48b09d1f88f81dbf620e14676404784cc
Author:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
AuthorDate: Fri Jul  1 17:22:34 2016 +0000
Commit:     Anthony G. Basile <blueness <AT> gentoo <DOT> org>
CommitDate: Fri Jul  1 17:23:11 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6761e0a4

www-servers/monkeyd: add monkeyd user, fix pidfile and address bug #459274

Package-Manager: portage-2.2.28

 .../monkeyd/files/monkeyd-1.6.9-fix-pidfile.patch    | 12 ++++++++++++
 ...{monkeyd-1.6.9.ebuild => monkeyd-1.6.9-r1.ebuild} | 20 ++++++++++++++++----
 www-servers/monkeyd/monkeyd-9999.ebuild              | 20 ++++++++++++++++----
 3 files changed, 44 insertions(+), 8 deletions(-)

diff --git a/www-servers/monkeyd/files/monkeyd-1.6.9-fix-pidfile.patch 
b/www-servers/monkeyd/files/monkeyd-1.6.9-fix-pidfile.patch
new file mode 100644
index 0000000..82550ae
--- /dev/null
+++ b/www-servers/monkeyd/files/monkeyd-1.6.9-fix-pidfile.patch
@@ -0,0 +1,12 @@
+diff -Naur monkey-1.6.9.orig/CMakeLists.txt monkey-1.6.9/CMakeLists.txt
+--- monkey-1.6.9.orig/CMakeLists.txt   2016-06-04 19:16:47.000000000 -0400
++++ monkey-1.6.9/CMakeLists.txt        2016-07-01 13:08:51.237213196 -0400
+@@ -285,7 +285,7 @@
+ 
+   # Custom PIDPATH
+   if(NOT PID_PATH)
+-    set(MK_PATH_PIDPATH ${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/run/ CACHE STRING 
"Server PID path")
++    set(MK_PATH_PIDPATH /run/ CACHE STRING "Server PID path")
+   else()
+     set(MK_PATH_PIDPATH ${PID_PATH} CACHE STRING "Server PID path")
+   endif()

diff --git a/www-servers/monkeyd/monkeyd-1.6.9.ebuild 
b/www-servers/monkeyd/monkeyd-1.6.9-r1.ebuild
similarity index 90%
rename from www-servers/monkeyd/monkeyd-1.6.9.ebuild
rename to www-servers/monkeyd/monkeyd-1.6.9-r1.ebuild
index 3221de5..86b01b6 100644
--- a/www-servers/monkeyd/monkeyd-1.6.9.ebuild
+++ b/www-servers/monkeyd/monkeyd-1.6.9-r1.ebuild
@@ -4,7 +4,7 @@
 
 EAPI="5"
 
-inherit eutils flag-o-matic toolchain-funcs multilib
+inherit eutils flag-o-matic toolchain-funcs user multilib
 
 DESCRIPTION="A small, fast, and scalable web server"
 HOMEPAGE="http://www.monkey-project.com/";
@@ -46,6 +46,11 @@ S="${WORKDIR}/${MY_P}"
 
 WEBROOT="/var/www/localhost"
 
+pkg_preinst() {
+       enewgroup monkeyd
+       enewuser monkeyd -1 -1 /var/tmp/monkeyd monkeyd
+}
+
 pkg_setup() {
        if use debug; then
                ewarn
@@ -59,6 +64,7 @@ pkg_setup() {
 src_prepare() {
        # Unconditionally get rid of the bundled jemalloc
        rm -rf "${S}"/deps
+       epatch "${FILESDIR}"/${PN}-1.6.9-fix-pidfile.patch
        epatch "${FILESDIR}"/${PN}-1.6.8-system-mbedtls.patch
 }
 
@@ -106,13 +112,13 @@ src_configure() {
        ./configure \
                --pthread-tls \
                --prefix=/usr \
+               --default-user=monkeyd \
                --sbindir=/usr/sbin \
                --webroot=${WEBROOT}/htdocs \
-               --logdir=/var/log/${PN} \
+               --logdir=/var/log/monkeyd \
                --mandir=/usr/share/man \
                --libdir=/usr/$(get_libdir) \
-               --pidfile=/run/monkey.pid \
-               --sysconfdir=/etc/${PN} \
+               --sysconfdir=/etc/monkeyd \
                ${myconf} \
                || die
 }
@@ -133,9 +139,15 @@ src_install() {
                "${D}"/usr/share/doc/"${PF}"/htdocs.dist || die
 
        keepdir \
+               /var/tmp/monkeyd \
                /var/log/monkeyd \
                ${WEBROOT}/htdocs
 
        # This needs to be created at runtime
        rm -rf "${D}"/run
 }
+
+pkg_postinst() {
+       chown monkeyd:monkeyd /var/{log,tmp}/monkeyd
+       chmod 770 /var/{log,tmp}/monkeyd
+}

diff --git a/www-servers/monkeyd/monkeyd-9999.ebuild 
b/www-servers/monkeyd/monkeyd-9999.ebuild
index 3221de5..86b01b6 100644
--- a/www-servers/monkeyd/monkeyd-9999.ebuild
+++ b/www-servers/monkeyd/monkeyd-9999.ebuild
@@ -4,7 +4,7 @@
 
 EAPI="5"
 
-inherit eutils flag-o-matic toolchain-funcs multilib
+inherit eutils flag-o-matic toolchain-funcs user multilib
 
 DESCRIPTION="A small, fast, and scalable web server"
 HOMEPAGE="http://www.monkey-project.com/";
@@ -46,6 +46,11 @@ S="${WORKDIR}/${MY_P}"
 
 WEBROOT="/var/www/localhost"
 
+pkg_preinst() {
+       enewgroup monkeyd
+       enewuser monkeyd -1 -1 /var/tmp/monkeyd monkeyd
+}
+
 pkg_setup() {
        if use debug; then
                ewarn
@@ -59,6 +64,7 @@ pkg_setup() {
 src_prepare() {
        # Unconditionally get rid of the bundled jemalloc
        rm -rf "${S}"/deps
+       epatch "${FILESDIR}"/${PN}-1.6.9-fix-pidfile.patch
        epatch "${FILESDIR}"/${PN}-1.6.8-system-mbedtls.patch
 }
 
@@ -106,13 +112,13 @@ src_configure() {
        ./configure \
                --pthread-tls \
                --prefix=/usr \
+               --default-user=monkeyd \
                --sbindir=/usr/sbin \
                --webroot=${WEBROOT}/htdocs \
-               --logdir=/var/log/${PN} \
+               --logdir=/var/log/monkeyd \
                --mandir=/usr/share/man \
                --libdir=/usr/$(get_libdir) \
-               --pidfile=/run/monkey.pid \
-               --sysconfdir=/etc/${PN} \
+               --sysconfdir=/etc/monkeyd \
                ${myconf} \
                || die
 }
@@ -133,9 +139,15 @@ src_install() {
                "${D}"/usr/share/doc/"${PF}"/htdocs.dist || die
 
        keepdir \
+               /var/tmp/monkeyd \
                /var/log/monkeyd \
                ${WEBROOT}/htdocs
 
        # This needs to be created at runtime
        rm -rf "${D}"/run
 }
+
+pkg_postinst() {
+       chown monkeyd:monkeyd /var/{log,tmp}/monkeyd
+       chmod 770 /var/{log,tmp}/monkeyd
+}

Reply via email to