rc 3.2 KB

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