--- kdebase-3.5.10/startkde~ 2010-02-25 20:17:26.000000000 +0300 +++ kdebase-3.5.10/startkde 2010-03-16 18:00:01.000000000 +0300 @@ -3,6 +3,24 @@ # DEFAULT KDE STARTUP SCRIPT ( KDE-3.5.10 ) # +SourceIfNotEmpty() +{ + local f="$1" + shift + [ -s "$f" ] && . "$f" "$@" +} + +ExecIfExecutable() +{ + local f="$1" + shift + [ -x "$f" ] && "$f" "$@" +} + +Quote(){ echo "$@" |sed -e 's/[\&;()<>!|{}?*`"'\''[:space:]]/\\&/g' || return 1; } + +ReadConfig(){ eval echo $(Quote $($KDEDIR/bin/kreadconfig --file "$1" --group "$2" --key "$3" --default "$4")); } + # When the X server dies we get a HUP signal from xinit. We must ignore it # because we still need to do some cleanup. trap 'echo GOT SIGHUP' HUP @@ -10,7 +28,7 @@ trap 'echo GOT SIGHUP' HUP # Check if a KDE session already is running if kcheckrunning >/dev/null 2>&1; then echo "KDE seems to be already running on this display." - xmessage -geometry 500x100 "KDE seems to be already running on this display." > /dev/null 2>/dev/null + xmessage -center "KDE seems to be already running on this display." > /dev/null 2>/dev/null exit 1 fi @@ -18,20 +36,10 @@ fi # The standard X background is nasty, causing moire effects and exploding # people's heads. We use colours from the standard KDE palette for those with # palettised displays. +SourceIfNotEmpty /usr/share/design-current/config +[ -n "$BACKGROUND_COLOR" ] || BACKGROUND_COLOR="000000" if test -z "$XDM_MANAGED" || echo "$XDM_MANAGED" | grep ",auto" > /dev/null; then - xsetroot -solid "#000000" -fi - -# we have to unset this for Darwin since it will screw up KDE's dynamic-loading -unset DYLD_FORCE_FLAT_NAMESPACE - -# in case we have been started with full pathname spec without being in PATH -bindir=`echo "$0" | sed -n 's,^\(/.*\)/[^/][^/]*$,\1,p'` -if [ -n "$bindir" ]; then - case $PATH in - $bindir|$bindir:*|*:$bindir|*:$bindir:*) ;; - *) PATH=$bindir:$PATH; export PATH;; - esac + xsetroot -solid "#$BACKGROUND_COLOR" fi # Boot sequence: @@ -48,17 +56,29 @@ fi # # * Then ksmserver is started which takes control of the rest of the startup sequence +#[ -n "$XDG_CONFIG_DIRS" ] || export XDG_CONFIG_DIRS=/etc/xdg +[ -n "$XDG_DATA_DIRS" ] || export XDG_DATA_DIRS=/usr/share:/var/cache + # The user's personal KDE directory is usually ~/.kde, but this setting # may be overridden by setting KDEHOME. -kdehome=$HOME/.kde +[ -z "$KDEDIR" ] && KDEDIR=/usr +export KDEDIR + +kdehome="$HOME"/.kde test -n "$KDEHOME" && kdehome=`echo "$KDEHOME"|sed "s,^~/,$HOME/,"` +export KDEROOTHOME="/root" + +KDELANG=`echo $LANG|sed "s/_.*//"` +[ -z "$KDE_ALT_DATA" ] && KDE_ALT_DATA=/usr/share/kde +DESK_SKEL=$KDEDIR/share/apps/kdesktop/DesktopLinks +CONF_SKEL=$KDE_ALT_DATA/userconfig # see kstartupconfig source for usage -mkdir -m 700 -p $kdehome -mkdir -m 700 -p $kdehome/share -mkdir -m 700 -p $kdehome/share/config -cat >$kdehome/share/config/startupconfigkeys <"$kdehome/share/config/startupconfigkeys" <"$HOME"/.smb/smb.conf + if [ "$KDELANG" == "ru" -o "$KDELANG" == "uk" -o "$KDELANG" == "be" ] + then + cat >"$HOME"/.smb/smb.conf <<__EOF__ +# added by startkde +[global] +dos charset = CP866 +__EOF__ + fi +fi + +if ! [ -x $KDEDIR/bin/kreadconfig ] +then + xmessage -center "Could not execute $KDEDIR/bin/kreadconfig. Check installation of kdebase package." + exit 1 +fi + +HOME_DESKTOP=`ReadConfig kdeglobals Paths Desktop "$HOME/Desktop"` + +if [ ! -d "$kdehome" -a -d $CONF_SKEL/.kde ]; then + ( cd $CONF_SKEL/.kde && tar cpf - .kde ) | ( cd "$kdehome" && tar xpf - ) +fi + +if [ ! -e "$kdehome"/share/config/emaildefaults ]; then + $KDEDIR/bin/mailsettings >"$kdehome"/share/config/emaildefaults +fi + +if [ ! -e "$kdehome"/share/config/kmailrc ]; then + cat >"$kdehome"/share/config/kmailrc <<__EOF__ +[General] +transports=1 +[Transport 1] +host=/usr/sbin/sendmail +name=Sendmail +type=sendmail +__EOF__ +fi + +if [ ! -f "$HOME"/.kderc -a -e $CONF_SKEL/.kderc ]; then + cp $CONF_SKEL/.kderc "$HOME" + chmod 0600 "$HOME"/.kderc +fi + +HOME_AUTOSTART=`ReadConfig kdeglobals Paths Autostart "$kdehome/Autostart"` +mkdir -p "$HOME_AUTOSTART" + +if [ ! -d "$kdehome/share/apps/konqueror" ] ; then + mkdir -p "$kdehome/share/apps/konqueror/" + # Install bookmarks + for bookmarksfile in \ + "/etc/kde/distribution/share/kde/bookmarks-$KDELANG.xml" \ + "/etc/kde/distribution/share/kde/bookmarks.xml" \ + "$KDE_ALT_DATA/bookmarks-$KDELANG.xml" \ + "$KDE_ALT_DATA/bookmarks.xml" + do + if [ -f "$bookmarksfile" ]; then + cp "$bookmarksfile" "$kdehome/share/apps/konqueror/bookmarks.xml" + break + fi + done +fi + +usr_fdir="$HOME"/.fonts # Get Ghostscript to look into user's KDE fonts dir for additional Fontmap if test -n "$GS_LIB" ; then GS_LIB=$usr_fdir:$GS_LIB @@ -275,7 +297,7 @@ fi for resource in tmp cache socket; do if ! lnusertemp $resource >/dev/null; then echo 'startkde: Call to lnusertemp failed (temporary directories full?). Check your installation.' 1>&2 - xmessage -geometry 600x100 "Call to lnusertemp failed (temporary directories full?). Check your installation." + xmessage -center "Call to lnusertemp failed (temporary directories full?). Check your installation." exit 1 fi done @@ -286,7 +308,7 @@ dcopserver_shutdown echo 'startkde: Starting up...' 1>&2 # run KPersonalizer before the session, if this is the first login -if test "$kpersonalizerrc_general_firstlogin" = "true"; then +if false ; then # start only dcopserver, don't start whole kdeinit (takes too long) echo 'startkde: Running kpersonalizer...' 1>&2 dcopserver @@ -346,7 +368,7 @@ LD_BIND_NOW=true start_kdeinit_wrapper - if test $? -ne 0; then # Startup error echo 'startkde: Could not start kdeinit. Check your installation.' 1>&2 - xmessage -geometry 500x100 "Could not start kdeinit. Check your installation." + xmessage -center "Could not start kdeinit. Check your installation." fi # If the session should be locked from the start (locked autologin), @@ -373,12 +395,12 @@ kwrapper ksmserver $KDEWM if test $? -eq 255; then # Startup error echo 'startkde: Could not start ksmserver. Check your installation.' 1>&2 - xmessage -geometry 500x100 "Could not start ksmserver. Check your installation." + xmessage -center "Could not start ksmserver. Check your installation." fi # wait if there's any crashhandler shown while dcop | grep -q ^drkonqi- ; do - sleep 5 + sleep 3 done echo 'startkde: Shutting down...' 1>&2 @@ -388,7 +410,8 @@ kdeinit_shutdown dcopserver_shutdown --wait artsshell -q terminate # KDE4 support -kde4 kdeinit4_shutdown 2>/dev/null +KDE4WRAPPER=`which kde4 2>/dev/null` +[ -z "$KDE4WRAPPER" ] || $KDE4WRAPPER kdeinit4_shutdown 2>/dev/null echo 'startkde: Running shutdown scripts...' 1>&2