summaryrefslogtreecommitdiff
blob: 36829fd17f4c4d6630148927a05684e51642d424 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- startkde.cmake.old	2011-03-24 13:07:04.919889148 +0100
+++ startkde.cmake	2011-03-24 13:14:42.033174445 +0100
@@ -13,6 +13,40 @@
 # because we still need to do some cleanup.
 trap 'echo GOT SIGHUP' HUP
 
+_KDEDIR=@GENTOO_PORTAGE_EPREFIX@@REPLACE_PREFIX@
+if [ "$_KDEDIR" != "@GENTOO_PORTAGE_EPREFIX@/usr" ]; then
+	export PATH=${_KDEDIR}/bin:$(echo ${PATH} | sed 's/$/:/g;s#@GENTOO_PORTAGE_EPREFIX@/usr/kde/[^/]*/s\?bin/\?:##g;s/:$//g')
+	export ROOTPATH=${_KDEDIR}/sbin:${_KDEDIR}/bin:$(echo ${PATH} | sed 's/$/:/g;s#@GENTOO_PORTAGE_EPREFIX@/usr/kde/[^/]*/s\?bin/\?:##g;s/:$//g')
+fi
+@REPLACE_LDPATH@
+export STRIGI_PLUGIN_PATH="${_KDEDIR}/@REPLACE_LIBDIR@/strigi:${STRIGI_PLUGIN_PATH}"
+xdgs=$(echo ${XDG_DATA_DIRS} | sed 's/$/:/g;s#@GENTOO_PORTAGE_EPREFIX@/usr/kde/[^/]*/share/\?:##g;s/:$//g')
+if [ $(echo $xdgs |grep -c -E "(:|^)${_KDEDIR}/share(:|$)") -eq 0 ]; then
+	xdgs="${_KDEDIR}/share:${xdgs}"
+fi
+export XDG_DATA_DIRS=${xdgs}
+unset xdgs
+
+if [ -z "$HOME" ]; then
+	xmessage "HOME is unset. Your user config seems to be broken. Aborting."
+	exit 1
+fi
+
+# Gentoo: handle the possible home directory layout for config directory
+# Note that we change the default KDEHOME in kdelibs to .kde4 or .kde${SLOT}
+# for -kdeprefix and +kdeprefix respectively.
+if [ "${_KDEDIR}" = "@GENTOO_PORTAGE_EPREFIX@/usr" ]; then
+	# If the directory doesn't exist make it
+	[ -e "${HOME}/.kde4" ] || mkdir "$HOME/.kde4"
+else
+	# Use multiple directories based upon the KDE directory
+	[ -e "$HOME/.kde$(basename $_KDEDIR)" ] || mkdir "$HOME/.kde$(basename $_KDEDIR)"
+	if [ ! -d "$HOME/.kde$(basename $_KDEDIR)" ]; then
+		xmessage "$HOME/.kde$(basename $_KDEDIR) exists but is not a dir. Aborting."
+		exit 1
+	fi
+fi
+
 # Check if a KDE session already is running and whether it's possible to connect to X
 kcheckrunning
 kcheckrunning_result=$?
@@ -187,6 +221,13 @@
   done
 done
 
+# Gentoo part for FHS installs
+if [ "${_KDEDIR}" = "@GENTOO_PORTAGE_EPREFIX@/usr" ]; then
+  for file in "@GENTOO_PORTAGE_EPREFIX@/etc/kde/startup/"*.sh; do
+    test -r "${file}" && . "${file}"
+  done
+fi
+
 # Set the path for Qt plugins provided by KDE
 if test -n "$QT_PLUGIN_PATH"; then
   QT_PLUGIN_PATH="$QT_PLUGIN_PATH:`kde4-config --path qtplugins`"
@@ -400,6 +441,13 @@
   done
 done
 
+# Gentoo part for FHS installs
+if [ "${_KDEDIR}" = "@GENTOO_PORTAGE_EPREFIX@/usr" ]; then
+  for file in "@GENTOO_PORTAGE_EPREFIX@/etc/kde/shutdown/"*.sh; do
+    test -r "${file}" && . "${file}"
+  done
+fi
+
 unset KDE_FULL_SESSION
 xprop -root -remove KDE_FULL_SESSION
 unset KDE_SESSION_VERSION