Magellan Linux

Diff of /trunk/mage/usr/lib/mage/env-rebuild.sh

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

revision 1567 by niro, Wed Dec 28 10:13:52 2011 UTC revision 1568 by niro, Wed Dec 28 10:16:42 2011 UTC
# Line 4  Line 4 
4  # rebuilds /etc/{ld.so.conf,profile.env} with given files from /etc/env.d  # rebuilds /etc/{ld.so.conf,profile.env} with given files from /etc/env.d
5  #  #
6    
 # sets root path  
 P="${MROOT}"  
   
7  SPECIALVARS="KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH"  SPECIALVARS="KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH"
8  SPECIALVARS+=" CONFIG_PROTECT CONFIG_PROTECT_MASK CONFIG_PROTECT_IGNORE"  SPECIALVARS+=" CONFIG_PROTECT CONFIG_PROTECT_MASK CONFIG_PROTECT_IGNORE"
9  SPECIALVARS+=" PRELINK_PATH PRELINK_PATH_MASK"  SPECIALVARS+=" PRELINK_PATH PRELINK_PATH_MASK"
# Line 24  fi Line 21  fi
21  echo -en "\n>>>> Rebuilding environment... "  echo -en "\n>>>> Rebuilding environment... "
22    
23  # clean existing conf files  # clean existing conf files
24  :> ${P}/etc/ld.so.conf  :> ${MROOT}/etc/ld.so.conf
25  :> ${P}/etc/profile.env  :> ${MROOT}/etc/profile.env
26    
27  # gets everything in /etc/env.d  # gets everything in /etc/env.d
28  for file in ${P}/etc/env.d/*  for file in ${MROOT}/etc/env.d/*
29  do  do
30   # abort if "empty"   # abort if "empty"
31   [[ ${file} = ${P}/etc/env.d/\* ]] && continue   [[ ${file} = ${MROOT}/etc/env.d/\* ]] && continue
32    
33   # reads content of every file   # reads content of every file
34   while read path   while read path
# Line 47  do Line 44  do
44   then   then
45   #substitudes " from $path if exists   #substitudes " from $path if exists
46   path="${path//\"}" #}" <--- make code readable again :)   path="${path//\"}" #}" <--- make code readable again :)
47   echo "${path##*=}" >> ${P}/etc/ld.so.conf   echo "${path##*=}" >> ${MROOT}/etc/ld.so.conf
48   else   else
49   # checks if var exists in specialvars   # checks if var exists in specialvars
50   for i in ${SPECIALVARS}   for i in ${SPECIALVARS}
# Line 75  do Line 72  do
72   esac   esac
73   else   else
74   # all other vars go directly to /etc/profile.env   # all other vars go directly to /etc/profile.env
75   echo "export ${path}" >> ${P}/etc/profile.env   echo "export ${path}" >> ${MROOT}/etc/profile.env
76   fi   fi
77   fi   fi
78   done << EOF   done << EOF
# Line 92  do Line 89  do
89   # only OMF_DIR goes to /etc/scrollkeeper.conf   # only OMF_DIR goes to /etc/scrollkeeper.conf
90   if [[ ${i} = OMF_DIR ]]   if [[ ${i} = OMF_DIR ]]
91   then   then
92   echo "${i}=$(cat ${TMPDIR}/${i})" > ${P}/etc/scrollkeeper.conf   echo "${i}=$(cat ${TMPDIR}/${i})" > ${MROOT}/etc/scrollkeeper.conf
93   else   else
94   echo "export ${i}=\"$(cat ${TMPDIR}/${i})\"" >> ${P}/etc/profile.env   echo "export ${i}=\"$(cat ${TMPDIR}/${i})\"" >> ${MROOT}/etc/profile.env
95   fi   fi
96   rm ${TMPDIR}/${i}   rm ${TMPDIR}/${i}
97   fi   fi
98  done  done
99    
100  # rebuilds environment  # rebuilds environment
101  ldconfig -r "${P}" -f /etc/ld.so.conf -C /etc/ld.so.cache  ldconfig -r "${MROOT}" -f /etc/ld.so.conf -C /etc/ld.so.cache
102  [ -f ${P}/etc/profile ] && source ${P}/etc/profile  [ -f ${MROOT}/etc/profile ] && source ${MROOT}/etc/profile
103    
104  # cleanups  # cleanups
105  [ -d ${TMPDIR} ] && rm -rf ${TMPDIR}  [ -d ${TMPDIR} ] && rm -rf ${TMPDIR}

Legend:
Removed from v.1567  
changed lines
  Added in v.1568