diff options
author | Bernard Cafarelli <voyageur@gentoo.org> | 2007-10-05 10:51:20 +0000 |
---|---|---|
committer | Bernard Cafarelli <voyageur@gentoo.org> | 2007-10-05 10:51:20 +0000 |
commit | e8216308adc89a43c98c4ee5fac96bd88f86ac18 (patch) | |
tree | e8404418b20a3629b1fd21db7bac952da1825475 /eclass/gnustep-base.eclass | |
parent | Add quoting for variables. (diff) | |
download | historical-e8216308adc89a43c98c4ee5fac96bd88f86ac18.tar.gz historical-e8216308adc89a43c98c4ee5fac96bd88f86ac18.tar.bz2 historical-e8216308adc89a43c98c4ee5fac96bd88f86ac18.zip |
Update convenience scripts generation from the gnustep overlay
Diffstat (limited to 'eclass/gnustep-base.eclass')
-rw-r--r-- | eclass/gnustep-base.eclass | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/eclass/gnustep-base.eclass b/eclass/gnustep-base.eclass index 9434922a3e1d..cbf8a4263a26 100644 --- a/eclass/gnustep-base.eclass +++ b/eclass/gnustep-base.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.3 2007/09/17 10:58:04 grobian Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.4 2007/10/05 10:51:20 voyageur Exp $ inherit eutils flag-o-matic @@ -166,8 +166,43 @@ egnustep_install_config() { local cfile=config-${PN}.sh - echo '#!/usr/bin/env bash' > "${T}"/${cfile} - echo "echo Applying ${P} default configuration ..." >> "${T}"/${cfile} + cat << EOF > "${T}"/${cfile} +#!/usr/bin/env bash +gnustep_append_default() { + if [[ -z \$1 || -z \$2 || -z \$3 ]]; then + echo "warning: invalid script invocation" + return + fi + dom=\$1 + key=\$2 + val=\$3 + cur=\$(defaults read \${dom} \${key}) 2> /dev/null + if [[ -z \$cur ]] ; then + echo " * setting \${dom} \${key}" + defaults write \${dom} \${key} "( \${val} )" + elif [[ \${cur} != *\${val}* ]] ; then + echo " * adding \${val} to \${dom} \${key}" + echo "\${cur%)\'}, \"\${val}\" )'" | defaults write + else + echo " * \${val} already present in \${dom} \${key}" + fi +} + +gnustep_set_default() { + if [[ -z \$1 || -z \$2 || -z \$3 ]]; then + echo "warning: invalid script invocation" + return + fi + dom=\$1 + key=\$2 + val=\$3 + echo " * setting \${dom} \${key}" + defaults write \${dom} \${key} \${val} +} + +echo "Applying ${P} default configuration ..." +EOF + gnustep_config_script | \ while read line ; do echo "${line}" >> "${T}"/${cfile} |