--- trunk/mage/usr/lib/mage/env-rebuild.sh 2005/06/01 15:48:52 78 +++ trunk/mage/usr/lib/mage/env-rebuild.sh 2005/09/09 16:34:35 223 @@ -1,6 +1,6 @@ #!/bin/sh -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/env-rebuild.sh,v 1.7 2005-06-01 15:48:11 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/env-rebuild.sh,v 1.8 2005-09-09 16:30:25 niro Exp $ # # rebuilds /etc/{ld.so.conf,profile.env} with given files from /etc/env.d # @@ -14,14 +14,14 @@ # ## -#sets root path -P="" +# sets root path +P="${MROOT}" SPECIALVARS="KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH CONFIG_PROTECT CONFIG_PROTECT_MASK PRELINK_PATH PRELINK_PATH_MASK OMF_DIR" #SPECIALVARS="KDEDIRS PATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH CLASSPATH" echo -en "\n>>>> Rebuilding environment... " -#deletes existing conf files +# deletes existing conf files if [ -f ${P}/etc/ld.so.conf ] then rm ${P}/etc/ld.so.conf @@ -32,23 +32,23 @@ rm ${P}/etc/profile.env fi -#gets everything in /etc/env.d +# gets everything in /etc/env.d for file in ${P}/etc/env.d/* do - #reads content of every file + # reads content of every file while read path do - if [ -n "$path" ] + if [ -n "${path}" ] then - #writes LDPATH to ${P}/etc/ld.so.conf, - #anything else to ${P}/etc/profile.env - if [ "${path%%=*}" == LDPATH ] + # writes LDPATH to ${P}/etc/ld.so.conf, + # anything else to ${P}/etc/profile.env + if [[ ${path%%=*} = LDPATH ]] then #substitudes " from $path if exists - path="${path//\"}" + path="${path//\"}" #}" <--- make code readable again :) echo "${path##*=}" >> ${P}/etc/ld.so.conf else - #checks if var exists in specialvars + # checks if var exists in specialvars for i in $SPECIALVARS do if [ "${path%%=*}" == "$i" ] @@ -57,36 +57,36 @@ fi done - if [ "$SPECVAR" == "yes" ] + if [[ ${SPECVAR} = yes ]] then - if [ "${path%%=*}" == "CONFIG_PROTECT" -o "${path%%=*}" == "CONFIG_PROTECT_MASK" ] + if [[ ${path%%=*} = CONFIG_PROTECT ]] || [[ ${path%%=*} = CONFIG_PROTECT_MASK ]] then - #CONFIG_PROTECTS has as delimiter not ':' but ' ' - path="${path//\"}" + # CONFIG_PROTECTS has as delimiter not ':' but ' ' + path="${path//\"}" #}" <--- make code readable again :) echo -n "${path##*=} " >> /var/tmp/${path%%=*} unset SPECVAR else - #special var are written to tmpfile + # special var are written to tmpfile # to substitude them to one variable - #substitudes " from $path if exists - path="${path//\"}" + # substitudes " from $path if exists + path="${path//\"}" #}" <--- make code readable again :) echo -n "${path##*=}:" >> /var/tmp/${path%%=*} unset SPECVAR fi else - #all other vars go directly to /etc/profile.env + # all other vars go directly to /etc/profile.env echo "export $path" >> ${P}/etc/profile.env fi fi fi done << EOF -$(cat $file) +$(cat ${file}) EOF done -#reads special vars tmp files and writes them to /etc/profile.env -for i in $SPECIALVARS +# reads special vars tmp files and writes them to /etc/profile.env +for i in ${SPECIALVARS} do if [ -f /var/tmp/${i} ] then @@ -101,8 +101,8 @@ fi done -#rebuilds environment -ldconfig +# rebuilds environment +ldconfig -r "${P}" -f /etc/ld.so.conf -C /etc/ld.so.cache source ${P}/etc/profile echo -e "done.\n"