LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File windowmaker of Package WindowMaker (Project X11:windowmanagers)

#!/bin/bash

#
# install SUSE theme
#

install_suse_theme ()
{
    setstyle --no-fonts /usr/share/WindowMaker/Themes/SUSE.themed
}


#
# update root menu
#

HOME_GNUSTEP=${GNUSTEP_USER_ROOT:-$HOME/GNUstep}
ROOT_MENU=$HOME_GNUSTEP/Defaults/WMRootMenu
WM_CONFIG=$HOME_GNUSTEP/Defaults/WindowMaker

test -f $ROOT_MENU && \
        grep -q /etc/WindowMaker/SuSE/SuSE_menu $ROOT_MENU && {
	
	cp $ROOT_MENU $ROOT_MENU.bak && \
	sed -e 's|"/etc/WindowMaker/SuSE/SuSE_wmapps[^"]*"|"/etc/X11/WindowMaker/SuSE_wmapps"|g' \
	    -e 's|"/etc/WindowMaker/SuSE/SuSE_menu[^"]*"|"\| xdg_menu --format WindowMaker --charset UTF-8"|g' \
	       $ROOT_MENU.bak >$ROOT_MENU
}


for FILE in $HOME_GNUSTEP/Defaults/* ; do
  
    [ $FILE = ${FILE%.sav} -a $FILE = ${FILE%.bak} -a -f $FILE ] && \
        grep -q /GNUstep/Apps/ $FILE && {
	
	cp $FILE $FILE.bak && \
	sed -e 's|/GNUstep/Apps/|/GNUstep/Applications/|g' $FILE.bak >$FILE
    }
done

#
# initialize users resources if any
#

test -f $WM_CONFIG || {

	wmaker.inst

	install_suse_theme

	test $? = 0 || exit 1
}

#
# replace the old suse theme
#

grep -q "/usr/X11R6/share/WindowMaker/Themes/SuSE.themed/stripes.png" $WM_CONFIG &&
  grep -q "/usr/X11R6/share/WindowMaker/Themes/SuSE.themed/blau.png" $WM_CONFIG && 
    install_suse_theme

grep -q "/share/WindowMaker/Themes/SuSE.themed/SUSE.jpg" $WM_CONFIG &&
    install_suse_theme

#
# handle transition from /usr/X11R6
#

find_X11R6 ()
{
    find $HOME_GNUSTEP -name "*.bak" -o -name "*.sav" -prune -o -type f -exec grep -q "/usr/X11R6/\(share/WindowMaker\|GNUstep\)" {} \; -print
}

if [ -f $ROOT_MENU ] && grep -q /usr/X11R6/GNUstep/Applications/WPrefs.app/WPrefs $ROOT_MENU && \
   [ ! -f /usr/X11R6/GNUstep/Applications/WPrefs.app/WPrefs -a ! -f /usr/X11R6/share/WindowMaker/README ] && \
   [ "x`find_X11R6`" != x ]; then
  xmessage -buttons "Keep:1,Update:0" -file - <<EOF
Beginning with openSUSE 10.2 WindowMaker was moved 
from /usr/X11R6 to /usr. However, your configuration
files in $HOME_GNUSTEP still points to /usr/X11R6.
Click on "Update" if you want to automaticaly update 
the configuration (recommended).
Click on "Keep" if you want to keep the old configuration
(for compatibility with older versions in case of home 
directory on NFS, etc. See README.SuSE)
EOF
  if [ $? = 0 ]; then
    find_X11R6 | while read FILE; do 
      cp $FILE $FILE.X11R6.bak && \
      sed -e 's|/usr/X11R6/GNUstep|/usr/lib/GNUstep|g' -e 's|/usr/X11R6/share/WindowMaker|/usr/share/WindowMaker|g' $FILE.X11R6.bak >$FILE
    done
  fi
fi
  

#
# let xdg_menu cache the output
#
xdg_menu --format WindowMaker --charset UTF-8 >/dev/null 2>&1 &  

exec wmaker