Idunn is an small system aiming to give an early rescue/install environment with ssh support, making life easier when one doesn't have physical access to machine.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.3 KiB

  1. #!/bin/sh
  2. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # Filename: target/idunn/initramfs/init.sh
  6. # Copyright (C) 2008 The OpenSDE Project
  7. #
  8. # More information can be found in the files COPYING and README.
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; version 2 of the License. A copy of the
  13. # GNU General Public License can be found in the file COPYING.
  14. # --- SDE-COPYRIGHT-NOTE-END ---
  15. export PATH
  16. LOG=/var/log/init.log
  17. # catch some signals
  18. #
  19. shutoff_handler() {
  20. local x=
  21. # just once!
  22. ln -s / /var/run/init.lock 2> /dev/null || return
  23. # stop services
  24. /etc/rc.d/rc.shutdown
  25. # terminate the rest
  26. sleep 1
  27. killall5 -s TERM
  28. sleep 2
  29. # unmount stuff
  30. grep '^/' /proc/mounts | cut -d' ' -f2 | tac | while read x; do
  31. umount -r "$x"
  32. done
  33. # kill'em all
  34. killall5 -s KILL
  35. sleep 1
  36. # an umount the rest
  37. umount -ar
  38. case "$1" in
  39. USR1) halt -f ;;
  40. USR2) poweroff -f ;;
  41. *) reboot -f ;;
  42. esac
  43. }
  44. for x in USR1 USR2 TERM INT; do
  45. trap "shutoff_handler $x" $x
  46. done
  47. unset x
  48. # start the world
  49. (
  50. /etc/rc.d/rc.sysinit
  51. /etc/rc.d/rc.trymount
  52. ) 2>&1 | tee -a $LOG
  53. # attach a console
  54. ln -s /etc/console /var/service/
  55. while true; do
  56. sleep 1;
  57. done