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.

149 lines
3.0 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/etc_rc.d_rc.sysinit.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. . /etc/rc.d/functions.in
  16. banner "I am Idunn, take an apple and live forever."
  17. # keep the console clean
  18. if [ -x /bin/dmesg ]; then
  19. dmesg -n 3
  20. dmesg > /var/log/boot.log
  21. fi
  22. title "Mounting special filesystems"
  23. check mount -n -t proc proc /proc
  24. check mount -n -t sysfs sysfs /sys
  25. check mount -n -t tmpfs tmp /tmp
  26. status
  27. # Parse command line
  28. init=
  29. root=
  30. root_mode=
  31. for x in $(cat /proc/cmdline | tr -d ";\"'"); do
  32. case "$x" in
  33. ro|rw) root_mode=$x ;;
  34. root=*|init=*)
  35. eval "$x" ;;
  36. esac
  37. done
  38. cat > /etc/conf/idunn <<EOT
  39. rootfs="/rootfs"
  40. root="$root"
  41. root_mode="${root_mode:-rw}"
  42. init="${init:-/sbin/init}"
  43. initopt="$*"
  44. EOT
  45. title "Preparing /dev"
  46. check mount -n -t tmpfs udev /dev
  47. check mkdir /dev/pts
  48. check mount -n -t devpts devpts /dev/pts
  49. check cp -a /lib/udev/devices/* /dev
  50. status
  51. title "Starting supervisor"
  52. check start-stop-daemon -S -b -x /usr/bin/runsvdir -- /var/service/
  53. status
  54. # assuming the network module is built-in, start it earlier
  55. for x in $(unet pending); do
  56. title "Starting network (interface:$x)"
  57. check unet $x up
  58. status
  59. done
  60. # wait for udev
  61. while [ ! -d /dev/.udev/ ]; do
  62. sleep 1;
  63. done
  64. # load/blacklist modules
  65. if [ -x /sbin/modprobe -a -n "$modules" ]; then
  66. title "Preloading requested kernel modules"
  67. for x in $(echo "$modules" | tr ':' ' '); do
  68. if expr "$x" : - > /dev/null; then
  69. echo "blacklist ${x#-}" >> /etc/modprobe.conf
  70. else
  71. check modprobe $(echo "$x" | tr ',' ' ')
  72. fi
  73. done
  74. status
  75. fi
  76. force_shell=
  77. use_lvm=
  78. use_mdadm=
  79. if [ -n "$idunn" ]; then
  80. for x in $(echo "$idunn" | tr ':' ' '); do
  81. case "$x" in
  82. *=*) y="${x#*=}"
  83. x="${x%%=*}"
  84. ;;
  85. no*) x="${x#no}"
  86. y="no"
  87. ;;
  88. *) y="yes"
  89. ;;
  90. esac
  91. case "$x" in
  92. shell) force_shell=$y ;;
  93. lvm|mdadm) eval use_${x}=$y ;;
  94. esac
  95. done
  96. fi
  97. title "Triggering coldplug"
  98. check udevtrigger
  99. check udevsettle
  100. status
  101. # and for those which appeared after udevtrigger
  102. for x in $(unet pending); do
  103. title "Starting network (interface:$x)"
  104. check unet $x up
  105. status
  106. done
  107. if [ "$use_mdadm" = "yes" ]; then
  108. title "Detecting RAID volumes"
  109. check mdadm -Esv > /etc/mdadm.conf
  110. status
  111. fi
  112. if [ -s /etc/mdadm.conf ]; then
  113. title "Starting RAID volumes"
  114. check mdadm -As
  115. sleep 1
  116. status
  117. fi
  118. if [ "$use_lvm" = "yes" ]; then
  119. title "Detecting LVM volumes"
  120. check vgscan
  121. status
  122. fi
  123. if [ -n "$(ls -1 /etc/lvm/archive/*.vg 2> /dev/null)" ]; then
  124. title "Starting LVM volumes"
  125. modprobe dm-mod
  126. check vgchange -ay
  127. status
  128. fi