net-misc/fedigroup: service fixups

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
This commit is contained in:
Anna (cybertailor) Vyalkova
2022-11-19 00:21:49 +05:00
parent d3eb4d68a5
commit d3090e4b78
2 changed files with 21 additions and 6 deletions

View File

@@ -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
}

View File

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