From 8cded7b647ff2e37537dcdf4cfed2397ae41ced2 Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 18 Oct 2021 20:13:26 +1100 Subject: [PATCH] Add support for 66. --- src/init/init | 2 ++ src/slash-bedrock/etc/bedrock.conf | 32 ++++++++++++++++++++++++++++- src/slash-bedrock/libexec/brl-apply | 23 +++++++++++++++++++++ 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/src/init/init b/src/init/init index fb5a9b2c..3051d08b 100755 --- a/src/init/init +++ b/src/init/init @@ -413,6 +413,8 @@ if ! init_tuple="$(grep -q '\/etc/fstab-new && mv /etc/fstab-new /etc/fstab fi +# When using 66 init, make a tmpfs available for 66's LIVE directory. +# The init_cmd variable is exported by bedrock init for use here. +if [ -n $init_cmd ] && echo $init_cmd | grep -q '66'; then + live_dir=$(awk -F= '/^LIVE=/ { print $2 }' /etc/66/init.conf) + mkdir -p $live_dir + mount -t tmpfs tmpfs $live_dir -o rw,nosuid,nodev,mode=755,exec +fi + # Disable SELinux for stratum in $(/bedrock/bin/brl list -ei); do root="$(stratum_root --empty "${stratum}")" @@ -445,4 +453,19 @@ for stratum in $(/bedrock/bin/brl list -ei); do mv "${init}-bedrock-patch" "${init}" done +# Patch 66 init to skip unmounting /run, as this breaks Bedrock's pre-init setup of /run +for stratum in $(/bedrock/bin/brl list -ei); do + stratum_root="/bedrock/strata/${stratum}" + for init in "${stratum_root}/bin/66" "${stratum_root}/usr/bin/66"; do + if [ -x ${init} ] && grep -q '\-m' ${init}; then + cp "${init}" "${init}-bedrock-patch" + # This is obviously not robust against the various + # forms the call to 66-boot can take, but KISS is + # probably sufficient for now. + sed 's/-m//' "${init}" > "${init}-bedrock-patch" + mv "${init}-bedrock-patch" "${init}" + fi + done +done + exit_success