Magellan Linux

Diff of /branches/mage-next/src/env-rebuild.in

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

revision 2548 by niro, Wed Jan 29 11:46:20 2014 UTC revision 2549 by niro, Wed Jan 29 11:47:55 2014 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2  # $Id$  # $Id$
3  #  #
4  # rebuilds @@SYSCONFDIR@@/{ld.so.conf,profile.env} with given files from @@ENVDDIR@@  # rebuilds /etc/{ld.so.conf,profile.env} with given files from /etc/env.d
5  #  #
6    
7  SPECIALVARS="KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH"  SPECIALVARS="KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH"
# Line 21  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  :> ${MROOT}@@SYSCONFDIR@@/ld.so.conf  :> ${MROOT}/etc/ld.so.conf
25  :> ${MROOT}@@SYSCONFDIR@@/profile.env  :> ${MROOT}/etc/profile.env
26    
27  # read everything from @@ENDDIR@@  # read everything from /etc/env.d
28  for file in ${MROOT}@@ENVDDIR@@/*  for file in ${MROOT}/etc/env.d/*
29  do  do
30   # abort if "empty"   # abort if "empty"
31   [[ ${file} = ${MROOT}@@ENVDDIR@@/\* ]] && continue   [[ ${file} = ${MROOT}/etc/env.d/\* ]] && continue
32    
33   # reads content of every file   # reads content of every file
34   while read line   while read line
# Line 45  do Line 45  do
45   value="${value//\"}" #}" <--- make code readable again :)   value="${value//\"}" #}" <--- make code readable again :)
46   value="${value//\'}"   value="${value//\'}"
47    
48   # writes LDPATH to ${MROOT}@@SYSCONFDIR@@/ld.so.conf,   # writes LDPATH to ${MROOT}/etc/ld.so.conf,
49   # anything else to ${MROOT}@@SYSCONFDIR@@/profile.env   # anything else to ${MROOT}/etc/profile.env
50   if [[ ${variable} = LDPATH ]]   if [[ ${variable} = LDPATH ]]
51   then   then
52   echo "${value}" >> ${MROOT}@@SYSCONFDIR@@/ld.so.conf   echo "${value}" >> ${MROOT}/etc/ld.so.conf
53   else   else
54   # checks if var exists in specialvars   # checks if var exists in specialvars
55   for i in ${SPECIALVARS}   for i in ${SPECIALVARS}
# Line 100  do Line 100  do
100  done  done
101    
102  # rebuilds environment  # rebuilds environment
103  ldconfig -r "${MROOT}" -f @@SYSCONFDIR@@/ld.so.conf -C @@SYSCONFDIR@@/ld.so.cache  ldconfig -r "${MROOT}" -f /etc/ld.so.conf -C /etc/ld.so.cache
104  [ -f ${MROOT}@@SYSCONFDIR@@/profile ] && source ${MROOT}@@SYSCONFDIR@@/profile  [ -f ${MROOT}/etc/profile ] && source ${MROOT}/etc/profile
105    
106  # cleanups  # cleanups
107  [ -d ${TMPDIR} ] && rm -rf ${TMPDIR}  [ -d ${TMPDIR} ] && rm -rf ${TMPDIR}

Legend:
Removed from v.2548  
changed lines
  Added in v.2549