Magellan Linux

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

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

revision 260 by niro, Tue Oct 4 15:24:33 2005 UTC revision 1272 by niro, Wed Apr 27 08:43:45 2011 UTC
# Line 1  Line 1 
1  #!/bin/sh  #!/bin/sh
2    
3  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/env-rebuild.sh,v 1.10 2005-10-04 15:24:33 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/env-rebuild.sh,v 1.13 2007-07-01 00:35:29 niro Exp $
4  #  #
5  # 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
6  #  #
# Line 16  Line 16 
16    
17  # sets root path  # sets root path
18  P="${MROOT}"  P="${MROOT}"
19  SPECIALVARS="KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH CONFIG_PROTECT CONFIG_PROTECT_MASK PRELINK_PATH PRELINK_PATH_MASK OMF_DIR"  SPECIALVARS="KDEDIRS PATH CLASSPATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH CONFIG_PROTECT CONFIG_PROTECT_MASK CONFIG_PROTECT_IGNORE PRELINK_PATH PRELINK_PATH_MASK OMF_DIR LIBGL_DRIVERS_PATH XDG_CONFIG_DIRS XDG_DATA_DIRS"
 #SPECIALVARS="KDEDIRS PATH LDPATH MANPATH INFODIR INFOPATH ROOTPATH CLASSPATH"  
20    
21  # secure tmp dir  # secure tmp dir
22  if [ -x /bin/mktemp ]  if [ -x /bin/mktemp ]
# Line 25  then Line 24  then
24   TMPDIR="$(/bin/mktemp -d -p /var/tmp)"   TMPDIR="$(/bin/mktemp -d -p /var/tmp)"
25  else  else
26   TMPDIR="/var/tmp/tmp.$$"   TMPDIR="/var/tmp/tmp.$$"
27     install -d ${TMPDIR}
28  fi  fi
29    
30  echo -en "\n>>>> Rebuilding environment... "  echo -en "\n>>>> Rebuilding environment... "
# Line 42  do Line 42  do
42   # reads content of every file   # reads content of every file
43   while read path   while read path
44   do   do
45   # abort if empty   # ignore if empty or a comment
46   [[ -z ${path} ]] && continue   case "${path}" in
47     \#*|"") continue ;;
48     esac
49    
50   # writes LDPATH to ${P}/etc/ld.so.conf,   # writes LDPATH to ${P}/etc/ld.so.conf,
51   # anything else to ${P}/etc/profile.env   # anything else to ${P}/etc/profile.env
# Line 61  do Line 63  do
63    
64   if [[ ${SPECVAR} = yes ]]   if [[ ${SPECVAR} = yes ]]
65   then   then
66   if [[ ${path%%=*} = CONFIG_PROTECT ]] || [[ ${path%%=*} = CONFIG_PROTECT_MASK ]]   case ${path%%=*} in
67   then   CONFIG_PROTECT*|XDG*)
68   # CONFIG_PROTECTS has as delimiter  not ':'  but ' '   # CONFIG_PROTECT*|XDG* have as delimiter  not ':'  but ' '
69   path="${path//\"}" #}" <--- make code readable again :)   path="${path//\"}" #}" <--- make code readable again :)
70   echo -n "${path##*=} " >> ${TMPDIR}/${path%%=*}   echo -n "${path##*=} " >> ${TMPDIR}/${path%%=*}
71   unset SPECVAR   unset SPECVAR
72   else   ;;
73   # special var are written to tmpfile   *)
74   # to substitude them to one variable   # special var are written to tmpfile
75   # substitudes " from $path if exists   # to substitude them to one variable
76   path="${path//\"}" #}" <--- make code readable again :)   # substitudes " from $path if exists
77   echo -n "${path##*=}:" >> ${TMPDIR}/${path%%=*}   path="${path//\"}" #}" <--- make code readable again :)
78   unset SPECVAR   echo -n "${path##*=}:" >> ${TMPDIR}/${path%%=*}
79   fi   unset SPECVAR
80     ;;
81     esac
82   else   else
83   # all other vars go directly to /etc/profile.env   # all other vars go directly to /etc/profile.env
84   echo "export ${path}" >> ${P}/etc/profile.env   echo "export ${path}" >> ${P}/etc/profile.env

Legend:
Removed from v.260  
changed lines
  Added in v.1272