public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Anna Vyalkova" <cybertailor@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/guru:dev commit in: net-misc/gmid/files/, net-misc/gmid/
Date: Wed,  7 Apr 2021 06:55:54 +0000 (UTC)	[thread overview]
Message-ID: <1617778537.65433ba88a032d674582ad5cc387d6dc485b7985.cybertailor@gentoo> (raw)

commit:     65433ba88a032d674582ad5cc387d6dc485b7985
Author:     Anna Vyalkova <cyber <AT> sysrq <DOT> in>
AuthorDate: Wed Apr  7 06:55:17 2021 +0000
Commit:     Anna Vyalkova <cybertailor <AT> gmail <DOT> com>
CommitDate: Wed Apr  7 06:55:37 2021 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=65433ba8

net-misc/gmid: fix initd script

It writes a valid PID file now

Other changes:
* add a reasonable default configuration file
* automatically generate a self-signed certificate for localhost

Package-Manager: Portage-3.0.18, Repoman-3.0.3
Signed-off-by: Anna Vyalkova <cyber <AT> sysrq.in>

 net-misc/gmid/files/gmid.conf  |  8 ++++++++
 net-misc/gmid/files/gmid.confd |  9 ---------
 net-misc/gmid/files/gmid.initd |  7 +++----
 net-misc/gmid/gmid-1.6.ebuild  | 17 +++++++++++++++--
 net-misc/gmid/gmid-9999.ebuild | 17 +++++++++++++++--
 5 files changed, 41 insertions(+), 17 deletions(-)

diff --git a/net-misc/gmid/files/gmid.conf b/net-misc/gmid/files/gmid.conf
new file mode 100644
index 000000000..c9b298c2a
--- /dev/null
+++ b/net-misc/gmid/files/gmid.conf
@@ -0,0 +1,8 @@
+user "gemini" # drop privileges
+
+server "localhost" {
+  root "/var/gemini/localhost"
+  auto index on
+  cert "/etc/ssl/gmid/gmid.crt"
+  key "/etc/ssl/gmid/gmid.key"
+}

diff --git a/net-misc/gmid/files/gmid.confd b/net-misc/gmid/files/gmid.confd
index 62027f6a4..497ddb58e 100644
--- a/net-misc/gmid/files/gmid.confd
+++ b/net-misc/gmid/files/gmid.confd
@@ -2,12 +2,3 @@
 
 # Configuration file
 #GMID_CONFIGFILE="/etc/gmid/gmid.conf"
-
-# PID file
-#GMID_PIDFILE="/var/run/gmid.pid"
-
-# User to run gmid as
-#GMID_USER="gemini"
-
-# Group to run gmid as
-#GMID_GROUP="gemini"

diff --git a/net-misc/gmid/files/gmid.initd b/net-misc/gmid/files/gmid.initd
index dfe3b0009..6607c7d2f 100644
--- a/net-misc/gmid/files/gmid.initd
+++ b/net-misc/gmid/files/gmid.initd
@@ -12,10 +12,9 @@ description_reload="Reload the gmid configuration without losing connections."
 GMID_CONFIGFILE=${GMID_CONFIGFILE:-/etc/gmid/gmid.conf}
 
 command="/usr/bin/gmid"
-command_args="-c \"${GMID_CONFIGFILE}\""
-pidfile=${GMID_PIDFILE:-/var/run/gmid.pid}
-user=${GMID_USER:-gemini}
-group=${GMID_GROUP:-gemini}
+command_args="-c \"${GMID_CONFIGFILE}\" -f"
+command_background=1
+pidfile="/var/run/gmid.pid"
 
 depend() {
 	need net

diff --git a/net-misc/gmid/gmid-1.6.ebuild b/net-misc/gmid/gmid-1.6.ebuild
index da3b22779..3e844bfec 100644
--- a/net-misc/gmid/gmid-1.6.ebuild
+++ b/net-misc/gmid/gmid-1.6.ebuild
@@ -3,7 +3,10 @@
 
 EAPI=7
 
-inherit toolchain-funcs
+SSL_DEPS_SKIP=1
+SSL_DAYS=36500
+
+inherit ssl-cert toolchain-funcs
 
 DESCRIPTION="simple and secure Gemini server"
 HOMEPAGE="https://www.omarpolo.com/pages/gmid.html"
@@ -53,13 +56,23 @@ src_configure() {
 src_install() {
 	default
 
+	dodir /etc/gmid
+	cp "${FILESDIR}"/gmid.conf "${ED}"/etc/gmid/gmid.conf || die
+
 	newinitd "${FILESDIR}"/gmid.initd gmid
 	newconfd "${FILESDIR}"/gmid.confd gmid
+
+	keepdir /var/gemini/localhost
 }
 
 pkg_postinst() {
+	if [[ ! -f "${EROOT}"/etc/ssl/${PN}/${PN}.key ]]; then
+		install_cert /etc/ssl/${PN}/${PN}
+		chown gemini:gemini "${EROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
+	fi
+
 	einfo "This gemini server can be run as a user with zero configuration.\n"
 	einfo "In order to use it with the init service you will need to generate a"
-	einfo "self-signed TLS certificate and key and set up the configuration"
+	einfo "self-signed TLS certificate and a key and set up the configuration"
 	einfo "file (see man 1 gmid for details)."
 }

diff --git a/net-misc/gmid/gmid-9999.ebuild b/net-misc/gmid/gmid-9999.ebuild
index da3b22779..3e844bfec 100644
--- a/net-misc/gmid/gmid-9999.ebuild
+++ b/net-misc/gmid/gmid-9999.ebuild
@@ -3,7 +3,10 @@
 
 EAPI=7
 
-inherit toolchain-funcs
+SSL_DEPS_SKIP=1
+SSL_DAYS=36500
+
+inherit ssl-cert toolchain-funcs
 
 DESCRIPTION="simple and secure Gemini server"
 HOMEPAGE="https://www.omarpolo.com/pages/gmid.html"
@@ -53,13 +56,23 @@ src_configure() {
 src_install() {
 	default
 
+	dodir /etc/gmid
+	cp "${FILESDIR}"/gmid.conf "${ED}"/etc/gmid/gmid.conf || die
+
 	newinitd "${FILESDIR}"/gmid.initd gmid
 	newconfd "${FILESDIR}"/gmid.confd gmid
+
+	keepdir /var/gemini/localhost
 }
 
 pkg_postinst() {
+	if [[ ! -f "${EROOT}"/etc/ssl/${PN}/${PN}.key ]]; then
+		install_cert /etc/ssl/${PN}/${PN}
+		chown gemini:gemini "${EROOT}"/etc/ssl/${PN}/${PN}.{crt,csr,key,pem}
+	fi
+
 	einfo "This gemini server can be run as a user with zero configuration.\n"
 	einfo "In order to use it with the init service you will need to generate a"
-	einfo "self-signed TLS certificate and key and set up the configuration"
+	einfo "self-signed TLS certificate and a key and set up the configuration"
 	einfo "file (see man 1 gmid for details)."
 }


             reply	other threads:[~2021-04-07  6:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07  6:55 Anna Vyalkova [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-04-27 10:17 [gentoo-commits] repo/proj/guru:dev commit in: net-misc/gmid/files/, net-misc/gmid/ Anna Vyalkova
2021-07-05 22:02 Anna Vyalkova
2021-07-10 18:26 Anna Vyalkova
2024-01-25 11:17 Anna Vyalkova
2024-02-12 22:03 Anna Vyalkova

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1617778537.65433ba88a032d674582ad5cc387d6dc485b7985.cybertailor@gentoo \
    --to=cybertailor@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox