summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-11-25 21:11:58 +0100
committerMichał Górny <mgorny@gentoo.org>2018-11-25 22:42:54 +0100
commit355781b2ed1647555f93517129d41cd67f19c4ea (patch)
treed1d49ba468d50c5505d0250b6462ee9c5165bfdf /net-misc/minidlna
parentnet-misc/minidlna: Fix installing empty directories (diff)
downloadgentoo-355781b2ed1647555f93517129d41cd67f19c4ea.tar.gz
gentoo-355781b2ed1647555f93517129d41cd67f19c4ea.tar.bz2
gentoo-355781b2ed1647555f93517129d41cd67f19c4ea.zip
net-misc/minidlna: Defer creating user/group to preinst
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'net-misc/minidlna')
-rw-r--r--net-misc/minidlna/minidlna-1.2.1-r1.ebuild37
1 files changed, 19 insertions, 18 deletions
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,"