diff options
author | 2010-11-21 20:33:31 +0000 | |
---|---|---|
committer | 2010-11-21 20:33:31 +0000 | |
commit | 259b0299d59bd634bcccd92af81282536fc51185 (patch) | |
tree | 4211dc96d0385e0506ebd34401da22f77d752448 /dev-util/ccache/files | |
parent | Stable on amd64 wrt bug #346233 (diff) | |
download | historical-259b0299d59bd634bcccd92af81282536fc51185.tar.gz historical-259b0299d59bd634bcccd92af81282536fc51185.tar.bz2 historical-259b0299d59bd634bcccd92af81282536fc51185.zip |
convert to /bin/sh and use standard gentoo output funcs
Diffstat (limited to 'dev-util/ccache/files')
-rw-r--r-- | dev-util/ccache/files/ccache-config | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/dev-util/ccache/files/ccache-config b/dev-util/ccache/files/ccache-config index 1cd2b37810ec..8c1bcb2d3734 100644 --- a/dev-util/ccache/files/ccache-config +++ b/dev-util/ccache/files/ccache-config @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # # ccache-config - helper script for ccache and its ebuild # @@ -10,15 +10,27 @@ # # Additional features to come; this provides a starting point -# this should be getopt'd someday (override with CC_QUIET=1) -CC_VERBOSE=1 +. /etc/init.d/functions.sh 2>/dev/null || { + ebegin() { echo " * $* ..."; } + eend() { + local r=${1:-$?} + [ ${r} -eq 0 ] && echo " [ OK ]" || echo " [ !! ]" + return $r + } +} LIBDIR="lib" -cc_echo() { - [ -z "${CC_QUIET}" -a -n "${CC_VERBOSE}" ] && echo "$*" +# this should be getopt'd someday (override with CC_QUIET=1) +CC_VERBOSE=1 +unset _CC_QUIET +c_quiet() { + [ -n "${CC_QUIET:-${_CC_QUIET}}" ] || [ -z "${CC_VERBOSE}" ] } +c_ebegin() { c_quiet || ebegin "$@" ; } +c_eend() { c_quiet || eend "$@" ; } + ### # the following functions manage the ccache symlinks # they allow the user or other scripts (namely gcc-config) to @@ -30,8 +42,9 @@ cc_path() { cc_remove_link() { local t=$(cc_path "$1") if [ -L ${t} ]; then - cc_echo "Removing ${t}..." + c_ebegin "Removing ${t}" rm -f "${t}" + c_eend fi } cc_install_link() { @@ -40,12 +53,15 @@ cc_install_link() { if [ -n "$(type -p ${1})" ]; then # first be sure any old link is removed - CC_QUIET=1 cc_remove_link "${1}" + _CC_QUIET=1 + cc_remove_link "${1}" + unset _CC_QUIET # then create the new link local t=$(cc_path "$1") - cc_echo "Creating ccache shadow link: ${t}..." - ln -s /usr/bin/ccache "${t}" + c_ebegin "Creating ccache shadow link ${t}" + mkdir -p -m 0755 "${t%/*}" && ln -s /usr/bin/ccache "${t}" + c_eend fi } cc_links() { |