On 10:51 Fri 05 Oct , Bernard Cafarelli (voyageur) wrote:
> 1.4 eclass/gnustep-base.eclass
>
> file :
> http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?rev=1.4&view=markup
> plain:
> http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?rev=1.4&content-type=text/plain
> diff :
> http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/gnustep-base.eclass?r1=1.3&r2=1.4
> @@ -166,8 +166,43 @@
>
> 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
> +
There's gotta be a better way of doing this. All those escapes really
start to obfuscate the code. Anyone got a better idea?
Thanks,
Donnie
--
[EMAIL PROTECTED] mailing list