public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/proj/guru:dev commit in: www-apps/gotosocial/files/
@ 2022-11-18 21:29 Anna Vyalkova
  0 siblings, 0 replies; only message in thread
From: Anna Vyalkova @ 2022-11-18 21:29 UTC (permalink / raw
  To: gentoo-commits

commit:     23ad0d03ad7be60f50dadad9d279e57be2936568
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Fri Nov 18 21:29:13 2022 +0000
Commit:     Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
CommitDate: Fri Nov 18 21:29:13 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=23ad0d03

www-apps/gotosocial: update initd service

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 www-apps/gotosocial/files/gotosocial.initd | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/www-apps/gotosocial/files/gotosocial.initd b/www-apps/gotosocial/files/gotosocial.initd
index 66f9efad8..91ed760c7 100644
--- a/www-apps/gotosocial/files/gotosocial.initd
+++ b/www-apps/gotosocial/files/gotosocial.initd
@@ -1,17 +1,42 @@
 #!/sbin/openrc-run
 # Copyright 2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
+# shellcheck shell=sh disable=SC2034
 
 : ${GOTOSOCIAL_CONFIG:=/etc/gotosocial/config.yaml}
 
+extra_commands="adduser"
+description_adduser="create a user"
+
 description="GoToSocial Server"
-command=/usr/bin/gotosocial
+command="/usr/bin/gotosocial"
 command_args="--config-path ${GOTOSOCIAL_CONFIG} server start"
 command_user="gotosocial:gotosocial"
-command_background=1
+command_background=yes
 pidfile="/run/gotosocial.pid"
 
 depend() {
 	need net
 	after postgresql
 }
+
+adduser() {
+	# handle Ctrl+C
+	trap "stty echo" INT
+
+	printf "Enter username: "
+	read username
+
+	printf "Enter email: "
+	read email
+
+	stty -echo
+	printf "Enter password: "
+	read password
+	stty echo
+
+	start-stop-daemon --exec "${command}" --user "${command_user}" -- \
+		--config-path "${GOTOSOCIAL_CONFIG}" admin account create \
+		--username "${username}" --email "${email}" --password "${password}"
+	return $?
+}


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-18 21:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-18 21:29 [gentoo-commits] repo/proj/guru:dev commit in: www-apps/gotosocial/files/ Anna Vyalkova

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox