|
Lines 16-38
Link Here
|
| 16 |
fi |
16 |
fi |
| 17 |
|
17 |
|
| 18 |
# Some functions to parse and check path correctly ... |
18 |
# Some functions to parse and check path correctly ... |
|
|
19 |
# Usage: is_in_path PATH /usr/bin |
| 19 |
is_in_path() { |
20 |
is_in_path() { |
| 20 |
search="$1"; ifs="$IFS"; IFS=":"; set $PATH; IFS="$ifs" |
21 |
var="$1"; search="$2"; ifs="$IFS"; IFS=":"; eval set \$$var; IFS="$ifs" |
| 21 |
for i in $*; do |
22 |
for i in $*; do |
| 22 |
[ "${i}" = "${search}" ] && return 0 |
23 |
[ "${i}" = "${search}" ] && return 0 |
| 23 |
done |
24 |
done |
| 24 |
return 1 |
25 |
return 1 |
| 25 |
} |
26 |
} |
| 26 |
|
27 |
|
| 27 |
# Usage: place_before_in_path /opt/trinity/games /usr/games |
28 |
# Usage: place_before_in_path PATH /opt/trinity/games /usr/games |
| 28 |
place_before_in_path() { |
29 |
place_before_in_path() { |
| 29 |
insert="$1"; before="$2"; ifs="$IFS"; IFS=":"; set $PATH; IFS="$ifs" |
30 |
var="$1"; insert="$2"; before="$3"; ifs="$IFS"; IFS=":"; eval set \$$var; IFS="$ifs" |
| 30 |
NPATH="" |
31 |
NPATH="" |
| 31 |
for i in $*; do |
32 |
for i in $*; do |
| 32 |
[ "${i}" = "${before}" ] && NPATH="${NPATH}:${insert}" |
33 |
[ "${i}" = "${before}" ] && NPATH="${NPATH}:${insert}" |
| 33 |
NPATH="${NPATH}:${i}" |
34 |
NPATH="${NPATH}:${i}" |
| 34 |
done |
35 |
done |
| 35 |
export PATH=${NPATH#:} |
36 |
eval export $var=${NPATH#:} |
|
|
37 |
} |
| 38 |
|
| 39 |
# Usage: remove_from_path PATH /opt/trinity/games |
| 40 |
remove_from_path() { |
| 41 |
var="$1"; remove="$2"; ifs="$IFS"; IFS=":"; eval set \$$var; IFS="$ifs" |
| 42 |
NPATH="" |
| 43 |
for i in $*; do |
| 44 |
[ "${i}" != "${remove}" ] && NPATH="${NPATH}:${i}" |
| 45 |
done |
| 46 |
eval export $var=${NPATH#:} |
| 36 |
} |
47 |
} |
| 37 |
|
48 |
|
| 38 |
echo "[startkde] Starting startkde." 1>&2 |
49 |
echo "[startkde] Starting startkde." 1>&2 |
|
Lines 154-183
Link Here
|
| 154 |
|
165 |
|
| 155 |
# Modify the following environment variables only as necessary. |
166 |
# Modify the following environment variables only as necessary. |
| 156 |
if [ -d $KDEDIR/games ]; then |
167 |
if [ -d $KDEDIR/games ]; then |
| 157 |
if ! is_in_path "$KDEDIR/games" ; then |
168 |
if ! is_in_path PATH "$KDEDIR/games" ; then |
| 158 |
# Respect the traditional path order. Don't blindly place $KDEDIR/games |
169 |
# Respect the traditional path order. Don't blindly place $KDEDIR/games |
| 159 |
# first in the path. Only place $KDEDIR/games before /usr/games. If packagers |
170 |
# first in the path. Only place $KDEDIR/games before /usr/games. If packagers |
| 160 |
# are adding $KDEDIR/games elsewhere, then they need to ensure the traditional |
171 |
# are adding $KDEDIR/games elsewhere, then they need to ensure the traditional |
| 161 |
# search patch is respected. |
172 |
# search patch is respected. |
| 162 |
# Is there a way we can check that $KDEDIR/games is always placed only just before |
173 |
# Is there a way we can check that $KDEDIR/games is always placed only just before |
| 163 |
# /usr/games in the search path? |
174 |
# /usr/games in the search path? |
| 164 |
if is_in_path "/usr/games"; then |
175 |
if is_in_path PATH "/usr/games"; then |
| 165 |
place_before_in_path "$KDEDIR/games" "/usr/games" |
176 |
place_before_in_path PATH "$KDEDIR/games" "/usr/games" |
| 166 |
else |
177 |
else |
| 167 |
export PATH=$KDEDIR/games:$PATH |
178 |
export PATH=$KDEDIR/games:$PATH |
| 168 |
fi |
179 |
fi |
| 169 |
fi |
180 |
fi |
| 170 |
fi |
181 |
fi |
| 171 |
if [ -d $KDEDIR/bin ]; then |
182 |
if [ -d $KDEDIR/bin ]; then |
| 172 |
if ! is_in_path "$KDEDIR/bin" ]; then |
183 |
if ! is_in_path PATH "$KDEDIR/bin" ]; then |
| 173 |
# Respect the traditional path order. Don't blindly place $KDEDIR/bin |
184 |
# Respect the traditional path order. Don't blindly place $KDEDIR/bin |
| 174 |
# first in the path. Only place $KDEDIR/bin before /usr/bin. This order is |
185 |
# first in the path. Only place $KDEDIR/bin before /usr/bin. This order is |
| 175 |
# consistent with kdelibs/kdesu/stub.cpp. If packagers are adding $KDEDIR/bin |
186 |
# consistent with kdelibs/kdesu/stub.cpp. If packagers are adding $KDEDIR/bin |
| 176 |
# elsewhere, then they need to ensure the traditional search patch is respected. |
187 |
# elsewhere, then they need to ensure the traditional search patch is respected. |
| 177 |
# Is there a way we can check that $KDEDIR/bin is always placed only just before |
188 |
# Is there a way we can check that $KDEDIR/bin is always placed only just before |
| 178 |
# /usr/bin in the search path? |
189 |
# /usr/bin in the search path? |
| 179 |
if is_in_path "/usr/bin"; then |
190 |
if is_in_path PATH "/usr/bin"; then |
| 180 |
place_before_in_path "$KDEDIR/bin" "/usr/bin" |
191 |
place_before_in_path PATH "$KDEDIR/bin" "/usr/bin" |
| 181 |
else |
192 |
else |
| 182 |
export PATH=$KDEDIR/bin:$PATH |
193 |
export PATH=$KDEDIR/bin:$PATH |
| 183 |
fi |
194 |
fi |
|
Lines 240-270
Link Here
|
| 240 |
# set in $KDEDIRS are intended to override data files found in $KDEDIR. Those additional |
251 |
# set in $KDEDIRS are intended to override data files found in $KDEDIR. Those additional |
| 241 |
# directories should be placed before $KDEDIR and before /usr/share. |
252 |
# directories should be placed before $KDEDIR and before /usr/share. |
| 242 |
if [ "$KDEDIR" != "/usr" ] && [ -d $KDEDIR/share ]; then |
253 |
if [ "$KDEDIR" != "/usr" ] && [ -d $KDEDIR/share ]; then |
| 243 |
if [ "$XDG_DATA_DIRS" = "" ]; then |
254 |
# Ensure the standard location of /usr/share is included at the last position. |
| 244 |
# Ensure the standard location of /usr/share is included. |
255 |
if ! is_in_path XDG_DATA_DIRS "/usr/share"; then |
| 245 |
XDG_DATA_DIRS=/usr/share |
256 |
XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share |
| 246 |
else |
|
|
| 247 |
if [ "`echo $XDG_DATA_DIRS | grep \"/usr/share\"`" = "" ]; then |
| 248 |
XDG_DATA_DIRS=$XDG_DATA_DIRS:/usr/share |
| 249 |
fi |
| 250 |
fi |
| 251 |
if [ "`echo $XDG_DATA_DIRS | grep \"$KDEDIR/share\"`" = "" ]; then |
| 252 |
XDG_DATA_DIRS=$KDEDIR/share:$XDG_DATA_DIRS |
| 253 |
fi |
257 |
fi |
|
|
258 |
|
| 259 |
# Ensure that $KDEDIR/share is always first in XDG_DATA_DIRS |
| 260 |
remove_from_path XDG_DATA_DIRS $KDEDIR/share |
| 261 |
XDG_DATA_DIRS=$KDEDIR/share:$XDG_DATA_DIRS |
| 262 |
|
| 263 |
# Adds supplementary directories from KDEDIRS, if any, before KDEDIR. |
| 254 |
if [ "$KDEDIRS" != "" ]; then |
264 |
if [ "$KDEDIRS" != "" ]; then |
| 255 |
for i in `seq \`echo $KDEDIRS | awk -F : '{print NF}'\` -1 1`; do |
265 |
ifs="$IFS"; IFS=":"; set $KDEDIRS; ifs="$IFS" |
| 256 |
if [ "`echo $XDG_DATA_DIRS | grep \"\`echo $KDEDIRS | cut -d: -f${i}\`\"`" = "" ]; then |
266 |
for dir in $*; do |
| 257 |
XDG_DATA_DIRS=`echo $KDEDIRS | cut -d: -f${i}`/share:$XDG_DATA_DIRS |
267 |
if ! is_in_path XDG_DATA_DIRS $dir && [ -d "$dir/share" ]; then |
|
|
268 |
XDG_DATA_DIRS=$dir/share:$XDG_DATA_DIRS |
| 258 |
fi |
269 |
fi |
| 259 |
done |
270 |
done |
| 260 |
fi |
271 |
fi |
| 261 |
export XDG_DATA_DIRS |
272 |
export XDG_DATA_DIRS |
| 262 |
fi |
273 |
fi |
| 263 |
|
274 |
|
|
|
275 |
echo "[startkde] XDG_DATA_DIRS: $XDG_DATA_DIRS" 1>&2 |
| 276 |
|
| 264 |
test -n "$KDEHOME" && kdehome=`echo "$KDEHOME" | sed "s,^~/,$HOME/,"` |
277 |
test -n "$KDEHOME" && kdehome=`echo "$KDEHOME" | sed "s,^~/,$HOME/,"` |
| 265 |
|
278 |
|
| 266 |
# Allow interested applications, such as the Plasma control wrapper, |
279 |
# Allow interested applications, such as the Plasma control wrapper, |
| 267 |
# to know that this is a Trinity desktop and not a TDE one. |
280 |
# to know that this is a Trinity desktop and not a KDE one. |
| 268 |
export DESKTOP_SESSION=trinity |
281 |
export DESKTOP_SESSION=trinity |
| 269 |
|
282 |
|
| 270 |
# Please see kstartupconfig source for usage. |
283 |
# Please see kstartupconfig source for usage. |