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