|
Lines 15-20
Link Here
|
| 15 |
source $HOME/.xprofile |
15 |
source $HOME/.xprofile |
| 16 |
fi |
16 |
fi |
| 17 |
|
17 |
|
|
|
18 |
# Some functions to parse and check path correctly ... |
| 19 |
is_in_path() { |
| 20 |
search="$1"; ifs="$IFS"; IFS=":"; set $PATH; IFS="$ifs" |
| 21 |
for i in $*; do |
| 22 |
[ "${i}" = "${search}" ] && return 0 |
| 23 |
done |
| 24 |
return 1 |
| 25 |
} |
| 26 |
|
| 27 |
# Usage: place_before_in_path /opt/trinity/games /usr/games |
| 28 |
place_before_in_path() { |
| 29 |
insert="$1"; before="$2"; ifs="$IFS"; IFS=":"; set $PATH; IFS="$ifs" |
| 30 |
NPATH="" |
| 31 |
for i in $*; do |
| 32 |
[ "${i}" = "${before}" ] && NPATH="${NPATH}:${insert}" |
| 33 |
NPATH="${NPATH}:${i}" |
| 34 |
done |
| 35 |
export PATH=${NPATH} |
| 36 |
} |
| 37 |
|
| 18 |
echo "[startkde] Starting startkde." 1>&2 |
38 |
echo "[startkde] Starting startkde." 1>&2 |
| 19 |
echo "[startkde] This script is $0" 1>&2 |
39 |
echo "[startkde] This script is $0" 1>&2 |
| 20 |
|
40 |
|
|
Lines 29-35
Link Here
|
| 29 |
# Do not use kde-config to determine the version. That command creates a |
49 |
# Do not use kde-config to determine the version. That command creates a |
| 30 |
# profile directory in the root of the file system. Refer to Bug Report 293. |
50 |
# profile directory in the root of the file system. Refer to Bug Report 293. |
| 31 |
if [ -x $BIN_DIR/konqueror ]; then |
51 |
if [ -x $BIN_DIR/konqueror ]; then |
| 32 |
KDE_VERSION="`$BIN_DIR/konqueror --version | grep KDE | awk '{print $2}'`" |
52 |
KDE_VERSION=$($BIN_DIR/konqueror --version | while IFS=: read a b; do [[ "$a" =~ "KDE" ]] && echo $b; done) |
| 33 |
echo "[startkde] TDE version is $KDE_VERSION" 1>&2 |
53 |
echo "[startkde] TDE version is $KDE_VERSION" 1>&2 |
| 34 |
export KDEDIR=${BIN_DIR%/bin} |
54 |
export KDEDIR=${BIN_DIR%/bin} |
| 35 |
echo "[startkde] TDE base directory is $KDEDIR" 1>&2 |
55 |
echo "[startkde] TDE base directory is $KDEDIR" 1>&2 |
|
Lines 105-131
Link Here
|
| 105 |
# This script and kstandardirs.h and kstandardirs.cpp must match. |
125 |
# This script and kstandardirs.h and kstandardirs.cpp must match. |
| 106 |
# The latter two must be edited/patched before compiling. |
126 |
# The latter two must be edited/patched before compiling. |
| 107 |
echo "[startkde] KDEHOME is not set." 1>&2 |
127 |
echo "[startkde] KDEHOME is not set." 1>&2 |
| 108 |
if [ -d $HOME/.trinity ]; then |
128 |
# Default value: $HOME/.trinity. Most users will use this. |
| 109 |
# OK, this one is obvious. |
129 |
export KDEHOME=$HOME/.trinity |
| 110 |
export KDEHOME=$HOME/.trinity |
130 |
|
| 111 |
elif [ -f /usr/bin/kde4-config ]; then |
131 |
if [ ! -d $HOME/.trinity ] && [ ! -f /usr/bin/kde4-config ] && [ -f /usr/bin/kde-config ] && [ -d $HOME/.kde ]; then |
| 112 |
# Looks like KDE4 is installed. |
|
|
| 113 |
if [ -d $HOME/.kde ] && [ ! -d $HOME/.trinity ]; then |
| 114 |
# Presume $HOME/.kde is being used for KDE4 as it already exists. |
| 115 |
export KDEHOME=$HOME/.trinity |
| 116 |
else |
| 117 |
# Presume $HOME/.kde is being used for KDE4 to be on the safe side. |
| 118 |
export KDEHOME=$HOME/.trinity |
| 119 |
fi |
| 120 |
elif [ -f /opt/trinity/bin/kde-config ]; then |
| 121 |
# Looks like Trinity is installed. |
| 122 |
export KDEHOME=$HOME/.trinity |
| 123 |
elif [ -f /usr/bin/kde-config ] && [ -d $HOME/.kde ]; then |
| 124 |
# Looks like Trinity is installed and not playing second fiddle to KDE4. |
132 |
# Looks like Trinity is installed and not playing second fiddle to KDE4. |
| 125 |
export KDEHOME=$HOME/.kde |
133 |
export KDEHOME=$HOME/.kde |
| 126 |
else |
|
|
| 127 |
# Resort to this and hope for the best! |
| 128 |
export KDEHOME=$HOME/.trinity |
| 129 |
fi |
134 |
fi |
| 130 |
echo "[startkde] Set KDEHOME to $KDEHOME." 1>&2 |
135 |
echo "[startkde] Set KDEHOME to $KDEHOME." 1>&2 |
| 131 |
fi |
136 |
fi |
|
Lines 149-178
Link Here
|
| 149 |
|
154 |
|
| 150 |
# Modify the following environment variables only as necessary. |
155 |
# Modify the following environment variables only as necessary. |
| 151 |
if [ -d $KDEDIR/games ]; then |
156 |
if [ -d $KDEDIR/games ]; then |
| 152 |
if [ "`echo $PATH | grep \"$KDEDIR/games\"`" = "" ]; then |
157 |
if ! is_in_path "$KDEDIR/games" ; then |
| 153 |
# Respect the traditional path order. Don't blindly place $KDEDIR/games |
158 |
# Respect the traditional path order. Don't blindly place $KDEDIR/games |
| 154 |
# first in the path. Only place $KDEDIR/games before /usr/games. If packagers |
159 |
# first in the path. Only place $KDEDIR/games before /usr/games. If packagers |
| 155 |
# are adding $KDEDIR/games elsewhere, then they need to ensure the traditional |
160 |
# are adding $KDEDIR/games elsewhere, then they need to ensure the traditional |
| 156 |
# search patch is respected. |
161 |
# search patch is respected. |
| 157 |
# Is there a way we can check that $KDEDIR/games is always placed only just before |
162 |
# Is there a way we can check that $KDEDIR/games is always placed only just before |
| 158 |
# /usr/games in the search path? |
163 |
# /usr/games in the search path? |
| 159 |
if [ "`echo $PATH | grep \"^\\(.*:\\)\\?/usr/games\\(:.*\\)\\?$\"`" != "" ]; then |
164 |
if is_in_path "/usr/games"; then |
| 160 |
export PATH="`echo $PATH | sed \"s|^\\(.*:\\)\\?/usr/games\\(:.*\\)\\?$|\\1$KDEDIR/games:/usr/games\\2|\"`" |
165 |
place_before_in_path "$KDEDIR/games" "/usr/games" |
| 161 |
else |
166 |
else |
| 162 |
export PATH=$KDEDIR/games:$PATH |
167 |
export PATH=$KDEDIR/games:$PATH |
| 163 |
fi |
168 |
fi |
| 164 |
fi |
169 |
fi |
| 165 |
fi |
170 |
fi |
| 166 |
if [ -d $KDEDIR/bin ]; then |
171 |
if [ -d $KDEDIR/bin ]; then |
| 167 |
if [ "`echo $PATH | grep \"$KDEDIR/bin\"`" = "" ]; then |
172 |
if ! is_in_path "$KDEDIR/bin" ]; then |
| 168 |
# Respect the traditional path order. Don't blindly place $KDEDIR/bin |
173 |
# Respect the traditional path order. Don't blindly place $KDEDIR/bin |
| 169 |
# first in the path. Only place $KDEDIR/bin before /usr/bin. This order is |
174 |
# first in the path. Only place $KDEDIR/bin before /usr/bin. This order is |
| 170 |
# consistent with kdelibs/kdesu/stub.cpp. If packagers are adding $KDEDIR/bin |
175 |
# consistent with kdelibs/kdesu/stub.cpp. If packagers are adding $KDEDIR/bin |
| 171 |
# elsewhere, then they need to ensure the traditional search patch is respected. |
176 |
# elsewhere, then they need to ensure the traditional search patch is respected. |
| 172 |
# Is there a way we can check that $KDEDIR/bin is always placed only just before |
177 |
# Is there a way we can check that $KDEDIR/bin is always placed only just before |
| 173 |
# /usr/bin in the search path? |
178 |
# /usr/bin in the search path? |
| 174 |
if [ "`echo $PATH | grep \"^\\(.*:\\)\\?/usr/bin\\(:.*\\)\\?$\"`" != "" ]; then |
179 |
if is_in_path "/usr/bin"; then |
| 175 |
export PATH="`echo $PATH | sed \"s|^\\(.*:\\)\\?/usr/bin\\(:.*\\)\\?$|\\1$KDEDIR/bin:/usr/bin\\2|\"`" |
180 |
place_before_in_path "$KDEDIR/bin" "/usr/bin" |
| 176 |
else |
181 |
else |
| 177 |
export PATH=$KDEDIR/bin:$PATH |
182 |
export PATH=$KDEDIR/bin:$PATH |
| 178 |
fi |
183 |
fi |