aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2020-08-28 15:52:43 +0200
committerThomas Deutschmann <whissi@gentoo.org>2020-08-28 17:41:38 +0200
commit743800055c2b0a4bcb6f674c7543598ed8f843e8 (patch)
tree10cebe10ae73308bdd30165d83f405a12693540e /gkbuilds
parentgen_funcs.sh: _tc-getPROG(): Prevent override with empty value (diff)
downloadgenkernel-743800055c2b0a4bcb6f674c7543598ed8f843e8.tar.gz
genkernel-743800055c2b0a4bcb6f674c7543598ed8f843e8.tar.bz2
genkernel-743800055c2b0a4bcb6f674c7543598ed8f843e8.zip
Use switch_root from util-linux
switch_root from busybox does not move /dev, /sys, /proc and /run. If we do that manually there is a small window for a race condition when /dev, /sys or /proc is still needed but already moved. switch_root from util-linux will move these mounts on its own and will therefore avoid any potential problems. Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'gkbuilds')
-rw-r--r--gkbuilds/util-linux.gkbuild26
1 files changed, 24 insertions, 2 deletions
diff --git a/gkbuilds/util-linux.gkbuild b/gkbuilds/util-linux.gkbuild
index 81670c1..40ea1fb 100644
--- a/gkbuilds/util-linux.gkbuild
+++ b/gkbuilds/util-linux.gkbuild
@@ -1,6 +1,18 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
+src_prepare() {
+ default
+
+ # Build static switch_root
+ sed -i \
+ -e '/^switch_root_SOURCES =.*/a switch_root_LDFLAGS = -all-static' \
+ sys-utils/Makemodule.am \
+ || die
+
+ gkautoreconf
+}
+
src_configure() {
export ac_cv_header_security_pam_misc_h=no
export ac_cv_header_security_pam_appl_h=no
@@ -16,6 +28,7 @@ src_configure() {
--disable-widechar
--without-python
--disable-pylibmount
+ --enable-switch_root
--enable-static-programs=blkid
)
@@ -37,6 +50,15 @@ src_install() {
cp -a blkid.static "${D}"/sbin/blkid \
|| die "Failed to copy '${S}/blkid.static' to '${D}/sbin/blkid'!"
- "${STRIP}" --strip-all "${D}"/sbin/blkid \
- || die "Failed to strip '${D}/sbin/blkid'!"
+ cp -a switch_root "${D}"/sbin/switch_root \
+ || die "Failed to copy '${S}/switch_root' to '${D}/sbin/switch_root'!"
+
+ local sbin
+ for sbin in \
+ "${D}/sbin/blkid" \
+ "${D}/sbin/switch_root" \
+ ; do
+ "${STRIP}" --strip-all "${sbin}" \
+ || die "Failed to strip '${sbin}'!"
+ done
}