shimboot/bootloader/bin/bootstrap.sh

47 lines
1.3 KiB
Bash
Raw Normal View History

2023-10-02 02:08:31 -04:00
#!/bin/busybox sh
# Copyright 2015 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# To bootstrap the factory installer on rootfs. This file must be executed as
# PID=1 (exec).
# Note that this script uses the busybox shell (not bash, not dash).
#original: https://chromium.googlesource.com/chromiumos/platform/initramfs/+/refs/heads/main/factory_shim/bootstrap.sh
set +x
invoke_terminal() {
local tty="$1"
local title="$2"
shift
shift
# Copied from factory_installer/factory_shim_service.sh.
echo "${title}" >>${tty}
setsid sh -c "exec script -afqc '$*' /dev/null <${tty} >>${tty} 2>&1 &"
}
enable_debug_console() {
local tty="$1"
2023-10-03 13:39:24 -04:00
echo -e '\033[1;33m[cros_debug] enabled on '${tty}'.\033[m'
2023-10-02 02:08:31 -04:00
invoke_terminal "${tty}" "[Bootstrap Debug Console]" "/bin/busybox sh"
}
2023-10-03 20:29:55 -04:00
find_rootfs_partitions() {
disks=$(fdisk -l | sed -n "s/Disk \(\/dev\/.*\):.*/\1/p")
for disk in $disks; do
echo $disk
done
}
2023-10-02 02:08:31 -04:00
main() {
2023-10-03 13:39:24 -04:00
echo "...:::||| Bootstrapping ChromeOS Factory Shim |||:::..."
echo "TTY: ${TTY}, LOG: ${LOG_TTY}, echo: ${echo_TTY}, DEBUG: ${DEBUG_TTY}"
2023-10-02 02:08:31 -04:00
echo "idk please work"
2023-10-03 20:29:55 -04:00
find_rootfs_partitions
2023-10-02 02:08:31 -04:00
enable_debug_console "/dev/pts/0"
}
main "$@"
sleep 1d