summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2014-03-12 22:07:09 +0000
committerWilliam Hubbs <williamh@gentoo.org>2014-03-12 22:07:09 +0000
commitc9b3eaea8068a16fb5c649fd5d82198987624330 (patch)
tree89b731d5bdcbfd1f9b76609341259bf1cd24cc64 /sys-apps/gentoo-functions
parentAdd new version, drop old #500688 (diff)
downloadhistorical-c9b3eaea8068a16fb5c649fd5d82198987624330.tar.gz
historical-c9b3eaea8068a16fb5c649fd5d82198987624330.tar.bz2
historical-c9b3eaea8068a16fb5c649fd5d82198987624330.zip
Version bump for prefix fixes: do not hardcode paths to consoletype or portageq. Thanks to Ruud Koolen <redlizard@gentoo.org>
Package-Manager: portage-2.2.8-r1/cvs/Linux x86_64 Manifest-Sign-Key: 0x8568F528
Diffstat (limited to 'sys-apps/gentoo-functions')
-rw-r--r--sys-apps/gentoo-functions/ChangeLog9
-rw-r--r--sys-apps/gentoo-functions/Manifest10
-rw-r--r--sys-apps/gentoo-functions/files/gentoo-functions-0.2.sh471
-rw-r--r--sys-apps/gentoo-functions/gentoo-functions-0.2.ebuild25
4 files changed, 510 insertions, 5 deletions
diff --git a/sys-apps/gentoo-functions/ChangeLog b/sys-apps/gentoo-functions/ChangeLog
index b3edab7bebec..17bc93580968 100644
--- a/sys-apps/gentoo-functions/ChangeLog
+++ b/sys-apps/gentoo-functions/ChangeLog
@@ -1,6 +1,13 @@
# ChangeLog for sys-apps/gentoo-functions
# Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/gentoo-functions/ChangeLog,v 1.3 2014/03/11 21:55:41 williamh Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/gentoo-functions/ChangeLog,v 1.4 2014/03/12 22:06:42 williamh Exp $
+
+*gentoo-functions-0.2 (12 Mar 2014)
+
+ 12 Mar 2014; William Hubbs <williamh@gentoo.org>
+ +files/gentoo-functions-0.2.sh, +gentoo-functions-0.2.ebuild:
+ Version bump for prefix fixes: do not hardcode paths to consoletype or
+ portageq. Thanks to Ruud Koolen <redlizard@gentoo.org>
*gentoo-functions-0.1 (11 Mar 2014)
diff --git a/sys-apps/gentoo-functions/Manifest b/sys-apps/gentoo-functions/Manifest
index 9dfb31a1ea4f..780a56a20d03 100644
--- a/sys-apps/gentoo-functions/Manifest
+++ b/sys-apps/gentoo-functions/Manifest
@@ -2,15 +2,17 @@
Hash: SHA256
AUX gentoo-functions-0.1.sh 8821 SHA256 ba1b8644b801e561f14e69a0393d2d5e3724f06e3d68703ba8abb1b1c8cce22a SHA512 fff651f97c140f4c2cb1d6225d6d2a4a5c0c19c081fffae918802e8f8332347fcb63e73984dd9a89c02bc49075bdc6763466ab8149936f3ee0499e556e6c30b2 WHIRLPOOL 1a9f9516e1acaf1e692dc503bfdcd871ba6709192602e235aecac3a051c5c77940e954c13714946ff1b91f7a580cb511f80e0f11abb45b5c0470cd4bcb72450d
+AUX gentoo-functions-0.2.sh 8810 SHA256 27aa9f655ada5b18b97872997d262969a924d09a8b8c6b9abc2337ff48d3b5a6 SHA512 cdd5f57755235eaf181e948d09095b75f002668b0080b38516813ea5c4f71f4a0836b9df78358346533e336e75a4969872431cc0fdc0b646e3c5259b9c9e9871 WHIRLPOOL 2449e164a1ebbe1c4dbb31dc32f7f0a3119ed4126df87702e659e87f11c05d938156ef4190196c6028047fa4aaa9d6cd06422055ff7ad7678f0856e1eb25eae0
AUX gentoo-functions-0.sh 8440 SHA256 d3f038fe159d81ce9c5e57b2910ae5cd1fc826e7ca83c7fe8b3814fa90be917a SHA512 cfeef8dbcb8541d91f9db9aba9caa07e1a4081f5e3511eb27810883941784f1151e6502bfb5a271c3fe3f993ab621df90f48f62a9a13113232d48972bcabbc39 WHIRLPOOL ead49ff61d02f65adb285c5e3bb669f43060b482ff04e42d7094370a6a25562647ccc9a42d1c74a9dc6374ac2e3430b9759386b8dbff104096b4e743db856e00
EBUILD gentoo-functions-0.1.ebuild 659 SHA256 000927e6c3f0fc62c40420d7c3e8baccbd9aaf50f1317f5ab304e76fe164dfe3 SHA512 d01553dd10fab075075a77a6b51b7172f02b630b8644edfd5569cf6b960c6c67090b6266460c398c4a7d73d0132e25616f39cac392dd790808b6c0e63b73bb75 WHIRLPOOL aac39a1dd0cef9b6a0bdccd3303646e4271fb0c22d1c73bb08fe217e948d254f70bad42edba94c734025164471e5120db1cd1dfb8d8a8df9b80cd4ac67219e94
+EBUILD gentoo-functions-0.2.ebuild 659 SHA256 63934ec07319ab3ec250a7c0acb79b43e6d0733a652d367c8ca2425639423c60 SHA512 c70649d3cf20491e403da1ab6c06a913ed36737e581117f3d61a4d44f77372f290fd1c5d47c081c42475b3d156da245f1d597ee83a3705d728dc0cff4e421ee3 WHIRLPOOL cfb8e3b5ace2b2ac594d64f0e1d7f5bf8e68c814e7d96707c90a67cf124adc35ec863aa36dc2d671a597109cebdca56f78aa411c05fc2ef866ce56dee827cce3
EBUILD gentoo-functions-0.ebuild 657 SHA256 bd921dd1da6e4569eafd84dca2a0b89ec04238e0008e1bb1b693229d73f6b1c4 SHA512 af56b18e26a43606d85b4e559663d3d2c1dd6fea1d1106ddd50f69eeafb8040b069347d8e4b8f92d67b5b7a8bcd35d6d2a94a06889fdd561ccdf14464f29293a WHIRLPOOL 96d35fafff55028afeb7d235a95a1f7b439c727b9428b2b1aeac8ef019df3c93335dd16142c7f119b70c5695eb9189cd2648e74eca45f9de07488978127e1cb6
-MISC ChangeLog 700 SHA256 0a3ba95eb5b7f08051f396b52a0dc00c2ab9f35e9466c53aa70fe291b4fb0d15 SHA512 63be0637d0e65ba3315ffb8b2479402d151f21f56e3f45c6762772bd788daf920cfdad37729384023804d9dfc835ba188b55025c1d7276c2f0af8f93996664ce WHIRLPOOL 9ac45f281277a1052acab5858d56d6ddd54e06171b09b59f733e9e186b2dc4436b7a9d143c55215eea0049058b4e4c91aa3784c631fddb0c715ba286bda6b7ed
+MISC ChangeLog 983 SHA256 1da915e595889e7e19953f756ea7644a5097ca499e526f6203355bd27bc5b168 SHA512 d991031bf588308a8e0d35193ea417b3d9e98446e9d15f5abdfe3368fd555d365d0bb71dc0388e2db6757ec42edc23a785151437fe1e03cb06939c9fda17a101 WHIRLPOOL d001884cdf7997be77b89df13c77e8f902e22feb1f60d0ee17c2fb6ed7a150975ccd60f385ff483f84b1c0c34600dbf7536c5c854fb7dfec4629420b701eff4d
MISC metadata.xml 398 SHA256 d413bd2b83e87682d76677290bf28028ee3688fd7838044e2f8a92d7846dbced SHA512 5258fd100f5f19647e2206253d314cb97371401aed8c760224f5e3856a21062593adb8c167045cbeae4973cb7a15e5d83bbccb63e75e5a16156a02efb87085fb WHIRLPOOL a22b833eb820674aa141c478595bf77f033f41678f4dff03772efb6f9204b9a50fc706c4108a7b1f58e2966340dbf808f0083ab482d1dd8189d08e11733c1133
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
-iEYEAREIAAYFAlMfh+cACgkQblQW9DDEZTgHOACgi7KrjscupwC6KNIQSu1FmE8/
-8RwAoJ62rE4CsS24k8ZYJCslqgOhowcu
-=ZAoF
+iEYEAREIAAYFAlMg2o0ACgkQblQW9DDEZTjPdQCbBlPthu02XKy+UqeKHsRl+tv8
+jBgAnAh88D05SpMb5IBNztED3qLVh7SO
+=Ywht
-----END PGP SIGNATURE-----
diff --git a/sys-apps/gentoo-functions/files/gentoo-functions-0.2.sh b/sys-apps/gentoo-functions/files/gentoo-functions-0.2.sh
new file mode 100644
index 000000000000..8786ca2df837
--- /dev/null
+++ b/sys-apps/gentoo-functions/files/gentoo-functions-0.2.sh
@@ -0,0 +1,471 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+#
+# All functions in this file should be written in POSIX sh. Please do
+# not use bashisms.
+#
+
+RC_GOT_FUNCTIONS="yes"
+
+#
+# hard set the indent used for e-commands.
+# num defaults to 0
+# This is a private function.
+#
+_esetdent()
+{
+ local i="$1"
+ [ -z "$i" ] || [ "$i" -lt 0 ] && i=0
+ RC_INDENTATION=$(printf "%${i}s" '')
+}
+
+#
+# increase the indent used for e-commands.
+#
+eindent()
+{
+ local i="$1"
+ [ -n "$i" ] && [ "$i" -gt 0 ] || i=$RC_DEFAULT_INDENT
+ _esetdent $(( ${#RC_INDENTATION} + i ))
+}
+
+#
+# decrease the indent used for e-commands.
+#
+eoutdent()
+{
+ local i="$1"
+ [ -n "$i" ] && [ "$i" -gt 0 ] || i=$RC_DEFAULT_INDENT
+ _esetdent $(( ${#RC_INDENTATION} - i ))
+}
+
+#
+# this function was lifted from OpenRC. It returns 0 if the argument or
+# the value of the argument is "yes", "true", "on", or "1" or 1
+# otherwise.
+#
+yesno()
+{
+ [ -z "$1" ] && return 1
+
+ case "$1" in
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
+ [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
+ esac
+
+ local value=
+ eval value=\$${1}
+ case "$value" in
+ [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) return 0;;
+ [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) return 1;;
+ *) vewarn "\$$1 is not set properly"; return 1;;
+ esac
+}
+
+#
+# use the system logger to log a message
+#
+esyslog()
+{
+ local pri=
+ local tag=
+
+ if command -v logger > /dev/null 2>&1; then
+ pri="$1"
+ tag="$2"
+
+ shift 2
+ [ -z "$*" ] && return 0
+
+ logger -p "${pri}" -t "${tag}" -- "$*"
+ fi
+
+ return 0
+}
+
+#
+# show an informative message (without a newline)
+#
+einfon()
+{
+ if yesno "${EINFO_QUIET}"; then
+ return 0
+ fi
+ if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
+ printf "\n"
+ fi
+ printf " ${GOOD}*${NORMAL} ${RC_INDENTATION}$*"
+ LAST_E_CMD="einfon"
+ return 0
+}
+
+#
+# show an informative message (with a newline)
+#
+einfo()
+{
+ einfon "$*\n"
+ LAST_E_CMD="einfo"
+ return 0
+}
+
+#
+# show a warning message (without a newline) and log it
+#
+ewarnn()
+{
+ if yesno "${EINFO_QUIET}"; then
+ printf " $*"
+ else
+ if ! yesno "${RC_ENDCOL}" && [ ${LAST_E_CMD} = "ebegin" ]; then
+ printf "\n"
+ fi
+ printf " ${WARN}*${NORMAL} ${RC_INDENTATION}$*"
+ fi
+
+ local name="${0##*/}"
+ # Log warnings to system log
+ esyslog "daemon.warning" "${name}" "$*"
+
+ LAST_E_CMD="ewarnn"
+ return 0
+}
+
+#
+# show a warning message (with a newline) and log it
+#
+ewarn()
+{
+ if yesno "${EINFO_QUIET}"; then
+ printf " $*\n"
+ else
+ if ! yesno "${RC_ENDCOL}" && [ ${LAST_E_CMD} = "ebegin" ]; then
+ printf "\n"
+ fi
+ printf " ${WARN}*${NORMAL} ${RC_INDENTATION}$*\n"
+ fi
+
+ local name="${0##*/}"
+ # Log warnings to system log
+ esyslog "daemon.warning" "${name}" "$*"
+
+ LAST_E_CMD="ewarn"
+ return 0
+}
+
+#
+# show an error message (without a newline) and log it
+#
+eerrorn()
+{
+ if yesno "${EINFO_QUIET}"; then
+ printf " $*" >/dev/stderr
+ else
+ if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
+ printf "\n"
+ fi
+ printf " ${BAD}*${NORMAL} ${RC_INDENTATION}$*"
+ fi
+
+ local name="${0##*/}"
+ # Log errors to system log
+ esyslog "daemon.err" "rc-scripts" "$*"
+
+ LAST_E_CMD="eerrorn"
+ return 0
+}
+
+#
+# show an error message (with a newline) and log it
+#
+eerror()
+{
+ if yesno "${EINFO_QUIET}"; then
+ printf " $*\n" >/dev/stderr
+ else
+ if ! yesno "${RC_ENDCOL}" && [ "${LAST_E_CMD}" = "ebegin" ]; then
+ printf "\n"
+ fi
+ printf " ${BAD}*${NORMAL} ${RC_INDENTATION}$*\n"
+ fi
+
+ local name="${0##*/}"
+ # Log errors to system log
+ esyslog "daemon.err" "rc-scripts" "$*"
+
+ LAST_E_CMD="eerror"
+ return 0
+}
+
+#
+# show a message indicating the start of a process
+#
+ebegin()
+{
+ local msg="$*"
+ if yesno "${EINFO_QUIET}"; then
+ return 0
+ fi
+
+ msg="${msg} ..."
+ einfon "${msg}"
+ if yesno "${RC_ENDCOL}"; then
+ printf "\n"
+ fi
+
+ LAST_E_LEN="$(( 3 + ${#RC_INDENTATION} + ${#msg} ))"
+ LAST_E_CMD="ebegin"
+ return 0
+}
+
+#
+# indicate the completion of process, called from eend/ewend
+# if error, show errstr via efunc
+#
+# This function is private to functions.sh. Do not call it from a
+# script.
+#
+_eend()
+{
+ local retval="${1:-0}" efunc="${2:-eerror}" msg
+ shift 2
+
+ if [ "${retval}" = "0" ]; then
+ yesno "${EINFO_QUIET}" && return 0
+ msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
+ else
+ if [ -c /dev/null ] ; then
+ rc_splash "stop" >/dev/null 2>&1 &
+ else
+ rc_splash "stop" &
+ fi
+ if [ -n "$*" ] ; then
+ ${efunc} "$*"
+ fi
+ msg="${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}"
+ fi
+
+ if yesno "${RC_ENDCOL}"; then
+ printf "${ENDCOL} ${msg}\n"
+ else
+ [ "${LAST_E_CMD}" = ebegin ] || LAST_E_LEN=0
+ printf "%$(( COLS - LAST_E_LEN - 6 ))s%b\n" '' "${msg}"
+ fi
+
+ return ${retval}
+}
+
+#
+# indicate the completion of process
+# if error, show errstr via eerror
+#
+eend()
+{
+ local retval="${1:-0}"
+ shift
+
+ _eend "${retval}" eerror "$*"
+
+ LAST_E_CMD="eend"
+ return ${retval}
+}
+
+#
+# indicate the completion of process
+# if error, show errstr via ewarn
+#
+ewend()
+{
+ local retval="${1:-0}"
+ shift
+
+ _eend "${retval}" ewarn "$*"
+
+ LAST_E_CMD="ewend"
+ return ${retval}
+}
+
+# v-e-commands honor EINFO_VERBOSE which defaults to no.
+# The condition is negated so the return value will be zero.
+veinfo()
+{
+ yesno "${EINFO_VERBOSE}" && einfo "$@"
+}
+
+veinfon()
+{
+ yesno "${EINFO_VERBOSE}" && einfon "$@"
+}
+
+vewarn()
+{
+ yesno "${EINFO_VERBOSE}" && ewarn "$@"
+}
+
+veerror()
+{
+ yesno "${EINFO_VERBOSE}" && eerror "$@"
+}
+
+vebegin()
+{
+ yesno "${EINFO_VERBOSE}" && ebegin "$@"
+}
+
+veend()
+{
+ yesno "${EINFO_VERBOSE}" && { eend "$@"; return $?; }
+ return ${1:-0}
+}
+
+vewend()
+{
+ yesno "${EINFO_VERBOSE}" && { ewend "$@"; return $?; }
+ return ${1:-0}
+}
+
+veindent()
+{
+ yesno "${EINFO_VERBOSE}" && eindent
+}
+
+veoutdent()
+{
+ yesno "${EINFO_VERBOSE}" && eoutdent
+}
+
+#
+# prints the current libdir {lib,lib32,lib64}
+#
+get_libdir()
+{
+ if [ -n "${CONF_LIBDIR_OVERRIDE}" ] ; then
+ CONF_LIBDIR="${CONF_LIBDIR_OVERRIDE}"
+ elif type portageq > /dev/null 2>&1; then
+ CONF_LIBDIR="$(portageq envvar CONF_LIBDIR)"
+ fi
+ printf "${CONF_LIBDIR:=lib}\n"
+}
+
+#
+# return 0 if gentoo=param was passed to the kernel
+#
+# EXAMPLE: if get_bootparam "nodevfs" ; then ....
+#
+get_bootparam()
+{
+ local x copt params retval=1
+
+ [ ! -r /proc/cmdline ] && return 1
+
+ read copts < /proc/cmdline
+ for copt in $copts ; do
+ if [ "${copt%=*}" = "gentoo" ] ; then
+ params=$(gawk -v PARAMS="${copt##*=}" '
+ BEGIN {
+ split(PARAMS, nodes, ",")
+ for (x in nodes)
+ print nodes[x]
+ }')
+
+ # Parse gentoo option
+ for x in ${params} ; do
+ if [ "${x}" = "$1" ] ; then
+# echo "YES"
+ retval=0
+ fi
+ done
+ fi
+ done
+
+ return ${retval}
+}
+
+#
+# return 0 if any of the files/dirs are newer than
+# the reference file
+#
+# EXAMPLE: if is_older_than a.out *.o ; then ...
+is_older_than()
+{
+ local x=
+ local ref="$1"
+ shift
+
+ for x in "$@" ; do
+ [ "${x}" -nt "${ref}" ] && return 0
+ [ -d "${x}" ] && is_older_than "${ref}" "${x}"/* && return 0
+ done
+
+ return 1
+}
+
+# This is the main script, please add all functions above this point!
+
+# Dont output to stdout?
+EINFO_QUIET="${EINFO_QUIET:-no}"
+EINFO_VERBOSE="${EINFO_VERBOSE:-no}"
+
+# Should we use color?
+RC_NOCOLOR="${RC_NOCOLOR:-no}"
+# Can the terminal handle endcols?
+RC_ENDCOL="yes"
+
+# Default values for e-message indentation and dots
+RC_INDENTATION=''
+RC_DEFAULT_INDENT=2
+RC_DOT_PATTERN=''
+
+# Cache the CONSOLETYPE - this is important as backgrounded shells don't
+# have a TTY. rc unsets it at the end of running so it shouldn't hang
+# around
+if [ -z "${CONSOLETYPE}" ] ; then
+ CONSOLETYPE="$(consoletype 2>/dev/null )"; export CONSOLETYPE
+fi
+if [ "${CONSOLETYPE}" = "serial" ] ; then
+ RC_NOCOLOR="yes"
+ RC_ENDCOL="no"
+fi
+
+for arg in "$@" ; do
+ case "${arg}" in
+ # Lastly check if the user disabled it with --nocolor argument
+ --nocolor|-nc)
+ RC_NOCOLOR="yes"
+ ;;
+ esac
+done
+
+# Setup COLS and ENDCOL so eend can line up the [ ok ]
+COLS="${COLUMNS:-0}" # bash's internal COLUMNS variable
+[ "$COLS" -eq 0 ] && \
+ COLS="$(set -- $(stty size 2>/dev/null) ; printf "$2\n")"
+[ "$COLS" -gt 0 ] || COLS=80 # width of [ ok ] == 7
+
+if yesno "${RC_ENDCOL}"; then
+ ENDCOL='\033[A\033['$(( COLS - 8 ))'C'
+else
+ ENDCOL=''
+fi
+
+# Setup the colors so our messages all look pretty
+if yesno "${RC_NOCOLOR}"; then
+ unset GOOD WARN BAD NORMAL HILITE BRACKET
+elif (type tput && tput colors) >/dev/null 2>&1; then
+ GOOD="$(tput sgr0)$(tput bold)$(tput setaf 2)"
+ WARN="$(tput sgr0)$(tput bold)$(tput setaf 3)"
+ BAD="$(tput sgr0)$(tput bold)$(tput setaf 1)"
+ HILITE="$(tput sgr0)$(tput bold)$(tput setaf 6)"
+ BRACKET="$(tput sgr0)$(tput bold)$(tput setaf 4)"
+ NORMAL="$(tput sgr0)"
+else
+ GOOD=$(printf '\033[32;01m')
+ WARN=$(printf '\033[33;01m')
+ BAD=$(printf '\033[31;01m')
+ HILITE=$(printf '\033[36;01m')
+ BRACKET=$(printf '\033[34;01m')
+ NORMAL=$(printf '\033[0m')
+fi
+
+# vim:ts=4
diff --git a/sys-apps/gentoo-functions/gentoo-functions-0.2.ebuild b/sys-apps/gentoo-functions/gentoo-functions-0.2.ebuild
new file mode 100644
index 000000000000..44b750d6048e
--- /dev/null
+++ b/sys-apps/gentoo-functions/gentoo-functions-0.2.ebuild
@@ -0,0 +1,25 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/gentoo-functions/gentoo-functions-0.2.ebuild,v 1.1 2014/03/12 22:06:42 williamh Exp $
+
+EAPI=5
+
+DESCRIPTION="base shell functions required by all gentoo systems"
+HOMEPAGE="http://www.gentoo.org"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd"
+IUSE=""
+
+DEPEND=""
+RDEPEND=""
+
+S="${WORKDIR}"
+
+src_install() {
+ dodir /lib/gentoo
+ insinto /lib/gentoo
+ newins "${FILESDIR}"/${P}.sh functions.sh
+}