logo

live-bootstrap

Mirror of <https://github.com/fosslinux/live-bootstrap>

after.sh (982B)


  1. #!/bin/sh
  2. #
  3. # SPDX-FileCopyrightText: 2024 Gábor Stefanik <netrolller.3d@gmail.com>
  4. # SPDX-FileCopyrightText: 2025 Dor Askayo <dor.askayo@gmail.com>
  5. #
  6. # SPDX-License-Identifier: GPL-3.0-or-later
  7. #
  8. # After bootstrap, drop to a shell if needed, then shut down cleanly.
  9. . /steps/bootstrap.cfg
  10. . /steps/env
  11. if [ -d /steps/after ]; then
  12. after_scripts=$(find /steps/after -maxdepth 1 -type f -name '*.sh' -printf '%f\t%p\n' | sort -k1 -n | cut -f2)
  13. for script in $after_scripts; do
  14. bash "$script"
  15. done
  16. fi
  17. if [ "${INTERACTIVE}" = True ]; then
  18. env - PATH=${PREFIX}/bin PS1="\w # " setsid openvt -fec1 -- bash -i
  19. fi
  20. if [ "${CHROOT}" = False ]; then
  21. # ignore errors due to fstab or swapfile not existing
  22. swapoff -a &> /dev/null || true
  23. sync
  24. # sysrq to avoid device busy; then mount to wait for it to finish
  25. echo u > /proc/sysrq-trigger
  26. mount -o remount,ro /
  27. echo o > /proc/sysrq-trigger # power off
  28. while true; do sleep 1; done
  29. fi