git: 138d30ed37c7 - main - mail/hydroxide: Fix rc.d script

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Sun, 18 Aug 2024 12:56:17 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=138d30ed37c7eee5f1f616c74eac2d646b26ce0b

commit 138d30ed37c7eee5f1f616c74eac2d646b26ce0b
Author:     Yusuf Yaman <nxjoseph@protonmail.com>
AuthorDate: 2024-08-18 12:51:41 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-08-18 12:53:59 +0000

    mail/hydroxide: Fix rc.d script
    
    - hydroxide does want to store some files and users were running
    "hydroxide auth" with normal user. Now, hydroxide user has a home
    directory, and it does store them there now.
    - Change upstream.
    
    PR:     280886
---
 UIDs                              |  2 +-
 mail/hydroxide/Makefile           |  4 ++--
 mail/hydroxide/distinfo           |  6 +++---
 mail/hydroxide/files/hydroxide.in | 17 +++++++++++++----
 mail/hydroxide/pkg-message        | 13 +++++++++++++
 5 files changed, 32 insertions(+), 10 deletions(-)

diff --git a/UIDs b/UIDs
index dda814603f01..6c0b1db9a828 100644
--- a/UIDs
+++ b/UIDs
@@ -326,7 +326,7 @@ _wsdd:*:370:370::0:0:Web Service Discovery Daemon:/nonexistent:/usr/sbin/nologin
 # free: 378
 # free: 379
 spoofdpi:*:380:380::0:0:SpoofDPI Daemon:/nonexistent:/usr/sbin/nologin
-hydroxide:*:381:381::0:0:Hydroxide Daemon:/nonexistent:/usr/sbin/nologin
+hydroxide:*:381:381::0:0:Hydroxide Daemon:/var/db/hydroxide:/usr/sbin/nologin
 # free: 382
 # free: 383
 # free: 384
diff --git a/mail/hydroxide/Makefile b/mail/hydroxide/Makefile
index c71c5b725d6b..594006fcfe90 100644
--- a/mail/hydroxide/Makefile
+++ b/mail/hydroxide/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	hydroxide
 DISTVERSIONPREFIX=	v
 DISTVERSION=	0.2.29
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	mail
 
 MAINTAINER=	nxjoseph@protonmail.com
@@ -13,7 +13,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 USES=		go:modules
 USE_GITHUB=	yes
-GH_ACCOUNT=	emersion
+GH_ACCOUNT=	nxjosephofficial
 GH_TUPLE=	ProtonMail:go-crypto:v1.0.0:protonmail_go_crypto/vendor/github.com/ProtonMail/go-crypto \
 		boltdb:bolt:v1.3.1:boltdb_bolt/vendor/github.com/boltdb/bolt \
 		cloudflare:circl:v1.3.7:cloudflare_circl/vendor/github.com/cloudflare/circl \
diff --git a/mail/hydroxide/distinfo b/mail/hydroxide/distinfo
index c38b89cfd806..6f93acce324c 100644
--- a/mail/hydroxide/distinfo
+++ b/mail/hydroxide/distinfo
@@ -1,6 +1,6 @@
-TIMESTAMP = 1719692102
-SHA256 (emersion-hydroxide-v0.2.29_GH0.tar.gz) = 96f1f1cc058544365a31d9b9c64fe44073092b36f95784c044b88641849448bc
-SIZE (emersion-hydroxide-v0.2.29_GH0.tar.gz) = 45566
+TIMESTAMP = 1723902839
+SHA256 (nxjosephofficial-hydroxide-v0.2.29_GH0.tar.gz) = 504732b22d97d95db73e799878fa5dc974a151b491cd4c11867970d6aadbf45e
+SIZE (nxjosephofficial-hydroxide-v0.2.29_GH0.tar.gz) = 45559
 SHA256 (ProtonMail-go-crypto-v1.0.0_GH0.tar.gz) = 596e264d2df6beb3ec40e47286f86960845ab227cb635150ef3bd35a90a79e43
 SIZE (ProtonMail-go-crypto-v1.0.0_GH0.tar.gz) = 333515
 SHA256 (boltdb-bolt-v1.3.1_GH0.tar.gz) = b5ae498b780f535a5d308c188dee1329b3536275d29ad6758876084c0b8586a8
diff --git a/mail/hydroxide/files/hydroxide.in b/mail/hydroxide/files/hydroxide.in
index 9bbc41c4853a..6e4cfed34c38 100644
--- a/mail/hydroxide/files/hydroxide.in
+++ b/mail/hydroxide/files/hydroxide.in
@@ -27,17 +27,26 @@ esac
 
 name=${name##*/}
 rcvar="${name}_enable"
+extra_commands="init"
+
+init_cmd="${name}_init"
+su_cmd="/usr/bin/su"
 
 load_rc_config "${name}"
 
 eval "${rcvar}=\${${rcvar}:-'NO'}"
-eval "_args=\${${name}_args:-''}"
-eval "_user=\${${name}_user:-'%%USER%%'}"
-eval "_log=\${${name}_log:-/dev/null}"
+eval "__args=\${${name}_args:-''}"
+eval "__user=\${${name}_user:-'%%USER%%'}"
+eval "__log=\${${name}_log:-/dev/null}"
 
 pidfile="/var/run/${name}.pid"
 
 command="/usr/sbin/daemon"
-command_args="-P ${pidfile} -u ${_user} -f -H -o ${_log} -m 3 %%PREFIX%%/bin/hydroxide ${_args} serve"
+command_args="-P ${pidfile} -u ${__user} -f -H -o ${__log} -m 3 %%PREFIX%%/bin/hydroxide ${__args} serve"
+
+hydroxide_init() {
+	read -p "Enter mail account id: " id
+	${su_cmd} -m ${__user} -c "%%PREFIX%%/bin/hydroxide auth $id"
+}
 
 run_rc_command "$1"
diff --git a/mail/hydroxide/pkg-message b/mail/hydroxide/pkg-message
new file mode 100644
index 000000000000..6573ce79fe8e
--- /dev/null
+++ b/mail/hydroxide/pkg-message
@@ -0,0 +1,13 @@
+[
+{ type: install
+  message: <<EOM
+You should authenticate your mail account first before using hydroxide.
+To authenticate:
+# service hydroxide init
+and follow the prompts.
+To enable/start hydroxide service:
+# service hydroxide enable
+# service hydroxide start
+EOM
+}
+]