OpenSDE Framework (without history before r20070)
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.

112 lines
2.9 KiB

  1. #!/bin/sh
  2. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  3. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  4. #
  5. # T2 SDE: target/share/livecd/init
  6. # Copyright (C) 2006 The T2 SDE 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. # --- T2-COPYRIGHT-NOTE-END ---
  15. echo "T2 early userspace ..."
  16. PATH=/sbin:/bin
  17. echo "Mounting /dev, /proc and /sys ..."
  18. mount -t tmpfs none /dev
  19. mount -t proc none /proc
  20. mount -t usbfs none /proc/bus/usb
  21. mount -t sysfs none /sys
  22. ln -s /proc/self/fd /dev/fd
  23. # later on we might reverse these, that is run udevstart first,
  24. # and let udev add new ones as hotplug agents ...
  25. echo "Running hotplug++ hardware detection ..."
  26. /sbin/hotplug++ -synth
  27. echo "/sbin/hotplug++" > /proc/sys/kernel/hotplug
  28. echo "Loading additional subsystem and filesystem driver ..."
  29. # hack to be removed
  30. modprobe sbp2
  31. # well some hardcoded help for now ...
  32. modprobe ide-generic
  33. modprobe ide-disk
  34. modprobe ide-cd
  35. modprobe sd_mod
  36. modprobe sr_mod
  37. modprobe sg
  38. # the modular filesystems ...
  39. for x in /lib/modules/*/kernel/fs/{*/,}*.*o ; do
  40. x=${x##*/} ; x=${x%.*o}
  41. modprobe $x
  42. done
  43. echo "Populating /dev (udev) ..."
  44. /sbin/udevstart
  45. echo "Searching for CD with Live file-system ..."
  46. mkdir -p /media/cdrom /mnt/live
  47. i=0
  48. while [ $i -le 9 ]; do
  49. for x in /sys/block/*/device; do
  50. x=${x%/device}; x=${x#/sys/block/}
  51. case "`ls -l /sys/block/$x/device`" in
  52. */usb*|*/ieee1394) : ;;
  53. *) [ "`cat /sys/block/$x/removable`" = 1 ] || continue ;;
  54. esac
  55. x=/dev/$x
  56. for x in ${x}* ; do
  57. [ -e $x ] || continue
  58. fs=`disktype $x 2>/dev/null |
  59. sed -e '/file system/!d' -e 's/file system.*//' -e 's/ //g' \
  60. -e 'y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/' \
  61. -e 's/fat32/vfat/'`
  62. if mount -t $fs -o ro $x /media/cdrom 2>/dev/null; then
  63. if [ -f /media/cdrom/live.squash ]; then
  64. echo "Found the Live file-system ($x) ..."
  65. losetup /dev/loop0 /media/cdrom/live.squash
  66. mount -t squashfs -o ro /dev/loop0 /mnt/live
  67. # create symlinks to the live content
  68. mv /bin /bin-static
  69. for x in /mnt/live/* ; do
  70. x=${x#/mnt/live/}
  71. case $x in
  72. dev|proc|sys|media|mnt|tmp) continue ;;
  73. esac
  74. if [ -e /$x ]; then
  75. # echo "Removing /$x ..."
  76. /bin-static/rm -rf /$x
  77. fi
  78. # echo "Linking /mnt/live/$x /$x"
  79. /bin-static/ln -s /mnt/live/$x /$x
  80. done
  81. # /bin-static/ls -l /
  82. # echo "Removing /bin-static"
  83. /bin-static/rm -rf /bin-static
  84. exec /init2 $*
  85. else
  86. echo "No Live file-system found - unmounting."
  87. umount /media/cdrom
  88. fi
  89. fi
  90. done
  91. done
  92. : $(( i++ ))
  93. sleep 1
  94. done
  95. echo "No Live CD found, giving up. Debug shell:"
  96. exec /bin/sh