/[gentoo-x86]/eclass/gnustep-base.eclass
Gentoo

Diff of /eclass/gnustep-base.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.3 Revision 1.4
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.3 2007/09/17 10:58:04 grobian Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/gnustep-base.eclass,v 1.4 2007/10/05 10:51:20 voyageur Exp $
4 4
5inherit eutils flag-o-matic 5inherit eutils flag-o-matic
6 6
7# Inner gnustep eclass, should only be inherited directly by gnustep-base 7# Inner gnustep eclass, should only be inherited directly by gnustep-base
8# packages 8# packages
164egnustep_install_config() { 164egnustep_install_config() {
165 [[ $(type -t gnustep_config_script) != "function" ]] && return 0 165 [[ $(type -t gnustep_config_script) != "function" ]] && return 0
166 166
167 local cfile=config-${PN}.sh 167 local cfile=config-${PN}.sh
168 168
169 echo '#!/usr/bin/env bash' > "${T}"/${cfile} 169 cat << EOF > "${T}"/${cfile}
170#!/usr/bin/env bash
171gnustep_append_default() {
172 if [[ -z \$1 || -z \$2 || -z \$3 ]]; then
173 echo "warning: invalid script invocation"
174 return
175 fi
176 dom=\$1
177 key=\$2
178 val=\$3
179 cur=\$(defaults read \${dom} \${key}) 2> /dev/null
180 if [[ -z \$cur ]] ; then
181 echo " * setting \${dom} \${key}"
182 defaults write \${dom} \${key} "( \${val} )"
183 elif [[ \${cur} != *\${val}* ]] ; then
184 echo " * adding \${val} to \${dom} \${key}"
185 echo "\${cur%)\'}, \"\${val}\" )'" | defaults write
186 else
187 echo " * \${val} already present in \${dom} \${key}"
188 fi
189}
190
191gnustep_set_default() {
192 if [[ -z \$1 || -z \$2 || -z \$3 ]]; then
193 echo "warning: invalid script invocation"
194 return
195 fi
196 dom=\$1
197 key=\$2
198 val=\$3
199 echo " * setting \${dom} \${key}"
200 defaults write \${dom} \${key} \${val}
201}
202
170 echo "echo Applying ${P} default configuration ..." >> "${T}"/${cfile} 203echo "Applying ${P} default configuration ..."
204EOF
205
171 gnustep_config_script | \ 206 gnustep_config_script | \
172 while read line ; do 207 while read line ; do
173 echo "${line}" >> "${T}"/${cfile} 208 echo "${line}" >> "${T}"/${cfile}
174 done 209 done
175 echo 'echo "done"' >> "${T}"/${cfile} 210 echo 'echo "done"' >> "${T}"/${cfile}

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.20