summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko van der Vossen2018-11-01 02:27:55 +0100
committerRemko van der Vossen2018-11-02 08:33:27 +0100
commit577be8dad91bc56d22140004cb44ce051dfd6dd1 (patch)
tree43d85d5f04959607f2b2946d9d6f91151210e60f
parent8f4734f932e2db98866e8e0379c3aa5c19ea985d (diff)
eudev: only check kernel config when not in a chroot
-rw-r--r--chroot.function18
-rw-r--r--disk/eudev/HISTORY3
-rwxr-xr-xdisk/eudev/PRE_BUILD49
3 files changed, 47 insertions, 23 deletions
diff --git a/chroot.function b/chroot.function
new file mode 100644
index 0000000000..5ebb93ed20
--- /dev/null
+++ b/chroot.function
@@ -0,0 +1,18 @@
+#---------------------------------------------------------------------
+## @Synopsis Set of functions for handling chroots
+##
+## @Copyright Source Mage Team
+#---------------------------------------------------------------------
+
+#---------------------------------------------------------------------
+## Determine whether the current environment is a chroot or not.
+##
+## Limitation; the chroot will not be detected if the chroot is using
+## "/" as a mountpoint or if pid 1 itself is the chroot.
+##
+## @return 0 if the current environment is a chroot
+## @return 1 if the current environment is not a chroot
+#---------------------------------------------------------------------
+function is_chroot() {
+ [[ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]]
+}
diff --git a/disk/eudev/HISTORY b/disk/eudev/HISTORY
index 012721e18b..d20589ab8d 100644
--- a/disk/eudev/HISTORY
+++ b/disk/eudev/HISTORY
@@ -1,3 +1,6 @@
+2018-11-01 Remko van der Vossen <wich@sourcemage.org>
+ * PRE_BUILD: only check kernel config when not in a chroot
+
2018-10-13 Pavel Vinogradov <public@sourcemage.org>
* DETAILS: version 3.2.6
* PRE_BUILD, fix-modes.patch: added upstream fix to default rules
diff --git a/disk/eudev/PRE_BUILD b/disk/eudev/PRE_BUILD
index 366cf46397..7172e9e7a8 100755
--- a/disk/eudev/PRE_BUILD
+++ b/disk/eudev/PRE_BUILD
@@ -1,30 +1,33 @@
-if [[ "$(get_kernel_config CONFIG_DEVTMPFS)" != "y" &&
- "$(get_kernel_config CONFIG_DEVTMPFS_MOUNT)" != "y" ]]; then
- message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
- "CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT built-in${DEFAULT_COLOR}" &&
- return 1
-fi &&
+. "$GRIMOIRE"/chroot.function
-if [[ "$(get_kernel_config CONFIG_FHANDLE)" != "y" ]]; then
- message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
- "CONFIG_FHANDLE built-in${DEFAULT_COLOR}" &&
- return 1
-fi &&
+if ! is_chroot; then
+ if [[ "$(get_kernel_config CONFIG_DEVTMPFS)" != "y" &&
+ "$(get_kernel_config CONFIG_DEVTMPFS_MOUNT)" != "y" ]]; then
+ message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
+ "CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT built-in${DEFAULT_COLOR}" &&
+ return 1
+ fi &&
-if [[ "$(get_kernel_config CONFIG_NET)" != "y" ]]; then
- message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
- "CONFIG_NET built-in${DEFAULT_COLOR}" &&
- return 1
-fi &&
+ if [[ "$(get_kernel_config CONFIG_FHANDLE)" != "y" ]]; then
+ message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
+ "CONFIG_FHANDLE built-in${DEFAULT_COLOR}" &&
+ return 1
+ fi &&
-# Disable userspace firmware loader in Linux 3.7+
-if [[ "$(get_kernel_version|cut -d. -f3)" -ge "37" &&
- "$(get_kernel_config CONFIG_FW_LOADER_USER_HELPER)" == "y" ]]; then
- message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
- "CONFIG_FW_LOADER_USER_HELPER disabled${DEFAULT_COLOR}" &&
- return 1
-fi &&
+ if [[ "$(get_kernel_config CONFIG_NET)" != "y" ]]; then
+ message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
+ "CONFIG_NET built-in${DEFAULT_COLOR}" &&
+ return 1
+ fi &&
+ # Disable userspace firmware loader in Linux 3.7+
+ if [[ "$(get_kernel_version|cut -d. -f3)" -ge "37" &&
+ "$(get_kernel_config CONFIG_FW_LOADER_USER_HELPER)" == "y" ]]; then
+ message "${SPELL_COLOR}$SPELL${DEFAULT_COLOR}${PROBLEM_COLOR} requires" \
+ "CONFIG_FW_LOADER_USER_HELPER disabled${DEFAULT_COLOR}" &&
+ return 1
+ fi
+fi &&
create_group input &&
default_pre_build &&