From c1013f1b7f993a9c5d005c5b6d8f45436bdecfbe Mon Sep 17 00:00:00 2001 From: Davide Cavalca Date: Mon, 20 May 2024 21:56:01 -0700 Subject: [PATCH] Allow downstreams to brand the installer Add overrides for the distribution name and the docs URL so that downstreams can brand the installer as needed in their bootstrap script. Signed-off-by: Davide Cavalca --- src/main.py | 8 ++++---- src/step2/step2.sh | 5 +++-- src/stub.py | 1 + src/util.py | 3 +++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main.py b/src/main.py index bbdeeb1..e688d30 100644 --- a/src/main.py +++ b/src/main.py @@ -616,7 +616,7 @@ def step2_indirect(self, report=False): p_plain( " * If you are asked to 'Select a volume to recover',") p_plain( " then choose your normal macOS volume and click Next.") p_plain( " You may need to authenticate yourself with your macOS credentials.") - p_message( "7. Once the 'Asahi Linux installer' screen appears, follow the prompts.") + p_message(f"7. Once the '{DISTRO} installer' screen appears, follow the prompts.") print() p_warning( "If you end up in a bootloop or get a message telling you that macOS needs to") p_warning( "be reinstalled, that means you didn't follow the steps above properly.") @@ -798,13 +798,13 @@ def action_select_disk(self): def main(self): print() - p_message("Welcome to the Asahi Linux installer!") + p_message(f"Welcome to the {DISTRO} installer!") print() p_message("This installer will guide you through the process of setting up") - p_message("Asahi Linux on your Mac.") + p_message(f"{DISTRO} on your Mac.") print() p_message("Please make sure you are familiar with our documentation at:") - p_plain( f" {col(BLUE, BRIGHT)}https://alx.sh/w{col()}") + p_plain( f" {col(BLUE, BRIGHT)}{DISTRO_DOCS}{col()}") print() p_question("Press enter to continue.") self.input() diff --git a/src/step2/step2.sh b/src/step2/step2.sh index 0f78a8b..1932e8d 100755 --- a/src/step2/step2.sh +++ b/src/step2/step2.sh @@ -3,6 +3,7 @@ set -e +DISTRO="##DISTRO##" VGID="##VGID##" PREBOOT="##PREBOOT##" @@ -15,7 +16,7 @@ os_name="${system_dir##*/}" # clear printf '\033[2J\033[H' -echo "Asahi Linux installer (second step)" +echo "$DISTRO installer (second step)" echo echo "VGID: $VGID" echo "System volume: $system_dir" @@ -88,7 +89,7 @@ fi echo "You will see some messages advising you that you are changing the" echo "security level of your system. These changes apply only to your" -echo "Asahi Linux install, and are necessary to install a third-party OS." +echo "$DISTRO install, and are necessary to install a third-party OS." echo echo "Apple Silicon platforms maintain a separate security level for each" echo "installed OS, and are designed to retain their security with mixed OSes." diff --git a/src/stub.py b/src/stub.py index 29905d5..0b2f7a2 100644 --- a/src/stub.py +++ b/src/stub.py @@ -353,6 +353,7 @@ def install_files(self, cur_os): logging.info("Writing step2.sh") step2_sh = open("step2/step2.sh").read() + step2_sh = step2_sh.replace("##DISTRO##", DISTRO) step2_sh = step2_sh.replace("##VGID##", self.osi.vgid) step2_sh = step2_sh.replace("##PREBOOT##", self.osi.preboot_vgid) with open(self.step2_sh, "w") as fd: diff --git a/src/util.py b/src/util.py index ae7156d..ba22e91 100644 --- a/src/util.py +++ b/src/util.py @@ -10,6 +10,9 @@ COMPRESSION_LZFSE = 0x801 CHUNK_SIZE = 0x10000 +DISTRO = os.environ.get("DISTRO", "Asahi Linux") +DISTRO_DOCS = os.environ.get("DISTRO_DOCS", "https://alx.sh/w") + def ssize(v): suffixes = ["B", "KB", "MB", "GB", "TB"] for i in suffixes: