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.

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