Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 303775 Details for
Bug 373219
provide alternative for /etc/init.d/functions.sh so that openrc is not required
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
einfo and related functions alternative implementation
elog-functions.sh (text/plain), 2.68 KB, created by
Canek Peláez Valdés
on 2012-02-29 22:03:58 UTC
(
hide
)
Description:
einfo and related functions alternative implementation
Filename:
MIME Type:
Creator:
Canek Peláez Valdés
Created:
2012-02-29 22:03:58 UTC
Size:
2.68 KB
patch
obsolete
># Copyright (c) 2012 Canek Peláez Valdés <canek@ciencias.unam.mx> ># Compatibility e* log functions from sys-apps/openrc > ># Shamelessly stolen from /etc/init.d/functions.sh >for arg; do > case "$arg" in > --nocolor|--nocolour|-C) > export EINFO_COLOR="NO" > ;; > esac >done > ># Adapted from /etc/init.d/functions.sh so we don't need eval_colors >if [ "${EINFO_COLOR}" != NO ]; then > if [ -z "$GOOD" ]; then > GOOD=$(echo -ne "\e[1;32m") > WARN=$(echo -ne "\e[1;33m") > BAD=$(echo -ne "\e[1;31m") > HILITE=$(echo -ne "\e[1;36m") > BRACKET=$(echo -ne "\e[1;34m") > NORMAL=$(echo -ne "\e[0;0m") > export GOOD WARN BAD HILITE BRACKET NORMAL > fi >fi > ># Hack to get terminal cursor position. I believe it's OK to use it ># since OpenRC uses terminal escape sequences anyhow >function curpos() >{ > echo -ne "\e[6n" > read -sdR CURPOS > CURPOS=${CURPOS#*[} > > c=0 > for e in $(echo $CURPOS | tr ";" "\n"); do > arr[c]="${e}" > c=$((c + 1)) > done > > case "$1" in > "row") > return "${arr[0]}" > ;; > "col") > return "${arr[1]}" > ;; > *) > return "${CURPOS}" > ;; > esac > > return "${CURPOS}" >} > >function elog() >{ > if [ "${EINFO_QUIET}" == "true" ]; then > return > fi > echo -ne "${@}" >} > >function errlog() >{ > echo -ne "${@}" > /dev/stderr >} > >function einfo() >{ > elog " ${GOOD}*${NORMAL} ${_ELOG_INDENT}${@}\n" >} > >function ewarn() >{ > errlog " ${WARN}*${NORMAL} ${_ELOG_INDENT}${@}\n" >} > >function eerror() >{ > errlog " ${BAD}*${NORMAL} ${_ELOG_INDENT}${@}\n" >} > >function veinfo() >{ > if [ "${EINFO_VERBOSE}" == "true" ]; then > einfo "${@}" > fi >} > >function vewarn() >{ > if [ "${EINFO_VERBOSE}" ]; then > ewarn "${@}" > fi >} > >function ebegin() >{ > elog " ${GOOD}*${NORMAL} ${_ELOG_INDENT}${@} ...\n" >} > >function eend() >{ > if [ "${EINFO_QUIET}" == "true" ]; then > return > fi > msg="$1" > if [ ! -z "${msg##*[!0-9]*}" ]; then > retval="$msg" > else > eerror "$msg" > retval=1 > fi > # ncurses dependency > COLUMNS=$(/usr/bin/tput cols) > COLUMN=$((COLUMNS - 6)) > curpos row > ROW=$? > ROW=$((ROW - 2)) > LBRAC="${BRACKET}[${NORMAL}" > RBRAC="${BRACKET}]${NORMAL}" > /usr/bin/tput cup "${ROW}" "${COLUMN}" > if [ "$retval" != 1 ]; then > echo -e "${LBRAC} ${GOOD}ok${NORMAL} ${RBRAC}" > else > echo -e "${LBRAC} ${BAD}!!${NORMAL} ${RBRAC}" > fi >} > >function eindent() >{ > if [ -z "${_ELOG_INDENT}" ]; then > export _ELOG_INDENT=" " > else > export _ELOG_INDENT="${_ELOG_INDENT} " > fi >} > >function eoutdent() >{ > if [ -z "${_ELOG_INDENT}" ]; then > unset _ELOG_INDENT > else > export _ELOG_INDENT=$(echo "${_ELOG_INDENT}" | sed "s/ //") > fi >} > >export -f elog errlog einfo ewarn eerror veinfo vewarn ebegin eend eindent eoutdent curpos
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 373219
:
278393
|
278537
|
278625
|
278635
|
278645
|
278999
|
303775
|
364774
|
367476
|
367478
|
367480
|
367482
|
368936
|
371754
|
371834
|
371842
|
372314
|
372318