sys-apps/systemd: remove ROOTPREFIX variable and add usrmerge USE flag
authorMike Gilbert <floppym@gentoo.org>
Mon, 20 Nov 2017 22:01:14 +0000 (17:01 -0500)
committerMike Gilbert <floppym@gentoo.org>
Mon, 20 Nov 2017 22:02:47 +0000 (17:02 -0500)
Package-Manager: Portage-2.3.14_p5, Repoman-2.3.6

sys-apps/systemd/metadata.xml
sys-apps/systemd/systemd-9999.ebuild

index 357ed6005f92a1d6d624447112e0fbe8544a7034..85e4b806ba6c3fa413e8643a4ac804d081d4310f 100644 (file)
@@ -27,6 +27,7 @@
                <flag name="nat">Enable support for network address translation in networkd</flag>
                <flag name="qrcode">Enable qrcode output support in journal</flag>
                <flag name="sysv-utils">Install sysvinit compatibility symlinks and manpages for init, telinit, halt, poweroff, reboot, runlevel, and shutdown</flag>
+               <flag name="usrmerge">Enable /usr merge</flag>
                <flag name="vanilla">Disable Gentoo-specific behavior and compatibility quirks</flag>
                <flag name="xkb">Depend on <pkg>x11-libs/libxkbcommon</pkg> to allow logind to control the X11 keymap</flag>
        </use>
index 8256350c5e12867c9b4c5e0a5b6342671cbd5f63..68d217b7d1ccbfcd459d1e7f3432566753fe28df 100644 (file)
@@ -20,9 +20,7 @@ HOMEPAGE="https://www.freedesktop.org/wiki/Software/systemd"
 
 LICENSE="GPL-2 LGPL-2.1 MIT public-domain"
 SLOT="0/2"
-IUSE="acl apparmor audit build cryptsetup curl elfutils +gcrypt gnuefi http
-       idn importd +kmod libidn2 +lz4 lzma nat pam policykit
-       qrcode +seccomp selinux ssl sysv-utils test vanilla xkb"
+IUSE="acl apparmor audit build cryptsetup curl elfutils +gcrypt gnuefi http idn importd +kmod libidn2 +lz4 lzma nat pam policykit qrcode +seccomp selinux ssl sysv-utils test usrmerge vanilla xkb"
 
 REQUIRED_USE="importd? ( curl gcrypt lzma )"
 
@@ -200,9 +198,8 @@ multilib_src_configure() {
                -Dpamlibdir="$(getpam_mod_dir)"
                # avoid bash-completion dep
                -Dbashcompletiondir="$(get_bashcompdir)"
-               # make sure we get /bin:/sbin in $PATH
-               -Dsplit-usr=true
-               -Drootprefix="${EPREFIX}${ROOTPREFIX}"
+               # make sure we get /bin:/sbin in PATH
+               -Dsplit-usr=$(usex usrmerge false true)
                -Dsysvinit-path=
                -Dsysvrcnd-path=
                # no deps
@@ -299,10 +296,11 @@ multilib_src_install_all() {
        dodoc "${FILESDIR}"/nsswitch.conf
 
        if use sysv-utils; then
+               local app
                for app in halt poweroff reboot runlevel shutdown telinit; do
-                       dosym "${EPREFIX}${ROOTPREFIX%/}/bin/systemctl" /sbin/${app}
+                       dosym ../bin/systemctl /sbin/${app}
                done
-               dosym "${EPREFIX}${ROOTPREFIX%/}/lib/systemd/systemd" /sbin/init
+               dosym ../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 \
@@ -328,12 +326,12 @@ multilib_src_install_all() {
        rm -fr "${ED%/}"/etc/systemd/system/sockets.target.wants || die
        rm -fr "${ED%/}"/etc/systemd/system/sysinit.target.wants || die
 
-       rm -r "${ED%/}${ROOTPREFIX%/}/lib/udev/hwdb.d" || die
+       rm -r "${ED%/}"/lib/udev/hwdb.d || die
 
-       if [[ ! -e "${ED%/}"/usr/lib/systemd/systemd ]]; then
+       if ! use usrmerge; 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 ../../../lib/systemd/systemd /usr/lib/systemd/systemd
+               dosym ../../../lib/systemd/systemd-shutdown /usr/lib/systemd/systemd-shutdown
        fi
 }
 
@@ -381,19 +379,6 @@ 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"