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.

91 lines
2.1 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.trymount.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/conf/idunn
  16. verbose=
  17. delayed=
  18. while [ $# -gt 0 ]; do
  19. case "$1" in
  20. -v) verbose=yes ;;
  21. delayed)
  22. delayed=yes ;;
  23. *)
  24. echo "trymount: $1: option not understood." 1>&2
  25. ;;
  26. esac
  27. shift
  28. done
  29. if grep -q "^[^ ]* $rootfs " /proc/mounts; then
  30. # alredy mounted
  31. error=0
  32. elif [ -n "$root" ]; then
  33. . /etc/rc.d/functions.in
  34. root_type=
  35. root_tag=
  36. root_options="$root_mode"
  37. if [ "$delayed" = yes -a "$rootdelay" != "0" ]; then
  38. title "Waiting ${rootdelay}s before trying to mount $rootfs."
  39. check sleep "$rootdelay"
  40. status
  41. fi
  42. case "$root_method" in
  43. nfs)
  44. root_type="$root_method"
  45. root_options="$root_options,nolock,intr,tcp"
  46. ;;
  47. find) # UUID= or LABEL=
  48. root_tag="$root"
  49. root=$(blkid -l -o device -t "$root_tag")
  50. [ -z "$root" ] || root_type=$(blkid -o value -s TYPE "$root")
  51. [ -z "$root_type" ] || root_tag="$root_tag, $root_type"
  52. ;;
  53. device)
  54. root_type=$(blkid -o value -s TYPE "$root")
  55. ;;
  56. esac
  57. if [ -z "$root" ]; then
  58. title "Mounting $root_tag at $rootfs."
  59. elif [ -z "$root_type" ]; then
  60. title "Mounting $root (undetermined) at $rootfs."
  61. elif [ -z "$root_tag" ]; then
  62. title "Mounting $root ($root_type) at $rootfs."
  63. else
  64. title "Mounting $root ($root_tag) at $rootfs."
  65. fi
  66. if [ -n "$root_type" ]; then
  67. modprobe -q "$root_type"
  68. check mount -t "$root_type" -o "$root_options" "$root" "$rootfs"
  69. else
  70. check false
  71. fi
  72. status
  73. else
  74. [ -z "$verbose" ] ||
  75. cat <<-EOT >&2
  76. sorry, root device not specified.
  77. mount it at $rootfs and try again
  78. EOT
  79. error=1
  80. fi
  81. exit ${error:-0}