1
0

rc 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Begin /etc/default/rc
  2. # Global variable inherited by initscripts are in caps
  3. # Local variables for the rc script are in lowercase
  4. # Source site specific rc configuration
  5. . /etc/default/rc.site
  6. # Set base directory information
  7. RC_BASE="/etc/rc.d"
  8. # Location of network device scripts and config files
  9. NETWORK_DEVICES="/etc/network"
  10. # This sets default terminal options.
  11. # stty sane - this has been removed as nobody recalls
  12. # the reason for it in the first place - if no problems arize,
  13. # then it will be removed completely at a later date.
  14. # Setup default values for the environment
  15. umask 022
  16. PATH="/bin:/sbin"
  17. # Find current screen size
  18. if [ -z "${COLUMNS}" ]; then
  19. COLUMNS=$(stty size)
  20. COLUMNS=${COLUMNS##* }
  21. fi
  22. # When using remote connections, such as a serial port, stty size returns 0
  23. if [ "${COLUMNS}" = "0" ]; then
  24. COLUMNS=80
  25. fi
  26. ## Measurements for positioning result messages
  27. COL=$((${COLUMNS} - 8))
  28. WCOL=$((${COL} - 2))
  29. # Set Cursur Position Commands, used via echo -e
  30. SET_COL="\\033[${COL}G" # at the $COL char
  31. SET_WCOL="\\033[${WCOL}G" # at the $WCOL char
  32. CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char
  33. # Distro Information
  34. DISTRO="Linux From Scratch" # The distro name
  35. DISTRO_CONTACT="lfs-dev@linuxfromscratch.org" # Bug report address
  36. DISTRO_MINI="lfs" # Short name used in filenames for distro config
  37. # Define custom colors used in messages printed to the screen
  38. BRACKET="\\033[1;34m" # Blue
  39. FAILURE="\\033[1;31m" # Red
  40. INFO="\\033[1;36m" # Cyan
  41. NORMAL="\\033[0;39m" # Grey
  42. SUCCESS="\\033[1;32m" # Green
  43. WARNING="\\033[1;33m" # Yellow
  44. # Prefix boot messages for easier reading on framebuffer consoles
  45. PREFIX_SUCCESS=" ${SUCCESS}*${NORMAL} "
  46. PREFIX_WARNING="${WARNING}**${NORMAL} "
  47. PREFIX_FAILURE="${FAILURE}***${NORMAL}"
  48. # Export the environment variables so they are inherited by the scripts
  49. export RC_BASE NETWORK_DEVICES PATH SET_COL SET_WCOL CURS_UP
  50. export DISTRO DISTRO_CONTACT DISTRO_MINI
  51. export BRACKET FAILURE INFO NORMAL SUCCESS WARNING
  52. export PREFIX_SUCCESS PREFIX_WARNING PREFIX_FAILURE
  53. # Interactive startup
  54. dlen="29" # The total length of the distro welcome string
  55. ilen="38" # The total length of the interactive message
  56. welcome_message="Welcome to ${INFO}${DISTRO}${NORMAL}"
  57. i_message="Press '${FAILURE}I${NORMAL}' to enter interactive startup"
  58. # FAILURE_ACTION (what to do when script failure occurs)
  59. case "${stop_on_error}" in
  60. Y* | y* | 0)
  61. FAILURE_ACTION='read Enter'
  62. ;;
  63. *)
  64. FAILURE_ACTION='echo ""'
  65. ;;
  66. esac
  67. # Error message displayed when a script's exit value is not zero
  68. print_error_msg()
  69. {
  70. # ${link} and ${error_value} are defined by the rc script
  71. echo -e "${FAILURE}FAILURE: You should not be reading this error message."
  72. echo -e ""
  73. echo -e -n "${FAILURE}It means that an unforseen error took place in"
  74. echo -e -n "${INFO} ${link}"
  75. echo -e "${FAILURE},"
  76. echo -e "${FAILURE}which exited with a return value of ${error_value}."
  77. echo -e ""
  78. echo -e -n "${FAILURE}If you are able to track this error down to a bug"
  79. echo -e "${FAILURE}in one of the files"
  80. echo -e -n "provided by ${INFO}${DISTRO}${FAILURE}, "
  81. echo -e -n "${FAILURE}please be so kind to inform us at "
  82. echo -e "${INFO}${DISTRO_CONTACT}${FAILURE}.${NORMAL}"
  83. echo -e ""
  84. echo -e "${INFO}Press Enter to continue..."
  85. echo -e "${NORMAL}"
  86. $FAILURE_ACTION
  87. }
  88. # End /etc/default/rc