commit:     d3090e4b78439fc96fbf2347a1a8914f85ed8737
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Fri Nov 18 19:21:49 2022 +0000
Commit:     Anna Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
CommitDate: Fri Nov 18 19:21:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=d3090e4b

net-misc/fedigroup: service fixups

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

 net-misc/fedigroup/fedigroup-1.0.6.ebuild |  3 +++
 net-misc/fedigroup/files/fedigroup.initd  | 24 ++++++++++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/net-misc/fedigroup/fedigroup-1.0.6.ebuild 
b/net-misc/fedigroup/fedigroup-1.0.6.ebuild
index 5bfe940c0..8df23b047 100644
--- a/net-misc/fedigroup/fedigroup-1.0.6.ebuild
+++ b/net-misc/fedigroup/fedigroup-1.0.6.ebuild
@@ -35,4 +35,7 @@ src_install() {
 
        newinitd "${FILESDIR}"/fedigroup.initd ${PN}
        newconfd "${FILESDIR}"/fedigroup.confd ${PN}
+
+       diropts --owner fedigroup --group fedigroup
+       keepdir /var/lib/fedigroup
 }

diff --git a/net-misc/fedigroup/files/fedigroup.initd 
b/net-misc/fedigroup/files/fedigroup.initd
index cb27094c4..bc3674b3a 100644
--- a/net-misc/fedigroup/files/fedigroup.initd
+++ b/net-misc/fedigroup/files/fedigroup.initd
@@ -25,6 +25,8 @@ depend() {
 
 fix_config_perms() {
        checkpath -q -o fedigroup:fedigroup -m 0640 -f "${FEDIGROUP_CONFIG}"
+       checkpath -q -o fedigroup:fedigroup -f "${output_log}"
+       return $?
 }
 
 start_pre() {
@@ -39,26 +41,36 @@ start_pre() {
 }
 
 create() {
-       local name=""
+       einfo "When asked, make sure savepoint file is created in the 
/var/lib/fedigroup directory"
        printf "Enter the name of the bot to be created: "
        read name
 
        fix_config_perms || return 1
        "${command}" create "${name}" -c "${FEDIGROUP_CONFIG}" || return 1
+
+       initd="/etc/init.d/fedigroup.${name}"
+       [ -f "${initd}" ] ||
+               cp "/etc/init.d/fedigroup" "${initd}"
+
+       einfo "Done! To start the bot, use the following command:"
+       einfo " # rc-service fedigroup.${name} start"
 }
 
 remove() {
-       local name=""
        printf "Enter the name of the bot to be removed: "
        read name
 
        fix_config_perms || return 1
-       start-stop-daemon --quiet --exec "${command}" \
+       start-stop-daemon --exec "${command}" \
                -- remove "${name}" -c "${FEDIGROUP_CONFIG}" || return 1
+
+       initd="/etc/init.d/fedigroup.${name}"
+       [ -f "${initd}" ] && \
+               einfo "Service file ${initd} needs to be removed manually"
 }
 
 list() {
-       fix_config_perms || return 1
-       start-stop-daemon --quiet --exec "${command}" \
-               -- list -c "${FEDIGROUP_CONFIG}" || return 1
+       start-stop-daemon --exec "${command}" \
+               -- list -c "${FEDIGROUP_CONFIG}"
+       return $?
 }

Reply via email to