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