diff -Naur lfs-bootscripts-20100124.orig/lfs/init.d/console lfs-bootscripts-20100124/lfs/init.d/console
old
|
new
|
|
41 | 41 | # Figure out the command to set the console into the |
42 | 42 | # desired mode |
43 | 43 | is_true "${UNICODE}" && |
44 | | MODE_COMMAND="${ECHO} -en '\033%G' && kbd_mode -u" || |
45 | | MODE_COMMAND="${ECHO} -en '\033%@\033(K' && kbd_mode -a" |
| 44 | MODE_COMMAND="printf %b '\033%G' && kbd_mode -u" || |
| 45 | MODE_COMMAND="printf %b '\033%@\033(K' && kbd_mode -a" |
46 | 46 | |
47 | 47 | # On framebuffer consoles, font has to be set for each vt in |
48 | 48 | # UTF-8 mode. This doesn't hurt in non-UTF-8 mode also. |
diff -Naur lfs-bootscripts-20100124.orig/lfs/init.d/consolelog lfs-bootscripts-20100124/lfs/init.d/consolelog
old
|
new
|
|
47 | 47 | |
48 | 48 | # Print the value |
49 | 49 | if [ -n "$level" ]; then |
50 | | ${ECHO} -e "${INFO}The current console log level" \ |
51 | | "is ${level}${NORMAL}" |
| 50 | printf %b "${INFO}The current console log level " \ |
| 51 | "is ${level}${NORMAL}\n" |
52 | 52 | fi |
53 | 53 | ;; |
54 | 54 | |
diff -Naur lfs-bootscripts-20100124.orig/lfs/init.d/functions lfs-bootscripts-20100124/lfs/init.d/functions
old
|
new
|
|
40 | 40 | COL=$((${COLUMNS} - 8)) |
41 | 41 | WCOL=$((${COL} - 2)) |
42 | 42 | |
43 | | ## Provide an echo that supports -e and -n |
44 | | # If formatting is needed, $ECHO should be used |
45 | | case "`echo -e -n test`" in |
46 | | -[en]*) |
47 | | ECHO=/bin/echo |
48 | | ;; |
49 | | *) |
50 | | ECHO=echo |
51 | | ;; |
52 | | esac |
53 | | |
54 | | ## Set Cursor Position Commands, used via $ECHO |
| 43 | ## Set Cursor Position Commands, used via printf |
55 | 44 | SET_COL="\\033[${COL}G" # at the $COL char |
56 | 45 | SET_WCOL="\\033[${WCOL}G" # at the $WCOL char |
57 | 46 | CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char |
58 | 47 | |
59 | | ## Set color commands, used via $ECHO |
| 48 | ## Set color commands, used via printf |
60 | 49 | # Please consult `man console_codes for more information |
61 | 50 | # under the "ECMA-48 Set Graphics Rendition" section |
62 | 51 | # |
… |
… |
|
90 | 79 | #******************************************************************************* |
91 | 80 | boot_mesg() |
92 | 81 | { |
93 | | local ECHOPARM="" |
| 82 | local PARM="\n" |
94 | 83 | |
95 | 84 | while true |
96 | 85 | do |
97 | 86 | case "${1}" in |
98 | 87 | -n) |
99 | | ECHOPARM=" -n " |
| 88 | PARM="" |
100 | 89 | shift 1 |
101 | 90 | ;; |
102 | 91 | -*) |
… |
… |
|
114 | 103 | STRING_LENGTH=$((${#1} + 1)) |
115 | 104 | |
116 | 105 | # Print the message to the screen |
117 | | ${ECHO} ${ECHOPARM} -e "${2}${1}" |
| 106 | printf "%b${PARM}" "${2}${1}" |
118 | 107 | |
119 | 108 | } |
120 | 109 | |
… |
… |
|
132 | 121 | |
133 | 122 | echo_ok() |
134 | 123 | { |
135 | | ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" |
136 | | ${ECHO} -e "${NORMAL}" |
| 124 | printf %b "${CURS_UP}${SET_COL}${BRACKET}[${SUCCESS} OK ${BRACKET}]" |
| 125 | printf %b\\n "${NORMAL}" |
137 | 126 | boot_mesg_flush |
138 | 127 | } |
139 | 128 | |
140 | 129 | echo_failure() |
141 | 130 | { |
142 | | ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" |
143 | | ${ECHO} -e "${NORMAL}" |
| 131 | printf %b "${CURS_UP}${SET_COL}${BRACKET}[${FAILURE} FAIL ${BRACKET}]" |
| 132 | printf %b\\n "${NORMAL}" |
144 | 133 | boot_mesg_flush |
145 | 134 | } |
146 | 135 | |
147 | 136 | echo_warning() |
148 | 137 | { |
149 | | ${ECHO} -n -e "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" |
150 | | ${ECHO} -e "${NORMAL}" |
| 138 | printf %b "${CURS_UP}${SET_COL}${BRACKET}[${WARNING} WARN ${BRACKET}]" |
| 139 | printf %b\\n "${NORMAL}" |
151 | 140 | boot_mesg_flush |
152 | 141 | } |
153 | 142 | |
… |
… |
|
219 | 208 | # may call it this way. |
220 | 209 | case "${2}" in |
221 | 210 | running) |
222 | | ${ECHO} -e -n "${CURS_UP}" |
223 | | ${ECHO} -e -n "\\033[${STRING_LENGTH}G " |
| 211 | printf %b "${CURS_UP}" |
| 212 | printf %b "\\033[${STRING_LENGTH}G " |
224 | 213 | boot_mesg "Already running." ${WARNING} |
225 | 214 | echo_warning |
226 | 215 | ;; |
227 | 216 | not_running) |
228 | | ${ECHO} -e -n "${CURS_UP}" |
229 | | ${ECHO} -e -n "\\033[${STRING_LENGTH}G " |
| 217 | printf %b "${CURS_UP}" |
| 218 | printf %b "\\033[${STRING_LENGTH}G " |
230 | 219 | boot_mesg "Not running." ${WARNING} |
231 | 220 | echo_warning |
232 | 221 | ;; |
233 | 222 | not_available) |
234 | | ${ECHO} -e -n "${CURS_UP}" |
235 | | ${ECHO} -e -n "\\033[${STRING_LENGTH}G " |
| 223 | printf %b "${CURS_UP}" |
| 224 | printf %b "\\033[${STRING_LENGTH}G " |
236 | 225 | boot_mesg "Not available." ${WARNING} |
237 | 226 | echo_warning |
238 | 227 | ;; |
… |
… |
|
360 | 349 | ret=$? |
361 | 350 | |
362 | 351 | if [ -n "${pidlist}" ]; then |
363 | | ${ECHO} -e "${INFO}${base} is running with Process"\ |
364 | | "ID(s) ${pidlist}.${NORMAL}" |
| 352 | printf %b "${INFO}${base} is running with Process "\ |
| 353 | "ID(s) ${pidlist}.${NORMAL}\n" |
365 | 354 | else |
366 | 355 | if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then |
367 | | ${ECHO} -e "${WARNING}${1} is not running but"\ |
368 | | "/var/run/${base}.pid exists.${NORMAL}" |
| 356 | printf %b "${WARNING}${1} is not running but "\ |
| 357 | "/var/run/${base}.pid exists.${NORMAL}\n" |
369 | 358 | else |
370 | 359 | if [ -n "${pidfile}" -a -e "${pidfile}" ]; then |
371 | | ${ECHO} -e "${WARNING}${1} is not running"\ |
372 | | "but ${pidfile} exists.${NORMAL}" |
| 360 | printf %b "${WARNING}${1} is not running "\ |
| 361 | "but ${pidfile} exists.${NORMAL}\n" |
373 | 362 | else |
374 | | ${ECHO} -e "${INFO}${1} is not running.${NORMAL}" |
| 363 | printf %b "${INFO}${1} is not running.${NORMAL}\n" |
375 | 364 | fi |
376 | 365 | fi |
377 | 366 | fi |
… |
… |
|
723 | 712 | #******************************************************************************* |
724 | 713 | log_success_msg() |
725 | 714 | { |
726 | | ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" |
727 | | ${ECHO} -e "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" |
| 715 | printf %b "${BOOTMESG_PREFIX}${@}" |
| 716 | printf %b\\n "${SET_COL}""${BRACKET}""[""${SUCCESS}"" OK ""${BRACKET}""]""${NORMAL}" |
728 | 717 | return 0 |
729 | 718 | } |
730 | 719 | |
… |
… |
|
743 | 732 | # |
744 | 733 | #******************************************************************************* |
745 | 734 | log_failure_msg() { |
746 | | ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" |
747 | | ${ECHO} -e "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" |
| 735 | printf %b "${BOOTMESG_PREFIX}${@}" |
| 736 | printf %b\\n "${SET_COL}""${BRACKET}""[""${FAILURE}"" FAIL ""${BRACKET}""]""${NORMAL}" |
748 | 737 | return 0 |
749 | 738 | } |
750 | 739 | |
… |
… |
|
763 | 752 | # |
764 | 753 | #******************************************************************************* |
765 | 754 | log_warning_msg() { |
766 | | ${ECHO} -n -e "${BOOTMESG_PREFIX}${@}" |
767 | | ${ECHO} -e "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" |
| 755 | printf %b "${BOOTMESG_PREFIX}${@}" |
| 756 | printf %b\\n "${SET_COL}""${BRACKET}""[""${WARNING}"" WARN ""${BRACKET}""]""${NORMAL}" |
768 | 757 | return 0 |
769 | 758 | } |
770 | 759 | |