Line
Link Here
|
0 |
-- motif-config |
0 |
++ motif-config |
Lines 59-64
Link Here
|
59 |
|
59 |
|
60 |
_activate_profile() { |
60 |
_activate_profile() { |
61 |
_check_root |
61 |
_check_root |
|
|
62 |
local retval=0 |
62 |
|
63 |
|
63 |
if [ -z "${1}" ]; then |
64 |
if [ -z "${1}" ]; then |
64 |
return 0 |
65 |
return 0 |
Lines 71-105
Link Here
|
71 |
for file in `ls /usr/lib/${new}/ | grep lib`; do |
72 |
for file in `ls /usr/lib/${new}/ | grep lib`; do |
72 |
files="${files} /usr/lib/${file}" |
73 |
files="${files} /usr/lib/${file}" |
73 |
rm -f /usr/lib/${file} |
74 |
rm -f /usr/lib/${file} |
|
|
75 |
retval=$((retval | $? )) |
74 |
ln -s /usr/lib/${new}/${file} /usr/lib/${file} |
76 |
ln -s /usr/lib/${new}/${file} /usr/lib/${file} |
|
|
77 |
retval=$((retval | $? )) |
75 |
done |
78 |
done |
76 |
# includes |
79 |
# includes |
77 |
for file in `ls /usr/include/${new}/`; do |
80 |
for file in `ls /usr/include/${new}/`; do |
78 |
files="${files} /usr/include/${file}" |
81 |
files="${files} /usr/include/${file}" |
79 |
rm -f /usr/include/${file} |
82 |
rm -f /usr/include/${file} |
|
|
83 |
retval=$((retval | $? )) |
80 |
ln -s /usr/include/${new}/${file} /usr/include/${file} |
84 |
ln -s /usr/include/${new}/${file} /usr/include/${file} |
|
|
85 |
retval=$((retval | $? )) |
81 |
done |
86 |
done |
82 |
# binaries |
87 |
# binaries |
83 |
for file in `ls /usr/lib/${new} | grep -v lib`; do |
88 |
for file in `ls /usr/lib/${new} | grep -v lib`; do |
84 |
files="${files} /usr/bin/${file}" |
89 |
files="${files} /usr/bin/${file}" |
85 |
rm -f /usr/bin/${file} |
90 |
rm -f /usr/bin/${file} |
|
|
91 |
retval=$((retval | $? )) |
86 |
ln -s /usr/lib/${new}/${file} /usr/bin/${file} |
92 |
ln -s /usr/lib/${new}/${file} /usr/bin/${file} |
|
|
93 |
retval=$((retval | $? )) |
87 |
done |
94 |
done |
88 |
# man pages |
95 |
# man pages |
89 |
for file in `find /usr/share/man -regex ".*-${new}\..x?.gz"`; do |
96 |
for file in `find /usr/share/man -regex ".*-${new}\..x?.gz"`; do |
90 |
files="${files} ${file/-${new}/}" |
97 |
files="${files} ${file/-${new}/}" |
91 |
rm -f ${file/-${new}/} |
98 |
rm -f ${file/-${new}/} |
|
|
99 |
retval=$((retval | $? )) |
92 |
ln -s ${file} ${file/-${new}/} |
100 |
ln -s ${file} ${file/-${new}/} |
|
|
101 |
retval=$((retval | $? )) |
93 |
done |
102 |
done |
94 |
|
103 |
|
95 |
cat ${PROFILE_PATH}/${new} > ${CONFIG_FILE} |
104 |
cat ${PROFILE_PATH}/${new} > ${CONFIG_FILE} |
|
|
105 |
retval=$((retval | $? )) |
96 |
echo "FILES='${files}'" >> ${CONFIG_FILE} |
106 |
echo "FILES='${files}'" >> ${CONFIG_FILE} |
|
|
107 |
retval=$((retval | $? )) |
97 |
|
108 |
|
|
|
109 |
test $retval -eq 0 |
98 |
return $? |
110 |
return $? |
99 |
} |
111 |
} |
100 |
|
112 |
|
101 |
_deactivate_profile() { |
113 |
_deactivate_profile() { |
102 |
_check_root |
114 |
_check_root |
|
|
115 |
local retval=0 |
103 |
|
116 |
|
104 |
source ${CONFIG_FILE} 2>/dev/null |
117 |
source ${CONFIG_FILE} 2>/dev/null |
105 |
current=${PROFILE} |
118 |
current=${PROFILE} |
Lines 110-151
Link Here
|
110 |
|
123 |
|
111 |
for file in ${FILES}; do |
124 |
for file in ${FILES}; do |
112 |
rm -f ${file} |
125 |
rm -f ${file} |
|
|
126 |
retval=$((retval | $? )) |
113 |
done |
127 |
done |
114 |
|
128 |
|
115 |
rm -f ${CONFIG_FILE} |
129 |
rm -f ${CONFIG_FILE} |
|
|
130 |
retval=$((retval | $? )) |
116 |
|
131 |
|
|
|
132 |
test $retval -eq 0 |
117 |
return $? |
133 |
return $? |
118 |
} |
134 |
} |
119 |
|
135 |
|
120 |
switch_profile() { |
136 |
switch_profile() { |
121 |
_check_root |
137 |
_check_root |
|
|
138 |
local retval=0 |
122 |
|
139 |
|
123 |
if [ -n "$1" ]; then |
140 |
if [ -n "$1" ]; then |
124 |
if [ ! -e ${PROFILE_PATH}/${1} ]; then |
141 |
if [ ! -e ${PROFILE_PATH}/${1} ]; then |
125 |
eerror "$0: no such profile ${1}" |
142 |
eerror "$0: no such profile ${1}" |
|
|
143 |
retval=1 |
126 |
else |
144 |
else |
127 |
_deactivate_profile |
145 |
_deactivate_profile |
|
|
146 |
retval=$((retval | $? )) |
128 |
_activate_profile $1 |
147 |
_activate_profile $1 |
|
|
148 |
retval=$((retval | $? )) |
129 |
fi |
149 |
fi |
130 |
else |
150 |
else |
131 |
source ${CONFIG_FILE} 2> /dev/null |
151 |
source ${CONFIG_FILE} 2> /dev/null |
132 |
_deactivate_profile |
152 |
_deactivate_profile |
|
|
153 |
retval=$((retval | $? )) |
133 |
if [ -z "${PROFILE}" -o ! -f ${PROFILE_PATH}/${PROFILE} ]; then |
154 |
if [ -z "${PROFILE}" -o ! -f ${PROFILE_PATH}/${PROFILE} ]; then |
134 |
for y in `ls ${PROFILE_PATH} | grep -v removed | grep -v current | sort -r`; do |
155 |
for y in `ls ${PROFILE_PATH} | grep -v removed | grep -v current | sort -r`; do |
135 |
_activate_profile ${y} |
156 |
_activate_profile ${y} |
|
|
157 |
retval=$((retval | $? )) |
136 |
break |
158 |
break |
137 |
done |
159 |
done |
138 |
if [ -z "${y}" ]; then |
160 |
if [ -z "${y}" ]; then |
139 |
eerror "$0: no profile to activate" |
161 |
eerror "$0: no profile to activate" |
|
|
162 |
retval=1 |
140 |
fi |
163 |
fi |
141 |
else |
164 |
else |
142 |
_activate_profile ${PROFILE} |
165 |
_activate_profile ${PROFILE} |
|
|
166 |
retval=$((retval | $? )) |
143 |
fi |
167 |
fi |
144 |
fi |
168 |
fi |
145 |
|
169 |
|
146 |
source ${CONFIG_FILE} 2>/dev/null |
170 |
source ${CONFIG_FILE} 2>/dev/null |
147 |
einfo "$0: New default Profile is: ${PROFILE}" |
171 |
einfo "$0: New default Profile is: ${PROFILE}" |
148 |
|
172 |
|
|
|
173 |
test $retval -eq 0 |
149 |
return $? |
174 |
return $? |
150 |
} |
175 |
} |
151 |
|
176 |
|