commit: 85e669f604e31250cfbacd6b358c5e248382d784 Author: Mike Gilbert <floppym <AT> gentoo <DOT> org> AuthorDate: Fri Jun 2 20:16:11 2017 +0000 Commit: Mike Gilbert <floppym <AT> gentoo <DOT> org> CommitDate: Fri Jun 2 20:17:49 2017 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=85e669f6
sys-apps/systemd: rework symlinks for merged usr systems Use absolute paths to avoid breaking symlinks across /usr. Remove symlinks in pkg_preinst if they would cause a collision. Package-Manager: Portage-2.3.6_p1, Repoman-2.3.2_p69 sys-apps/systemd/systemd-9999.ebuild | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/sys-apps/systemd/systemd-9999.ebuild b/sys-apps/systemd/systemd-9999.ebuild index beab35a7441..098d5affbf1 100644 --- a/sys-apps/systemd/systemd-9999.ebuild +++ b/sys-apps/systemd/systemd-9999.ebuild @@ -301,9 +301,9 @@ multilib_src_install_all() { if use sysv-utils; then for app in halt poweroff reboot runlevel shutdown telinit; do - dosym "..${ROOTPREFIX%/}/bin/systemctl" /sbin/${app} + dosym "${EPREFIX}${ROOTPREFIX%/}/bin/systemctl" /sbin/${app} done - dosym "..${ROOTPREFIX%/}/lib/systemd/systemd" /sbin/init + dosym "${EPREFIX}${ROOTPREFIX%/}/lib/systemd/systemd" /sbin/init else # we just keep sysvinit tools, so no need for the mans rm "${ED%/}"/usr/share/man/man8/{halt,poweroff,reboot,runlevel,shutdown,telinit}.8 \ @@ -331,8 +331,8 @@ multilib_src_install_all() { if [[ ! -e "${ED%/}"/usr/lib/systemd/systemd ]]; then # Avoid breaking boot/reboot - dosym "../../..${ROOTPREFIX%/}/lib/systemd/systemd" /usr/lib/systemd/systemd - dosym "../../..${ROOTPREFIX%/}/lib/systemd/systemd-shutdown" /usr/lib/systemd/systemd-shutdown + dosym "${EPREFIX}${ROOTPREFIX%/}/lib/systemd/systemd" /usr/lib/systemd/systemd + dosym "${EPREFIX}${ROOTPREFIX%/}/lib/systemd/systemd-shutdown" /usr/lib/systemd/systemd-shutdown fi } @@ -380,6 +380,19 @@ migrate_locale() { fi } +pkg_preinst() { + # If /lib/systemd and /usr/lib/systemd are the same directory, remove the + # symlinks we created in src_install. + if [[ $(realpath "${EROOT%/}${ROOTPREFIX}/lib/systemd") == $(realpath "${EROOT%/}/usr/lib/systemd") ]]; then + if [[ -L ${ED%/}/usr/lib/systemd/systemd ]]; then + rm "${ED%/}/usr/lib/systemd/systemd" || die + fi + if [[ -L ${ED%/}/usr/lib/systemd/systemd-shutdown ]]; then + rm "${ED%/}/usr/lib/systemd/systemd-shutdown" || die + fi + fi +} + pkg_postinst() { newusergroup() { enewgroup "$1"