aboutsummaryrefslogtreecommitdiffstats
path: root/lsb-bootscripts/etc/default/rc
blob: 4b756c54fd39e3dce156171c31e6c251d16e37ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Begin /etc/default/rc

# Author: DJ Lucas - dj@linuxfromscratch.org
# Version: 1.0 LSB V.3.1

# Global variable inherited by initscripts are in caps
# Local variables for the rc script are in lowercase

# Source site specific rc configuration
. /etc/default/rc.site

# Set base directory information
RC_BASE="ETCDIR"

# Location of network device scripts and config files
NETWORK_DEVICES="/etc/network"

# This sets default terminal options.
# stty sane - this has been removed as nobody recalls
# the reason for it in the first place - if no problems arize,
# then it will be removed completely at a later date.

# Setup default values for the environment
umask 022
PATH="/bin:/sbin"

# Find current screen size
if [ -z "${COLUMNS}" ]; then
        COLUMNS=$(stty size)
        COLUMNS=${COLUMNS##* }
fi

# When using remote connections, such as a serial port, stty size returns 0
if [ "${COLUMNS}" = "0" ]; then
        COLUMNS=80
fi

## Measurements for positioning result messages
COL=$((${COLUMNS} - 8))
WCOL=$((${COL} - 2))

# Set Cursur Position Commands, used via echo -e
SET_COL="\\033[${COL}G"      # at the $COL char
SET_WCOL="\\033[${WCOL}G"    # at the $WCOL char
CURS_UP="\\033[1A\\033[0G"   # Up one line, at the 0'th char

# Distro Information
DISTRO="Linux From Scratch" # The distro name
DISTRO_CONTACT="lfs-dev@linuxfromscratch.org" # Bug report address
DISTRO_MINI="lfs" # Short name used in filenames for distro config

# Define custom colors used in messages printed to the screen
BRACKET="\\033[1;34m" # Blue
FAILURE="\\033[1;31m" # Red
INFO="\\033[1;36m"    # Cyan
NORMAL="\\033[0;39m"  # Grey
SUCCESS="\\033[1;32m" # Green
WARNING="\\033[1;33m" # Yellow

# Prefix boot messages for easier reading on framebuffer consoles
PREFIX_SUCCESS=" ${SUCCESS}*${NORMAL} "
PREFIX_WARNING="${WARNING}**${NORMAL} "
PREFIX_FAILURE="${FAILURE}***${NORMAL}"

# Export the environment variables so they are inherited by the scripts
export RC_BASE NETWORK_DEVICES PATH SET_COL SET_WCOL CURS_UP
export DISTRO DISTRO_CONTACT DISTRO_MINI
export BRACKET FAILURE INFO NORMAL SUCCESS WARNING
export PREFIX_SUCCESS PREFIX_WARNING PREFIX_FAILURE

# Interactive startup
dlen="29" # The total length of the distro welcome string
ilen="38" # The total length of the interactive message
welcome_message="Welcome to ${INFO}${DISTRO}${NORMAL}"
i_message="Press '${FAILURE}I${NORMAL}' to enter interactive startup"

# Error message displayed when a script's exit value is not zero
print_error_msg()
{
    # ${link} and ${error_value} are defined by the rc script
    echo -e "${FAILURE}FAILURE:  You should not be reading this error message."
    echo -e ""
    echo -e -n "${FAILURE}It means that an unforseen error took place in"
    echo -e -n "${INFO} ${link}"
    echo -e "${FAILURE},"
    echo -e "${FAILURE}which exited with a return value of ${error_value}."
    echo -e ""
    echo -e -n "${FAILURE}If you are able to track this error down to a bug"
    echo -e "${FAILURE}in one of the files"
    echo -e -n "provided by ${INFO}${DISTRO}${FAILURE}, "
    echo -e -n "${FAILURE}please be so kind to inform us at "
    echo -e "${INFO}${DISTRO_CONTACT}${FAILURE}.${NORMAL}"
    echo -e ""
    echo -e "${INFO}Press Enter to continue..."
    echo -e "${NORMAL}"
    $FAILURE_ACTION
}

# End /etc/default/rc