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.

167 lines
3.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/etc_rc.d_rc.sysinit.sh
  6. # Copyright (C) 2008 - 2009 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. rootdelay=
  31. root_mode=
  32. for x in $(cat /proc/cmdline | tr -d ";\"'"); do
  33. case "$x" in
  34. ro|rw) root_mode=$x ;;
  35. root=*|init=*|rootdelay=*)
  36. eval "$x" ;;
  37. esac
  38. done
  39. root_method=device
  40. case "$root" in
  41. nfs:*) root="${root#nfs:}"
  42. root_method=nfs
  43. ;;
  44. UUID=*|LABEL=*)
  45. root_method=find
  46. ;;
  47. /dev/*)
  48. ;;
  49. *)
  50. [ -z "$root" ] || root="/dev/$root"
  51. ;;
  52. esac
  53. cat > /etc/conf/idunn <<EOT
  54. rootfs="/rootfs"
  55. root="$root"
  56. rootdelay="${rootdelay:-0}"
  57. root_method="$root_method"
  58. root_mode="${root_mode:-ro}"
  59. init="${init:-/sbin/init}"
  60. initopt="$*"
  61. EOT
  62. title "Preparing /dev"
  63. check mount -n -t tmpfs udev /dev
  64. check mkdir /dev/pts
  65. check mount -n -t devpts devpts /dev/pts
  66. check cp -a /lib/udev/devices/* /dev
  67. status
  68. title "Starting supervisor"
  69. check start-stop-daemon -S -b -x /usr/bin/runsvdir -- /var/service/
  70. status
  71. # wait for udev
  72. while [ ! -d /dev/.udev/ ]; do
  73. sleep 1;
  74. done
  75. # load/blacklist modules
  76. if [ -x /sbin/modprobe -a -n "$modules" ]; then
  77. title "Preloading requested kernel modules"
  78. for x in $(echo "$modules" | tr ':' ' '); do
  79. if expr "$x" : - > /dev/null; then
  80. echo "blacklist ${x#-}" >> /etc/modprobe.conf
  81. else
  82. check modprobe $(echo "$x" | tr ',' ' ')
  83. fi
  84. done
  85. status
  86. fi
  87. force_shell=
  88. use_lvm=
  89. use_mdadm=
  90. if [ -n "$idunn" ]; then
  91. for x in $(echo "$idunn" | tr ':' ' '); do
  92. case "$x" in
  93. *=*) y="${x#*=}"
  94. x="${x%%=*}"
  95. ;;
  96. no*) x="${x#no}"
  97. y="no"
  98. ;;
  99. *) y="yes"
  100. ;;
  101. esac
  102. case "$x" in
  103. shell) force_shell=$y ;;
  104. lvm|mdadm) eval use_${x}=$y ;;
  105. esac
  106. done
  107. fi
  108. # assuming the network module is built-in or preloaded, start it earlier
  109. for x in $(unet pending); do
  110. title "Starting network (interface:$x)"
  111. check unet $x up
  112. status
  113. done
  114. title "Triggering coldplug"
  115. check udevadm trigger
  116. check udevadm settle
  117. status
  118. # and for those which appeared after udevtrigger
  119. for x in $(unet pending); do
  120. title "Starting network (interface:$x)"
  121. check unet $x up
  122. status
  123. done
  124. if [ "$use_mdadm" = "yes" ]; then
  125. title "Detecting RAID volumes"
  126. check mdadm -Esv > /etc/mdadm.conf
  127. status
  128. fi
  129. if [ -s /etc/mdadm.conf ]; then
  130. title "Starting RAID volumes"
  131. check mdadm -As
  132. sleep 1
  133. status
  134. fi
  135. if [ "$use_lvm" = "yes" ]; then
  136. title "Detecting LVM volumes"
  137. check vgscan
  138. status
  139. fi
  140. if [ -n "$(ls -1 /etc/lvm/archive/*.vg 2> /dev/null)" ]; then
  141. title "Starting LVM volumes"
  142. modprobe dm-mod
  143. check vgchange -ay
  144. status
  145. fi