--- trunk/mage/usr/lib/mage/env-rebuild.sh 2011/12/28 10:17:56 1569 +++ trunk/mage/usr/lib/mage/env-rebuild.sh 2011/12/28 10:26:01 1570 @@ -31,48 +31,48 @@ [[ ${file} = ${MROOT}/etc/env.d/\* ]] && continue # reads content of every file - while read path + while read line do # ignore if empty or a comment - case "${path}" in + case "${line}" in \#*|"") continue ;; esac - # writes LDPATH to ${P}/etc/ld.so.conf, - # anything else to ${P}/etc/profile.env - if [[ ${path%%=*} = LDPATH ]] + variable="${line%%=*}" + # substitudes " from $line if exists + path="${line//\"}" #}" <--- make code readable again :) + value="${line##*=}" + + # writes LDPATH to ${MROOT}/etc/ld.so.conf, + # anything else to ${MROOT}/etc/profile.env + if [[ ${variable} = LDPATH ]] then - #substitudes " from $path if exists - path="${path//\"}" #}" <--- make code readable again :) - echo "${path##*=}" >> ${MROOT}/etc/ld.so.conf + echo "${value}" >> ${MROOT}/etc/ld.so.conf else # checks if var exists in specialvars for i in ${SPECIALVARS} do - [[ ${path%%=*} = ${i} ]] && SPECVAR="yes" + [[ ${variable} = ${i} ]] && SPECVAR="yes" done if [[ ${SPECVAR} = yes ]] then - case ${path%%=*} in + case ${variable} in CONFIG_PROTECT*|XDG*) # CONFIG_PROTECT*|XDG* have as delimiter not ':' but ' ' - path="${path//\"}" #}" <--- make code readable again :) - echo -n "${path##*=} " >> ${TMPDIR}/${path%%=*} + echo -n "${value} " >> ${TMPDIR}/${variable} unset SPECVAR ;; *) - # special var are written to tmpfile + # special vars are written to tmpfile # to substitude them to one variable - # substitudes " from $path if exists - path="${path//\"}" #}" <--- make code readable again :) - echo -n "${path##*=}:" >> ${TMPDIR}/${path%%=*} + echo -n "${value}:" >> ${TMPDIR}/${variable} unset SPECVAR ;; esac else # all other vars go directly to /etc/profile.env - echo "export ${path}" >> ${MROOT}/etc/profile.env + echo "export ${line}" >> ${MROOT}/etc/profile.env fi fi done << EOF @@ -82,18 +82,18 @@ done # reads special vars tmp files and writes them to /etc/profile.env -for i in ${SPECIALVARS} +for variable in ${SPECIALVARS} do - if [ -f ${TMPDIR}/${i} ] + if [ -f ${TMPDIR}/${variable} ] then # only OMF_DIR goes to /etc/scrollkeeper.conf - if [[ ${i} = OMF_DIR ]] + if [[ ${variable} = OMF_DIR ]] then - echo "${i}=$(cat ${TMPDIR}/${i})" > ${MROOT}/etc/scrollkeeper.conf + echo "${variable}=$(< ${TMPDIR}/${variable})" > ${MROOT}/etc/scrollkeeper.conf else - echo "export ${i}=\"$(cat ${TMPDIR}/${i})\"" >> ${MROOT}/etc/profile.env + echo "export ${variable}=\"$(< ${TMPDIR}/${variable})\"" >> ${MROOT}/etc/profile.env fi - rm ${TMPDIR}/${i} + rm ${TMPDIR}/${variable} fi done