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 $?
+}