Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ading2210
GitHub Repository: ading2210/shimboot
Path: blob/main/bootloader/bin/init
596 views
#!/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.
#
# /init script for use in factory install shim.
# 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/init

set -x

detect_tty() {
  if [ -f "/bin/frecon-lite" ]; then
    export TTY1="/dev/pts/0"
    export TTY2="/dev/pts/1"
  else
    export TTY1="/dev/tty1"
    export TTY2="/dev/tty2"
  fi
}

setup_environment() {
  # Install additional utility programs.
  /bin/busybox --install /bin || true
}

main() {
  setup_environment
  detect_tty
  # In case an error is not handled by bootstrapping, stop here
  # so that an operator can see installation stop.
  exec bootstrap.sh < "$TTY1" >> "$TTY1" 2>&1 || sleep 1d
}

main "$@"
exit 1