#!/bin/bash # vim:sw=4:et # # SuSE theme install script. # # # # be sure to have a proper enviroment # [ -z "$KDEHOME" ] && KDEHOME="$HOME/.kde/" [ -z "$KONQ_DIR" ] && export KONQ_DIR="${KDEHOME}"/share/apps/konqueror/dirtree # # check for sysconfig/windowmanager # test -f /etc/sysconfig/windowmanager \ || { echo "No /etc/sysconfig/windowmanager found." && exit 1 ; } . /etc/sysconfig/windowmanager . /etc/sysconfig/displaymanager KONQ_DIR="${KDEHOME}/share/apps/konqueror/dirtree/" TEMPLATE_DIR=/opt/kde3/share/config/SuSE/default/ TEMPLATE2_DIR=/usr/share/desktop-data/ DEFAULT_DIR="${KDEHOME}/share/apps/default_desktop/" mkdir -p "$KONQ_DIR" COL=1 ROW=1 # # copy an application icon # function copy_app_icon { TEMPLATE_APP="$1" DIRECTION="$2" if test "$DIRECTION" = col; then pref=`printf COL_0_%02d $COL` COL=$(( $COL + 1 )) else pref=`printf ROW_0_%02d $ROW` ROW=$(( $ROW + 1 )) fi if [ -e "${TEMPLATE_DIR}/${TEMPLATE_APP}.desktop" ]; then sed "s,__HOME__,$HOME,g" "${TEMPLATE_DIR}/${TEMPLATE_APP}.desktop" \ > "${DEFAULT_DIR}/$pref"_"${TEMPLATE_APP}.desktop" else sed "s,__HOME__,$HOME,g" "${TEMPLATE2_DIR}/${TEMPLATE_APP}.desktop" \ > "${DEFAULT_DIR}/$pref"_"${TEMPLATE_APP}.desktop" fi } function create_default_desktop { # # Create default desktop # [ `kreadconfig --file kdesktoprc --group General --key CopyDesktopLinks --default true` == "false" ] && return mkdir -p $KDEHOME/share/apps/default_desktop mkdir -p $KDEHOME/Autostart/ cp $TEMPLATE_DIR/moving_desktop.desktop $KDEHOME/Autostart/ if [ -e "${KONQ_DIR}" -a -d "${HOME}/public_html" -a ! -e "${KONQ_DIR}"/public_html.desktop ]; then cp -a "${TEMPLATE_DIR}/public_html.desktop" "${KONQ_DIR}"/public_html.desktop fi copy_app_icon myComputer col #if [ -e /opt/kde3/share/services/service.protocol -a -d /proc/sys/net/ipv4/conf/eth0 ] ; then # copy_app_icon Network col #fi copy_app_icon Printer col if test -e /opt/kde3/share/config/SuSE/default/live-installer.desktop && test -e /etc/YaST2/live-install.xml ; then copy_app_icon live-installer col fi if [ -e /usr/share/applications/MozillaFirefox.desktop ] ; then copy_app_icon MozillaFirefox row fi copied_office=no # if [ -x /usr/bin/soffice ] ; then # copy_app_icon StarOffice row # copied_office=yes # fi if test -x /usr/bin/oofromtemplate && test "$copied_office" = no; then copy_app_icon Office row copied_office=yes fi if test -x /opt/kde3/bin/koshell && test "$copied_office" = no ; then copy_app_icon KOffice row fi if [ -e /opt/kde3/share/config/SuSE/default/SuSE.desktop ] ; then copy_app_icon SuSE row fi if [ -e /opt/kde3/share/config/SuSE/default/Support.desktop ] ; then copy_app_icon Support row fi } function copy_default_user { kdehome="$1" TEMPLATE_DIR=/opt/kde3/share/config/SuSE/default/ WALLPAPER=$(/opt/kde3/bin/startkde.pick_wallpaper) Y=`LC_ALL=C xdpyinfo|grep dimensions:|head -n 1|cut -dx -f2|egrep -o '[0-9]+'` mkdir -p $HOME/.skel/ cp /etc/SuSE-release $HOME/.skel/kdebase3 mkdir -p $HOME/.config/ cp -a "${TEMPLATE_DIR}"/qtcurvestylerc $HOME/.config/ if test -e /etc/YaST2/live-install.xml ; then if test -e "${TEMPLATE_DIR}"/kxkbrc.live ; then cp -a "${TEMPLATE_DIR}"/kxkbrc.live "${kdehome}"/share/config/kxkbrc fi if test -e "${TEMPLATE_DIR}"/kdedrc.live ; then cp -a "${TEMPLATE_DIR}"/kdedrc.live "${kdehome}"/share/config/kdedrc fi if test -e "${TEMPLATE_DIR}"/susepluggerrc.live ; then cp -a "${TEMPLATE_DIR}"/susepluggerrc.live "${kdehome}"/share/config/susepluggerrc fi if test -e "${TEMPLATE_DIR}"/opensuseupdaterrc.live ; then cp -a "${TEMPLATE_DIR}"/opensuseupdaterrc.live "${kdehome}"/share/config/opensuseupdaterrc fi if test -e "${TEMPLATE_DIR}"/beagled-autostart.desktop.live ; then mkdir -p $HOME/.config/autostart cp -a "${TEMPLATE_DIR}"/beagled-autostart.desktop.live $HOME/.config/autostart/beagled-autostart.desktop fi fi mkdir -p "${kdehome}"/share/config/ "${kdehome}"/share/apps/ SIZE=2 ICONSIZE=16 [ $Y -gt 600 ] && ICONSIZE=25 [ $Y -gt 1024 ] && ICONSIZE=32 test -e "${kdehome}"/share/config/kickerrc || sed -e "s@__ICONSIZE__@${ICONSIZE}@" \ "${TEMPLATE_DIR}"/kickerrc > "${kdehome}"/share/config/kickerrc if test ! -e "${kdehome}"/share/config/kdesktoprc; then sed -e "s@__SuSE_WALLPAPER__@${WALLPAPER}@" "${TEMPLATE_DIR}"/kdesktoprc \ > "${kdehome}"/share/config/kdesktoprc if test "$DISPLAYMANAGER_AUTOLOGIN" = "$USER"; then echo "[ScreenSaver]" >> "${kdehome}"/share/config/kdesktoprc echo "Lock=false" >> "${kdehome}"/share/config/kdesktoprc fi fi # # bookmarks for konqueror # mkdir -p "${kdehome}"/share/apps/konqueror/toolbar/ if [ ! -e "${kdehome}"/share/apps/konqueror/bookmarks.xml ]; then [ -e "${TEMPLATE_DIR}"/bookmarks.${LANG:0:2}.xml ] && \ cp -a "${TEMPLATE_DIR}"/bookmarks.${LANG:0:2}.xml "${kdehome}"/share/apps/konqueror/bookmarks.xml || \ cp -a "${TEMPLATE_DIR}"/bookmarks.xml "${kdehome}"/share/apps/konqueror/bookmarks.xml fi language_lctype=`/usr/bin/locale 2>&1 | grep LC_CTYPE | sed -e 's#^LC_CTYPE="\(.*\)"$#\1#; s#.UTF-8##'` if test ! -e "${kdehome}"/share/config/konquerorrc && test -n "$language_lctype"; then language_lctype=`LC_CTYPE=$language_lctype LANG= LC_ALL= /usr/bin/locale charmap` case $language_lctype in ISO-*) language_lctype=`echo "$language_lctype" | sed -e "s,ISO-,iso ,"` ;; esac sed -e "s,@__ENCODING__@,$language_lctype," "${TEMPLATE_DIR}"/konquerorrc \ > "${kdehome}"/share/config/konquerorrc fi # # default feeds for akregator # mkdir -p "${kdehome}"/share/apps/akregator/data/ if [ ! -e "${kdehome}"/share/apps/akregator/data/feeds.opml ]; then [ -e "${TEMPLATE_DIR}"/feeds.opml ] && \ cp -a "${TEMPLATE_DIR}"/feeds.opml "${kdehome}"/share/apps/akregator/data/feeds.opml fi if test ! -e "${kdehome}"/share/config/kdeglobals; then local=`/usr/bin/locale 2>&1 | grep LC_MESSAGES | sed -e 's#^LC_MESSAGES="\(.*\)"$#\1#; s#\..*##'` lang=`echo $local | sed -e 's,_.*$,,'` countr=`echo $local | sed -e 's,^.*_,,' | tr 'A-Z' 'a-z'` if test -z "$countr"; then countr=$lang; fi sed -e "s/__LANG__/$lang/" \ -e "s/__COUNTR__/$countr/" \ "${TEMPLATE_DIR}"/kdeglobals >"${kdehome}"/share/config/kdeglobals if test -f /opt/kde3/share/config/SuSE/default/kdeglobals.$lang; then cat /opt/kde3/share/config/SuSE/default/kdeglobals.$lang >> "${kdehome}"/share/config/kdeglobals fi fi chmod og-rwx "${kdehome}" } function copy_default_root { kdehome="$1" . /etc/sysconfig/language TEMPLATE_DIR=/opt/kde3/share/config/SuSE/default/ mkdir -p "$HOME"/.skel/ cp /etc/SuSE-release "$HOME"/.skel/kdebase3 mkdir -p "${kdehome}"/share/config/ test -e "${kdehome}"/share/config/kdesktoprc || cp "${TEMPLATE_DIR}"/kdesktoprc.root "${kdehome}"/share/config/kdesktoprc test -e "${kdehome}"/share/config/konsolerc || cp "${TEMPLATE_DIR}"/konsolerc.root "${kdehome}"/share/config/konsolerc test -e "${kdehome}"/share/config/kickerrc || cp "${TEMPLATE_DIR}"/kickerrc.root "${kdehome}"/share/config/kickerrc for cfile in artsmessagerc kcmartsrc kdewizardrc kpersonalizerrc; do if test -e "${kdehome}"/share/config/$cfile -a -e "${TEMPLATE_DIR}"/$cfile; then cp "${TEMPLATE_DIR}"/$cfile "${kdehome}"/share/config/ fi done if test ! -e "${kdehome}"/share/config/kdeglobals; then local=`/usr/bin/locale 2>&1 | grep LC_MESSAGES | sed -e 's#^LC_MESSAGES="\(.*\)"$#\1#; s#\..*##'` lang=`echo $local | sed -e 's,_.*$,,'` countr=`echo $local | sed -e 's,^.*_,,' | tr 'A-Z' 'a-z'` if test -z "$countr"; then countr=$lang; fi sed -e "s/__LANG__/$lang/" \ -e "s/__COUNTR__/$countr/" \ "${TEMPLATE_DIR}"/kdeglobals.root >"${kdehome}"/share/config/kdeglobals if test -f /opt/kde3/share/config/SuSE/default/kdeglobals.$lang; then cat /opt/kde3/share/config/SuSE/default/kdeglobals.$lang >> "${kdehome}"/share/config/kdeglobals fi fi if test ! -e "${kdehome}"/share/config/SuSEgreeterrc; then echo "[General]" > "${kdehome}"/share/config/SuSEgreeterrc echo "FirstLogin103=false" >> "${kdehome}"/share/config/SuSEgreeterrc fi chmod og-rwx -R "${kdehome}" }