31 |
[[ ${file} = ${MROOT}/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 line |
35 |
do |
do |
36 |
# ignore if empty or a comment |
# ignore if empty or a comment |
37 |
case "${path}" in |
case "${line}" in |
38 |
\#*|"") continue ;; |
\#*|"") continue ;; |
39 |
esac |
esac |
40 |
|
|
41 |
# writes LDPATH to ${P}/etc/ld.so.conf, |
variable="${line%%=*}" |
42 |
# anything else to ${P}/etc/profile.env |
# substitudes " from $line if exists |
43 |
if [[ ${path%%=*} = LDPATH ]] |
path="${line//\"}" #}" <--- make code readable again :) |
44 |
|
value="${line##*=}" |
45 |
|
|
46 |
|
# writes LDPATH to ${MROOT}/etc/ld.so.conf, |
47 |
|
# anything else to ${MROOT}/etc/profile.env |
48 |
|
if [[ ${variable} = LDPATH ]] |
49 |
then |
then |
50 |
#substitudes " from $path if exists |
echo "${value}" >> ${MROOT}/etc/ld.so.conf |
|
path="${path//\"}" #}" <--- make code readable again :) |
|
|
echo "${path##*=}" >> ${MROOT}/etc/ld.so.conf |
|
51 |
else |
else |
52 |
# checks if var exists in specialvars |
# checks if var exists in specialvars |
53 |
for i in ${SPECIALVARS} |
for i in ${SPECIALVARS} |
54 |
do |
do |
55 |
[[ ${path%%=*} = ${i} ]] && SPECVAR="yes" |
[[ ${variable} = ${i} ]] && SPECVAR="yes" |
56 |
done |
done |
57 |
|
|
58 |
if [[ ${SPECVAR} = yes ]] |
if [[ ${SPECVAR} = yes ]] |
59 |
then |
then |
60 |
case ${path%%=*} in |
case ${variable} in |
61 |
CONFIG_PROTECT*|XDG*) |
CONFIG_PROTECT*|XDG*) |
62 |
# CONFIG_PROTECT*|XDG* have as delimiter not ':' but ' ' |
# CONFIG_PROTECT*|XDG* have as delimiter not ':' but ' ' |
63 |
path="${path//\"}" #}" <--- make code readable again :) |
echo -n "${value} " >> ${TMPDIR}/${variable} |
|
echo -n "${path##*=} " >> ${TMPDIR}/${path%%=*} |
|
64 |
unset SPECVAR |
unset SPECVAR |
65 |
;; |
;; |
66 |
*) |
*) |
67 |
# special var are written to tmpfile |
# special vars are written to tmpfile |
68 |
# to substitude them to one variable |
# to substitude them to one variable |
69 |
# substitudes " from $path if exists |
echo -n "${value}:" >> ${TMPDIR}/${variable} |
|
path="${path//\"}" #}" <--- make code readable again :) |
|
|
echo -n "${path##*=}:" >> ${TMPDIR}/${path%%=*} |
|
70 |
unset SPECVAR |
unset SPECVAR |
71 |
;; |
;; |
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}" >> ${MROOT}/etc/profile.env |
echo "export ${line}" >> ${MROOT}/etc/profile.env |
76 |
fi |
fi |
77 |
fi |
fi |
78 |
done << EOF |
done << EOF |
82 |
done |
done |
83 |
|
|
84 |
# reads special vars tmp files and writes them to /etc/profile.env |
# reads special vars tmp files and writes them to /etc/profile.env |
85 |
for i in ${SPECIALVARS} |
for variable in ${SPECIALVARS} |
86 |
do |
do |
87 |
if [ -f ${TMPDIR}/${i} ] |
if [ -f ${TMPDIR}/${variable} ] |
88 |
then |
then |
89 |
# only OMF_DIR goes to /etc/scrollkeeper.conf |
# only OMF_DIR goes to /etc/scrollkeeper.conf |
90 |
if [[ ${i} = OMF_DIR ]] |
if [[ ${variable} = OMF_DIR ]] |
91 |
then |
then |
92 |
echo "${i}=$(cat ${TMPDIR}/${i})" > ${MROOT}/etc/scrollkeeper.conf |
echo "${variable}=$(< ${TMPDIR}/${variable})" > ${MROOT}/etc/scrollkeeper.conf |
93 |
else |
else |
94 |
echo "export ${i}=\"$(cat ${TMPDIR}/${i})\"" >> ${MROOT}/etc/profile.env |
echo "export ${variable}=\"$(< ${TMPDIR}/${variable})\"" >> ${MROOT}/etc/profile.env |
95 |
fi |
fi |
96 |
rm ${TMPDIR}/${i} |
rm ${TMPDIR}/${variable} |
97 |
fi |
fi |
98 |
done |
done |
99 |
|
|