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.

57 lines
1.2 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 || return
  23. # stop services
  24. /etc/rc.d/rc.shutdown 2>&1 | tee -a $LOG
  25. # TODO: killall!
  26. # unmount stuff
  27. grep '^/' /proc/mounts | cut -d' ' -f2 | tac | while read x; do
  28. umount "$x"
  29. done
  30. case "$1" in
  31. USR1) halt -f ;;
  32. USR2) poweroff -f ;;
  33. *) reboot -f ;;
  34. esac
  35. }
  36. for x in USR1 USR2 TERM INT; do
  37. trap "shutoff_handler $x" $x
  38. done
  39. # start the world
  40. /etc/rc.d/rc.sysinit 2>&1 | tee -a $LOG
  41. # attach a console
  42. ln -s /etc/console /var/service/
  43. while true; do
  44. sleep 1;
  45. done