From b66f1ba7881b9053a25ea695138403799f50dd24 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 12 May 2018 15:07:23 +0200 Subject: [PATCH] fixed openrc script, fixed ebuild --- init/expandurl-mastodon.openrc | 11 ++++++++--- packages/gentoo/expandurl-mastodon-9999.ebuild | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/init/expandurl-mastodon.openrc b/init/expandurl-mastodon.openrc index d75279b..b50ce18 100755 --- a/init/expandurl-mastodon.openrc +++ b/init/expandurl-mastodon.openrc @@ -7,7 +7,6 @@ description="expandurl-mastodon - Mastodon bot that expands shortened URLs." pidfile="/var/run/expandurl-mastodon.pid" command="/usr/bin/expandurl-mastodon" -command_args="-p ${pidfile} ${NTPD_OPTS}" start_stop_daemon_args="-b -m --pidfile ${pidfile} -u ${EXPANDURL_USER}" depend() { @@ -15,8 +14,14 @@ depend() { } start_pre() { - if [ ! -f ${HOME}/.config/expandurl-mastodon.cfg ] ; then - eerror "Please create ${HOME}/.config/expandurl-mastodon.cfg" + local user_home="$(getent passwd ${EXPANDURL_USER} | cut -d: -f6)" + if [ -z ${user_home} ]; then + eerror "Home directory of \"${EXPANDURL_USER}\" not found" + return 1 + fi + + if [ ! -f ${user_home}/.config/expandurl-mastodon.cfg ] ; then + eerror "Please create ${user_home}/.config/expandurl-mastodon.cfg" return 1 fi return 0 diff --git a/packages/gentoo/expandurl-mastodon-9999.ebuild b/packages/gentoo/expandurl-mastodon-9999.ebuild index a215d6b..f13fe40 100644 --- a/packages/gentoo/expandurl-mastodon-9999.ebuild +++ b/packages/gentoo/expandurl-mastodon-9999.ebuild @@ -24,6 +24,6 @@ src_unpack() { src_install() { cmake-utils_src_install dodoc README.md - doinitd init/expandurl-mastodon.openrc expandurl-mastodon - echo "EXPANDURL_USER=\"expandurl\"" | doconfd - expandurl-mastodon + newinitd init/expandurl-mastodon.openrc expandurl-mastodon + echo "EXPANDURL_USER=\"expandurl\"" | newconfd - expandurl-mastodon }