From 355781b2ed1647555f93517129d41cd67f19c4ea Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Sun, 25 Nov 2018 21:11:58 +0100 Subject: net-misc/minidlna: Defer creating user/group to preinst MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- net-misc/minidlna/minidlna-1.2.1-r1.ebuild | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) (limited to 'net-misc/minidlna') diff --git a/net-misc/minidlna/minidlna-1.2.1-r1.ebuild b/net-misc/minidlna/minidlna-1.2.1-r1.ebuild index 70feaa8392b6..999de5da773d 100644 --- a/net-misc/minidlna/minidlna-1.2.1-r1.ebuild +++ b/net-misc/minidlna/minidlna-1.2.1-r1.ebuild @@ -33,22 +33,6 @@ CONFIG_CHECK="~INOTIFY_USER" PATCHES=( "${WORKDIR}"/${PN}-gentoo-artwork.patch "${FILESDIR}"/${P}-buildsystem.patch ) -pkg_setup() { - local my_is_new="yes" - [ -d "${EPREFIX}"/var/lib/${PN} ] && my_is_new="no" - enewgroup ${PN} - enewuser ${PN} -1 -1 /var/lib/${PN} ${PN} - if [ -d "${EPREFIX}"/var/lib/${PN} ] && [ "${my_is_new}" == "yes" ] ; then - # created by above enewuser command w/ wrong group and permissions - chown ${PN}:${PN} "${EPREFIX}"/var/lib/${PN} || die - chmod 0750 "${EPREFIX}"/var/lib/${PN} || die - # if user already exists, but /var/lib/minidlna is missing - # rely on ${D}/var/lib/minidlna created in src_install - fi - - linux-info_pkg_setup -} - src_prepare() { sed -e "/log_dir/s:/var/log:/var/log/${PN}:" \ -e "/db_dir/s:/var/cache/:/var/lib/:" \ @@ -86,13 +70,30 @@ src_install() { systemd_dotmpfilesd "${T}"/${PN}.conf keepdir /var/{lib,log}/${PN} - fowners ${PN}:${PN} /var/{lib,log}/${PN} - fperms 0750 /var/{lib,log}/${PN} dodoc AUTHORS NEWS README TODO doman ${PN}d.8 ${PN}.conf.5 } +pkg_preinst() { + local my_is_new="yes" + [ -d "${EPREFIX}"/var/lib/${PN} ] && my_is_new="no" + + enewgroup ${PN} + enewuser ${PN} -1 -1 /var/lib/${PN} ${PN} + + fowners ${PN}:${PN} /var/{lib,log}/${PN} + fperms 0750 /var/{lib,log}/${PN} + + if [ -d "${EPREFIX}"/var/lib/${PN} ] && [ "${my_is_new}" == "yes" ] ; then + # created by above enewuser command w/ wrong group and permissions + chown ${PN}:${PN} "${EPREFIX}"/var/lib/${PN} || die + chmod 0750 "${EPREFIX}"/var/lib/${PN} || die + # if user already exists, but /var/lib/minidlna is missing + # rely on ${D}/var/lib/minidlna created in src_install + fi +} + pkg_postinst() { elog "minidlna now runs as minidlna:minidlna (bug 426726)," elog "logfile is moved to /var/log/minidlna/minidlna.log," -- cgit v1.2.3-65-gdbad