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 - 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. 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:-ro}"
  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. # wait for udev
  55. while [ ! -d /dev/.udev/ ]; do
  56. sleep 1;
  57. done
  58. # load/blacklist modules
  59. if [ -x /sbin/modprobe -a -n "$modules" ]; then
  60. title "Preloading requested kernel modules"
  61. for x in $(echo "$modules" | tr ':' ' '); do
  62. if expr "$x" : - > /dev/null; then
  63. echo "blacklist ${x#-}" >> /etc/modprobe.conf
  64. else
  65. check modprobe $(echo "$x" | tr ',' ' ')
  66. fi
  67. done
  68. status
  69. fi
  70. force_shell=
  71. use_lvm=
  72. use_mdadm=
  73. if [ -n "$idunn" ]; then
  74. for x in $(echo "$idunn" | tr ':' ' '); do
  75. case "$x" in
  76. *=*) y="${x#*=}"
  77. x="${x%%=*}"
  78. ;;
  79. no*) x="${x#no}"
  80. y="no"
  81. ;;
  82. *) y="yes"
  83. ;;
  84. esac
  85. case "$x" in
  86. shell) force_shell=$y ;;
  87. lvm|mdadm) eval use_${x}=$y ;;
  88. esac
  89. done
  90. fi
  91. # assuming the network module is built-in or preloaded, start it earlier
  92. for x in $(unet pending); do
  93. title "Starting network (interface:$x)"
  94. check unet $x up
  95. status
  96. done
  97. title "Triggering coldplug"
  98. check udevadm trigger
  99. check udevadm settle
  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