From cb253416acfb8d7f2738d1e1933ec3a0acf85827 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Wed, 27 Jan 2016 14:33:56 -0800 Subject: [PATCH] baselayout: tolerate /proc and friends being mounted read-only --- ...5-r3.ebuild => baselayout-3.0.15-r4.ebuild} | 0 .../sys-apps/baselayout/baselayout-9999.ebuild | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+) rename sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/{baselayout-3.0.15-r3.ebuild => baselayout-3.0.15-r4.ebuild} (100%) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-3.0.15-r3.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-3.0.15-r4.ebuild similarity index 100% rename from sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-3.0.15-r3.ebuild rename to sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-3.0.15-r4.ebuild diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild index a0229c1ae6..63c3306fd2 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/baselayout/baselayout-9999.ebuild @@ -34,6 +34,12 @@ RDEPEND="${DEPEND} >=sys-apps/gentoo-functions-0.10 cros_host? ( !coreos-base/coreos-init )" +MOUNT_POINTS=( + /dev + /proc + /sys +) + declare -A LIB_SYMS # list of /lib->lib64 symlinks declare -A USR_SYMS # list of /foo->usr/foo symlinks declare -a BASE_DIRS # list of absolute paths that should be directories @@ -116,6 +122,13 @@ src_install() { # Fill in all other paths defined in tmpfiles configs systemd-tmpfiles --root="${D}" --create + # The above created a few mount points but leave those out of the + # package since they may be mounted read-only. postinst can make them. + local mnt + for mnt in "${MOUNT_POINTS[@]}"; do + rmdir "${D}${mnt}" || die + done + doenvd "env.d/99coreos_ldpath" # handle multilib paths. do it here because we want this behavior @@ -166,6 +179,11 @@ src_install() { } pkg_postinst() { + # best-effort creation of mount points + local mnt + for mnt in "${MOUNT_POINTS[@]}"; do + [[ -d "${ROOT}${mnt}" ]] || mkdir "${ROOT}${mnt}" + done # Set up /usr/lib/debug to match the root filesystem layout # FIXME: This is done in postinst right now and all errors are ignored # as a transitional scheme, this isn't important enough to migrate