Репозиторий ALT Linux backports/2.4
Последнее обновление: 9 июля 2008 | Пакетов: 497 | Посещений: 1633556
 поиск   регистрация   авторизация 
 
Группа :: Графические оболочки/KDE
Пакет: kdebase

 Главная   Изменения   Спек   Патчи   Загрузить   Bugs and FR 

Патч: kdebase-3.3-startkde.patch


--- kdebase-3.3/startkde.orig	2004-09-30 13:50:33 +0400
+++ kdebase-3.3/startkde	2004-09-30 18:38:39 +0400
@@ -22,18 +22,6 @@ if test -z "$XDM_MANAGED" || echo "$XDM_
   xsetroot -solid "#C0C0C0"
 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
-fi
-
 # Boot sequence:
 #
 # kdeinit is used to fork off processes which improves memory usage
@@ -51,115 +39,162 @@ fi
 #   2) everything in $KDEDIR/share/autostart (kdesktop, kicker, etc.)
 #   3) the rest of the session.
 
+xsetroot -cursor_name watch
+
+# Set lang and according locale
+#SourceIfNotEmpty /etc/profile.d/lang.sh
+
+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")); }
+
+FixBrowser()
+{
+    BROWSER="konqueror --profile webbrowsing"
+    HELP_BROWSER="konqueror --profile webbrowsing"
+}
+
 # The user's personal KDE directory is usually ~/.kde, but this setting
 # may be overridden by setting KDEHOME.
 
-kdehome=$HOME/.kde
-test -n "$KDEHOME" && kdehome=`echo "$KDEHOME"|sed "s,^~/,$HOME/,"`
+[ -z "$KDEDIR" ] && KDEDIR=/usr
+if [ -z "$KDEHOME" ]; then  KDEHOME=$HOME/.kde; else KDEHOME=`echo "$KDEHOME"|sed "s,^\~/,$HOME/,"`; fi
+if [ -n "$TMPDIR" ]; then KDETMP=$TMPDIR; else KDETMP=/tmp; fi
+
+# fix $BROWSER
+if [ -n "$BROWSER" ]; then
+    if [ "$BROWSER" == "/usr/bin/xbrowser" -a -L /usr/bin/xbrowser ]; then
+	[ "$(readlink `readlink /usr/bin/xbrowser`)" == "$KDEDIR""/bin/konqueror" ] && FixBrowser
+    else	
+	[ "$BROWSER" == "$KDEDIR""/bin/konqueror" ] && FixBrowser
+    fi
+fi
+
+export KDEDIR KDEHOME KDETMP BROWSER HELP_BROWSER
+
+KDELANG=`echo $LANG|sed "s/_.*//"`
+[ -z "$KDE_ALT_DATA" ] && KDE_ALT_DATA=/usr/share/alt/kde
+DESK_SKEL=$KDE_ALT_DATA/desktoplnk
+CONF_SKEL=$KDE_ALT_DATA/userconfig
+
+# Clean up old kde /tmp files that belong to the user
+real_display=`echo $DISPLAY | sed "s/://" | sed "s/\..*//"`
+dcop_srv_prefix=$HOME/.DCOPserver_`/bin/hostname`
+rm -f "$dcop_srv_prefix" \
+    "$dcop_srv_prefix"_:"$real_display" \
+    "$dcop_srv_prefix"__"$real_display"
 
-# Source scripts found in <localprefix>/env/*.sh and <prefixes>/env/*.sh
-# (where <localprefix> is $KDEHOME or ~/.kde, and <prefixes> is where KDE is installed)
-#
-# This is where you can define environment variables that will be available to
-# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
-# or eval `gpg-agent --daemon`.
-# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
-#
-# (see end of this file).
-# For anything else (that doesn't set env vars, or that needs a window manager),
-# better use the Autostart folder.
-
-exepath=`kde-config --path exe`
-
-for prefix in `echo "$exepath" | sed -e 's^/bin/^/env/^g;s^:^ ^g'`; do
-  for file in "$prefix"*.sh; do
-    test -r "$file" && . "$file"
-  done
+for i in /tmp/.ICE-unix/* /tmp/.ICE-unix/.[0-1,a-z,A-Z]* ; do
+    [ -O $i ] && rm -f $i
 done
 
-# Activate the kde font directories.
-#
-# There are 4 directories that may be used for supplying fonts for KDE.
-#
-# There are two system directories. These belong to the administrator.
-# There are two user directories, where the user may add her own fonts.
-#
-# The 'override' versions are for fonts that should come first in the list,
-# i.e. if you have a font in your 'override' directory, it will be used in
-# preference to any other.
-#
-# The preference order looks like this:
-# user override, system override, X, user, system
-#
-# Where X is the original font database that was set up before this script
-# runs.
+# check for space on /tmp /var/tmp and "$HOME" and for write access
+#  error exit, if not
+for d in /tmp /var/tmp "$HOME"
+do
+    if [ `LC_ALL=C df -m "$d"| tail -n 1 | xargs | cut -d" " -f4` -lt "25" -a "$d" != "/tmp" ]; then
+	xmessage -center "Not enough free disk space on $d"
+	exit 1
+    fi
+
+    testfile=`mktemp "$d"/KDE.startkde.XXXXXX`
+    if ! echo TEST_TEXT >$testfile 2>/dev/null ; then
+	xmessage -center "You don't have write permissions for $d"
+	exit 1
+    fi
+    rm -f $testfile
+done
 
-usr_odir=$HOME/.fonts/kde-override
-usr_fdir=$HOME/.fonts
+# create necessary directories/files
+if ! [ -e "$HOME"/.smb/smb.conf ]; then
+    mkdir -p "$HOME"/.smb
+    >"$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
 
-# Add any user-installed font directories to the X font path
-kde_fontpaths=$usr_fdir/fontpaths
-do_usr_fdir=1
-do_usr_odir=1
-if test -r "$kde_fontpaths" ; then
-    savifs=$IFS
-    IFS="
-"
-    for fpath in `grep -v '^[ 	]*#' < "$kde_fontpaths"` ; do
-        rfpath=`echo $fpath | sed "s:^~:$HOME:g"`
-        if test -s "$rfpath"/fonts.dir; then
-            xset fp+ "$rfpath"
-            if test "$rfpath" = "$usr_fdir"; then
-                do_usr_fdir=0
-            fi
-            if test "$rfpath" = "$usr_odir"; then
-                do_usr_odir=0
-            fi
-        fi
-    done
-    IFS=$savifs
+mkdir -p $KDEHOME/share/config
+
+if ! [ -x $KDEDIR/bin/kreadconfig ]
+then 
+    xmessage -center "Could not execute $KDEDIR/bin/kreadconfig. Check installation of kdebase package."
+    exit 1
 fi
 
-if test -n "$KDEDIRS"; then
-  kdedirs_first=`echo "$KDEDIRS"|sed -e 's/:.*//'`
-  sys_odir=$kdedirs_first/share/fonts/override
-  sys_fdir=$kdedirs_first/share/fonts
-else
-  sys_odir=$KDEDIR/share/fonts/override
-  sys_fdir=$KDEDIR/share/fonts
-fi
-
-# We run mkfontdir on the user's font dirs (if we have permission) to pick
-# up any new fonts they may have installed. If mkfontdir fails, we still
-# add the user's dirs to the font path, as they might simply have been made
-# read-only by the administrator, for whatever reason.
-
-# Only do usr_fdir and usr_odir if they are *not* listed in fontpaths
-test -d "$sys_odir" && xset +fp "$sys_odir"
-test $do_usr_odir -eq 1 && test -d "$usr_odir" && (mkfontdir "$usr_odir" ; xset +fp "$usr_odir")
-test $do_usr_fdir -eq 1 && test -d "$usr_fdir" && (mkfontdir "$usr_fdir" ; xset fp+ "$usr_fdir")
-test -d "$sys_fdir" && xset fp+ "$sys_fdir"
-
-# Ask X11 to rebuild its font list.
-xset fp rehash
-
-# Set a left cursor instead of the standard X11 "X" cursor, since I've heard
-# from some users that they're confused and don't know what to do. This is
-# especially necessary on slow machines, where starting KDE takes one or two
-# minutes until anything appears on the screen.
-#
-# If the user has overwritten fonts, the cursor font may be different now
-# so don't move this up.
-#
-xsetroot -cursor_name left_ptr
+HOME_DESKTOP=`ReadConfig kdeglobals Paths Desktop "$HOME/Desktop"`
 
-# 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
-    export GS_LIB
-else
-    GS_LIB=$usr_fdir
-    export GS_LIB
+if [ ! -d "$HOME_DESKTOP" -a -d "$DESK_SKEL" ]; then
+    mkdir -p $HOME_DESKTOP
+    ( cd $DESK_SKEL && tar cpf - * ) | ( cd $HOME_DESKTOP && tar xpf - )
+fi
+
+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 [ ! -e "$KDEHOME"/share/config/kcmlaptoprc -a -e /proc/apm ]; then
+    # Try to figure out if we're on a laptop
+    if ! /bin/cat /proc/apm |grep -q "?"; then
+    # We appear to be on a laptop with battery status notification
+    cat >"$KDEHOME"/share/config/kcmlaptoprc <<__EOF__
+[BatteryDefault]
+Enable=true
+__EOF__
+    fi
+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
+
+# Create directory for bookmarks and copy them
+if [ ! -d $KDEHOME/share/apps/konqueror ] ; then
+    mkdir -p $KDEHOME/share/apps/konqueror/
+    if [ -f "$KDE_ALT_DATA"/bookmarks-"$KDELANG".xml ]; then
+	cp "$KDE_ALT_DATA"/bookmarks-"$KDELANG".xml $KDEHOME/share/apps/konqueror/bookmarks.xml
+    else
+	cp "$KDE_ALT_DATA"/bookmarks.xml $KDEHOME/share/apps/konqueror/bookmarks.xml
+    fi
 fi
 
 # Link "tmp" resource to directory in /tmp
@@ -179,22 +214,6 @@ dcopserver_shutdown
 
 echo 'startkde: Starting up...'  1>&2
 
-# run KPersonalizer before the session, if this is the first login
-if kreadconfig --file kpersonalizerrc --group General --key FirstLogin --default true --type bool; then
-    # start only dcopserver, don't start whole kdeinit (takes too long)
-    echo 'startkde: Running kpersonalizer...'  1>&2
-    dcopserver
-    kwin --lock &
-    kpersonalizer --before-session
-    # handle kpersonalizer restarts (language change)
-    while test $? -eq 1; do
-        kpersonalizer --r --before-session
-    done
-    dcopserver_shutdown
-    # shutdown will also make kwin quit, give it time to do so
-    sleep 1
-fi
-
 # the splashscreen and progress indicator
 ksplash --nodcop
 
@@ -204,9 +223,17 @@ LD_BIND_NOW=true kdeinit +kcminit +knoti
 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
 
+# Scanning netscape plugins
+if [ "`ReadConfig kcmnspluginrc Misc startkdeScan false`" == "true" ]
+    then
+	[ -x $KDEDIR/bin/nspluginscan ] && $KDEDIR/bin/nspluginscan
+fi    
+
+xsetroot -cursor_name left_ptr
+
 # finally, give the session control to the session manager
 # if the KDEWM environment variable has been set, then it will be used as KDE's
 # window manager instead of kwin.
@@ -221,7 +248,7 @@ 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
 
 echo 'startkde: Shutting down...'  1>&2
@@ -234,10 +261,10 @@ artsshell -q terminate
 echo 'startkde: Running shutdown scripts...'  1>&2
 
 # Run scripts found in $KDEDIRS/shutdown
-for prefix in `echo "$exepath" | sed -e 's^/bin/^/shutdown/^g;s^:^ ^g'`; do
-  for file in `ls "$prefix" 2> /dev/null | egrep -v '(~|\.bak)$'`; do
-    test -x "$prefix$file" && "$prefix$file"
-  done
+for prefix in `kde-config --path exe| sed -e 's^bin/^shutdown/^g;s^:^ ^g'`; do
+    for file in $prefix/*; do
+	test -x $file && $file
+    done
 done
 
 echo 'startkde: Done.'  1>&2
 
design & coding: Vladimir Lettiev aka crux © 2004-2005