sys-apps/systemd: Add pkg_preinst check for system layout with USE="-split-usr".
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Thu, 12 Sep 2019 02:17:14 +0000 (02:17 +0000)
committerMike Gilbert <floppym@gentoo.org>
Thu, 12 Sep 2019 15:36:25 +0000 (11:36 -0400)
Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
sys-apps/systemd/systemd-243.ebuild
sys-apps/systemd/systemd-9999.ebuild

index d38227b0738b422381e02850117282ded5d1fc0f..267a18fcc1cf6ec1c6d33b62baae3b8339054b09 100644 (file)
@@ -419,6 +419,22 @@ save_enabled_units() {
 
 pkg_preinst() {
        save_enabled_units {machines,remote-{cryptsetup,fs}}.target getty@tty1.service
+
+       if ! use split-usr; then
+               local dir
+               for dir in bin sbin lib; do
+                       if [[ ! ${EROOT}/${dir} -ef ${EROOT}/usr/${dir} ]]; then
+                               eerror "\"${EROOT}/${dir}\" and \"${EROOT}/usr/${dir}\" are not merged."
+                               eerror "One of them should be a symbolic link to the other one."
+                               FAIL=1
+                       fi
+               done
+               if [[ ${FAIL} ]]; then
+                       eerror "Migration to system layout with merged directories must be performed before"
+                       eerror "rebuilding ${CATEGORY}/${PN} with USE=\"-split-usr\" to avoid run-time breakage."
+                       die "System layout with split directories still used"
+               fi
+       fi
 }
 
 pkg_postinst() {
index d38227b0738b422381e02850117282ded5d1fc0f..267a18fcc1cf6ec1c6d33b62baae3b8339054b09 100644 (file)
@@ -419,6 +419,22 @@ save_enabled_units() {
 
 pkg_preinst() {
        save_enabled_units {machines,remote-{cryptsetup,fs}}.target getty@tty1.service
+
+       if ! use split-usr; then
+               local dir
+               for dir in bin sbin lib; do
+                       if [[ ! ${EROOT}/${dir} -ef ${EROOT}/usr/${dir} ]]; then
+                               eerror "\"${EROOT}/${dir}\" and \"${EROOT}/usr/${dir}\" are not merged."
+                               eerror "One of them should be a symbolic link to the other one."
+                               FAIL=1
+                       fi
+               done
+               if [[ ${FAIL} ]]; then
+                       eerror "Migration to system layout with merged directories must be performed before"
+                       eerror "rebuilding ${CATEGORY}/${PN} with USE=\"-split-usr\" to avoid run-time breakage."
+                       die "System layout with split directories still used"
+               fi
+       fi
 }
 
 pkg_postinst() {