LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File SuSEconfig.kdenetwork-lan of Package kdenetwork3 (Project openSUSE:Factory)

#! /bin/sh
# Copyright (c) 2001 SuSE GmbH Nuernberg, Germany.  All rights reserved.
#
# Author: Adrian Schroeter <adrian@suse.de>
#
# This SuSEconfig script generates a standard /etc/lisarc config file
# for the KDE Lan Browser Daemon (LISa)


# check if we are started as root
# only one of UID and USER must be set correctly
if test "$UID" != 0 -a "$USER" != root; then
    echo "You must be root to start $0."
    exit 1
fi

r=$ROOT

test -f $r/lib/YaST/SuSEconfig.functions || {
    echo "ERROR - can not find $r/lib/YaST/SuSEconfig.functions!!"
    echo "This should not happen.  Exit..."
    exit 1
}
. $r/lib/YaST/SuSEconfig.functions

test -r $r/etc/sysconfig/windowmanager && . $r/etc/sysconfig/windowmanager

if test -n "$ENABLE_SUSECONFIG" -a "$ENABLE_SUSECONFIG" = "no" ; then
    echo "SuSEconfig is disabled in $r/etc/rc.config. Exit..."
    exit 0
fi

if test ! -w $r/etc ; then
   echo "The directory $r/etc is not writeable. Exit..."
   exit 0
fi

#
# configure write 
#
IN=/opt/kde3/share/apps/konqueror/dirtree/remote/lan.desktop
KONQ=/opt/kde3/share/apps/konqsidebartng/virtual_folders/services/lisa.desktop
FILENAME=/etc/opt/kde3/share/apps/kdesktop/Desktop/Network.desktop

# create needed directories
mkdir -p /etc/${IN%/*} ${FILENAME%/*} /etc${KONQ%/*}

case "$USE_LAN_SERVER" in
   none)
     # remove files, if written by SuSEconfig.lan
     rm -f /etc/${IN}.SuSEconfig ${r}${FILENAME}.SuSEconfig $r/etc${KONQ}
     touch /etc/${IN}.SuSEconfig ${r}${FILENAME}.SuSEconfig
     check_md5_and_move $r${FILENAME}
     check_md5_and_move $r/etc${IN}
     check_md5_and_move $r/etc${KONQ}
     rm -f $r/etc/${IN}.SuSEconfig ${r}${FILENAME}.SuSEconfig $r/etc${KONQ}.SuSEconfig
     [ -s $r/etc/${IN} ]    || rm -f $r/etc/${IN} 
     [ -s ${r}/etc${KONQ} ] || rm -f ${r}/etc${KONQ}
     [ -s ${r}${FILENAME} ] || rm -f ${r}${FILENAME}
     exit 0
     ;;
   smb:/)
     NETWORK_URL=smb:/
     ;;
   local)
     NETWORK_URL=rlan:/
     ;;
   *)
     NETWORK_URL=lan://"$USE_LAN_SERVER"
     ;;
esac

sed "s,^URL=.*,URL=${NETWORK_URL}," \
    $IN > ${r}${FILENAME}.SuSEconfig
cp ${r}${FILENAME}.SuSEconfig $r/etc/${IN}.SuSEconfig
sed "s,^URL=.*,URL=${NETWORK_URL}," \
    $KONQ > ${r}/etc/${KONQ}.SuSEconfig

check_md5_and_move $r${FILENAME}
check_md5_and_move $r/etc${IN}
check_md5_and_move $r/etc${KONQ}

# hide Desktop entry, if hand edited
if [ -e $r${FILENAME}.SuSEconfig ]; then
   mv $r${FILENAME}.SuSEconfig $r${FILENAME%/*}.${FILENAME##*/}.SuSEconfig
fi