Skip to content

Commit

Permalink
Add support for 66.
Browse files Browse the repository at this point in the history
  • Loading branch information
flexibeast committed Oct 28, 2021
1 parent 0e0f3eb commit a9ed3a9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/init/init
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,8 @@ if ! init_tuple="$(grep -q '\<bedrock_init=' /proc/cmdline && sed -e 's/^.*bedro
fi
init_stratum="$(echo "${init_tuple}" | cut -d: -f1)"
init_cmd="$(echo "${init_tuple}" | cut -d: -f2-)"
# Make init_cmd available to brl-apply when we call it later.
export init_cmd

echo ""
step_init "6"
Expand Down
2 changes: 1 addition & 1 deletion src/slash-bedrock/etc/bedrock.conf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ default =
# Bedrock init menu will list every available one from every (unignored)
# stratum.
#
paths = /sbin/init, /sbin/fallback-init, /sbin/myinit, /sbin/ninit, /sbin/openrc-init, /sbin/runit-init, /sbin/simpleinit, /sbin/upstart, /lib/sysvinit/init, /lib/systemd/systemd, /usr/lib/systemd/systemd, /usr/bin/intra-desktop
paths = /sbin/init, /sbin/fallback-init, /sbin/myinit, /sbin/ninit, /sbin/openrc-init, /sbin/runit-init, /sbin/simpleinit, /sbin/upstart, /lib/sysvinit/init, /lib/systemd/systemd, /usr/lib/systemd/systemd, /usr/bin/intra-desktop, /bin/66, /usr/bin/66

#
# Kernel modules to load before assuming keyboard is available.
Expand Down
23 changes: 23 additions & 0 deletions src/slash-bedrock/libexec/brl-apply
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,14 @@ if [ -r /etc/fstab ] && awk '$1$2$3$4$5$6 !~ "#" && $6 != "" && $6 != 0 {x=1} EN
' /etc/fstab >/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}")"
Expand Down Expand Up @@ -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

0 comments on commit a9ed3a9

Please sign in to comment.