From a48e7520b4516aaf0182300e19e12ab87789c008 Mon Sep 17 00:00:00 2001 From: TheOddCell Date: Thu, 8 Jan 2026 21:35:51 -0500 Subject: [PATCH 1/7] Add temporary init --- src/init/init | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/init/init b/src/init/init index 11f12370..a860069f 100755 --- a/src/init/init +++ b/src/init/init @@ -68,8 +68,8 @@ ensure_essential_environment() { # If the user runs a non-zstd-aware depmod with a zstd-based module # set, it may clear modules.dep. If so, fix modules.dep. - if [ -e /lib/modules/$(uname -r)/modules.dep ] && \ - [ "$(stat -c%s "/lib/modules/$(uname -r)/modules.dep")" -eq 0 ]; then + if [ -e /lib/modules/$(uname -r)/modules.dep ] && + [ "$(stat -c%s "/lib/modules/$(uname -r)/modules.dep")" -eq 0 ]; then printf "Regenerating modules.dep... " /sbin/depmod echo "done" @@ -385,6 +385,12 @@ complete_upgrade init_timeout="$(cfg_values "init" "timeout")" def_tuple="$(cfg_values "init" "default")" +tmpinit="" +if [ -f "/bedrock/etc/tmpinit" ]; then + def_tuple="$(cat "/bedrock/etc/tmpinit")" + rm "/bedrock/etc/tmpinit" + tmpinit="true" +fi def_stratum="$(deref "$(echo "${def_tuple}" | cut -d: -f1)")" def_cmd="$(echo "${def_tuple}" | cut -d: -f2-)" def_path="" @@ -398,7 +404,11 @@ if [ -n "${def_tuple}" ] && [ -d "/bedrock/strata/${def_stratum}" ]; then umount "${sproc}" fi if [ -n "${def_tuple}" ] && [ -z "${def_path:-}" ]; then - notice "${color_warn}WARNING: ${color_file}/bedrock/etc/bedrock.conf [init]/default ${color_warn}value does not describe a valid stratum:init pair.${color_norm}" + if [ -z "$tmpinit" ]; then + notice "${color_warn}WARNING: ${color_file}/bedrock/etc/bedrock.conf [init]/default ${color_warn}value does not describe a valid stratum:init pair.${color_norm}" + else + notice "${color_warn}WARNING: ${color_file}/bedrock/etc/tmpinit ${color_warn} does not describe a valid stratum:init pair.${color_norm}" + fi fi if [ -z "${def_path:-}" ]; then init_timeout="-1" From a50804150df7419f49e347431b2db131a0f5f5f0 Mon Sep 17 00:00:00 2001 From: TheOddCell Date: Thu, 15 Jan 2026 19:20:51 -0500 Subject: [PATCH 2/7] Add command --- src/slash-bedrock/bin/brl | 4 ++-- src/slash-bedrock/libexec/brl-init | 35 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100755 src/slash-bedrock/libexec/brl-init diff --git a/src/slash-bedrock/bin/brl b/src/slash-bedrock/bin/brl index e8c5eb59..0036511b 100755 --- a/src/slash-bedrock/bin/brl +++ b/src/slash-bedrock/bin/brl @@ -36,7 +36,7 @@ ${color_term}Strata${color_norm} status management commands: ${color_cmd}enable ${color_norm}${color_term}Enable${color_norm} ${color_term}strata${color_norm} ${color_cmd}disable ${color_norm}${color_term}Disable${color_norm} ${color_term}strata${color_norm} ${color_cmd}repair ${color_norm}Repairs ${color_term}broken${color_norm} ${color_term}strata${color_norm} - + ${color_cmd}init ${color_norm}Choose which ${color_term}stratum${color_norm} the next reboot's init be. ${color_term}Strata${color_norm} visibility management commands: ${color_cmd}hide ${color_norm}${color_term}Hide${color_norm} ${color_term}strata${color_norm} ${color_cmd}show ${color_norm}${color_term}Show${color_norm} ${color_term}strata${color_norm} @@ -61,7 +61,7 @@ case "${1:-}" in print_help exit_success ;; -"strat" | "list" | "which" | "fetch" | "import" | "remove" | "rename" | "copy" | "status" | "enable" | "disable" | "repair" | "hide" | "show" | "alias" | "deref" | "apply" | "update" | "version" | "report" | "tutorial") +"strat" | "list" | "which" | "fetch" | "import" | "remove" | "rename" | "copy" | "status" | "enable" | "disable" | "repair" | "init" | "hide" | "show" | "alias" | "deref" | "apply" | "update" | "version" | "report" | "tutorial") backend="/bedrock/libexec/brl-${1}" shift exec "${backend}" "${@}" diff --git a/src/slash-bedrock/libexec/brl-init b/src/slash-bedrock/libexec/brl-init new file mode 100755 index 00000000..931ccc47 --- /dev/null +++ b/src/slash-bedrock/libexec/brl-init @@ -0,0 +1,35 @@ +#!/bedrock/libexec/busybox sh +# +# brl init +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 as published by the Free Software Foundation. +# +# Copyright (c) 2012-2018 Daniel Thau +# Copyright (c) 2026 TheOddCell +# +# Choose which stratum should be used as the default init for simply the next reboot. + +. /bedrock/share/common-code + +print_help() { + printf "Usage: ${color_cmd}brl init ${color_sub}[identifier]${color_norm} + +Choose which ${color_term}stratum${color_norm} the next reboot's init be. + +Examples: + ${color_cmd}$ brl init ${color_strat}arch${color_norm}:/sbin/init # make the ${color_strat}arch${color_strat} the default init, using /sbin/init + + ${color_cmd}$ brl init ${color_strat}void${color_norm}:/sbin/init # make the ${color_strat}void${color_strat} the default init, using /sbin/init + +${color_norm}" +} + +handle_help "${@:-}" + +require_root +echo "$1">/bedrock/etc/tmpinit +notice "Please reboot manually to switch init systems." + +exit_success From f192e7df0ab0f298850bcc77254e4464e34509bd Mon Sep 17 00:00:00 2001 From: TheOddCell Date: Thu, 15 Jan 2026 19:37:16 -0500 Subject: [PATCH 3/7] A bit of cleanup --- src/slash-bedrock/libexec/brl-init | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/slash-bedrock/libexec/brl-init b/src/slash-bedrock/libexec/brl-init index 931ccc47..c1e9edcd 100755 --- a/src/slash-bedrock/libexec/brl-init +++ b/src/slash-bedrock/libexec/brl-init @@ -14,19 +14,20 @@ . /bedrock/share/common-code print_help() { - printf "Usage: ${color_cmd}brl init ${color_sub}[identifier]${color_norm} + printf "Usage: ${color_cmd}brl init ${color_sub}[strat]${color_norm} Choose which ${color_term}stratum${color_norm} the next reboot's init be. Examples: - ${color_cmd}$ brl init ${color_strat}arch${color_norm}:/sbin/init # make the ${color_strat}arch${color_strat} the default init, using /sbin/init + ${color_cmd}$ brl init ${color_strat}arch${color_norm}:/sbin/init # make the ${color_strat}arch${color_strat} stratum the next reboot's init, using /lib/systemd/systemd - ${color_cmd}$ brl init ${color_strat}void${color_norm}:/sbin/init # make the ${color_strat}void${color_strat} the default init, using /sbin/init + ${color_cmd}$ brl init ${color_strat}void${color_norm}:/sbin/init # make the ${color_strat}void${color_strat} stratum the next reboot's init, using /sbin/init ${color_norm}" } handle_help "${@:-}" +min_args "${#}" "1" require_root echo "$1">/bedrock/etc/tmpinit From cf8c200c04c1d76bb714645fd0b1e529eb659aaf Mon Sep 17 00:00:00 2001 From: TheOddCell Date: Thu, 15 Jan 2026 19:43:33 -0500 Subject: [PATCH 4/7] embarrasing --- src/slash-bedrock/libexec/brl-init | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slash-bedrock/libexec/brl-init b/src/slash-bedrock/libexec/brl-init index c1e9edcd..61f59a4e 100755 --- a/src/slash-bedrock/libexec/brl-init +++ b/src/slash-bedrock/libexec/brl-init @@ -19,9 +19,9 @@ print_help() { Choose which ${color_term}stratum${color_norm} the next reboot's init be. Examples: - ${color_cmd}$ brl init ${color_strat}arch${color_norm}:/sbin/init # make the ${color_strat}arch${color_strat} stratum the next reboot's init, using /lib/systemd/systemd + ${color_cmd}$ brl init ${color_strat}arch${color_norm}:/lib/systemd/systemd # make the ${color_strat}arch${color_term} stratum ${color_norm}the next reboot's init, using /lib/systemd/systemd - ${color_cmd}$ brl init ${color_strat}void${color_norm}:/sbin/init # make the ${color_strat}void${color_strat} stratum the next reboot's init, using /sbin/init + ${color_cmd}$ brl init ${color_strat}void${color_norm}:/sbin/init # make the ${color_strat}void${color_term} stratum ${color_norm}the next reboot's init, using /sbin/init ${color_norm}" } From 1f40b73176d234ca1b3b8a886414ec8667f39693 Mon Sep 17 00:00:00 2001 From: TheOddCell Date: Thu, 15 Jan 2026 19:50:43 -0500 Subject: [PATCH 5/7] Who needs :/sbin/init when you have [blank]? --- src/slash-bedrock/libexec/brl-init | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/slash-bedrock/libexec/brl-init b/src/slash-bedrock/libexec/brl-init index 61f59a4e..c803c272 100755 --- a/src/slash-bedrock/libexec/brl-init +++ b/src/slash-bedrock/libexec/brl-init @@ -23,6 +23,8 @@ Examples: ${color_cmd}$ brl init ${color_strat}void${color_norm}:/sbin/init # make the ${color_strat}void${color_term} stratum ${color_norm}the next reboot's init, using /sbin/init + ${color_cmd}$ brl init ${color_strat}debian${color_norm} # make the ${color_strat}debian${color_term} stratum ${color_norm}the next reboot's init, using /sbin/init + ${color_norm}" } @@ -30,6 +32,15 @@ handle_help "${@:-}" min_args "${#}" "1" require_root +case "$1" in + *:*) + echo "$1">/bedrock/etc/tmpinit + ;; + *) + echo "$1:/sbin/init">/bedrock/etc/tmpinit + ;; +esac + echo "$1">/bedrock/etc/tmpinit notice "Please reboot manually to switch init systems." From 30d11435b69cf9dbc563009d2307928a8fc6b34b Mon Sep 17 00:00:00 2001 From: TheOddCell Date: Thu, 15 Jan 2026 19:54:30 -0500 Subject: [PATCH 6/7] Add completion (and remove reename) --- src/slash-bedrock/share/bash/completion/brl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/slash-bedrock/share/bash/completion/brl b/src/slash-bedrock/share/bash/completion/brl index fcdb39ba..802ab65a 100755 --- a/src/slash-bedrock/share/bash/completion/brl +++ b/src/slash-bedrock/share/bash/completion/brl @@ -59,7 +59,7 @@ _brl() { if [ "${COMP_CWORD}" -eq 1 ]; then opts="${opts} help strat list which fetch" opts="${opts} remove rename status enable" - opts="${opts} disable reename copy hide show" + opts="${opts} disable init copy hide show" opts="${opts} alias deref update reload" opts="${opts} version report tutorial" fi @@ -186,6 +186,9 @@ _brl() { "enable") opts="${opts} $(/bedrock/bin/brl list -dD)" ;; + "init") + opts="${opts} $(/bedrock/bin/brl list -dD)" + ;; "disable") for stratum in $(brl list -eE); do if [ "$(/bedrock/bin/brl deref "${stratum}")" = "bedrock" ]; then From c0f581ce0c18633ba57dc79f632b107412270efc Mon Sep 17 00:00:00 2001 From: TheOddCell Date: Thu, 15 Jan 2026 19:58:01 -0500 Subject: [PATCH 7/7] HOW DIDN'T I NOTICE? --- src/slash-bedrock/libexec/brl-init | 1 - 1 file changed, 1 deletion(-) diff --git a/src/slash-bedrock/libexec/brl-init b/src/slash-bedrock/libexec/brl-init index c803c272..791923c5 100755 --- a/src/slash-bedrock/libexec/brl-init +++ b/src/slash-bedrock/libexec/brl-init @@ -41,7 +41,6 @@ case "$1" in ;; esac -echo "$1">/bedrock/etc/tmpinit notice "Please reboot manually to switch init systems." exit_success