#!/bin/bash
# WineTools was initially written by Frank Hendriksen <frank@franksworld.net>
# and was extended by Joachim von Thadden <thadden@web.de>. It is not nice
# and looks like horror. But it works!
# 
# It is licensed under the GPL.
# 
# Send comments, bugreports, etc. to thadden@web.de"

# base definitions
VERSION="winetools-0.9"
WINESERVER="wineserver"
RELEASE="`echo $VERSION | sed -e "s/winetools-\(.*\)/\1/"`"
BASEDIR="/usr/local/winetools"
BINDIR="$HOME/bin"
DIALOG="$BASEDIR/Xdialog"
WINEDIR="`echo ~/.wine`"
CONFIG="$WINEDIR/winetools.log"
SYSDIR="$HOME/winetools"
INIWAIT="600"
WAIT=$INIWAIT
CHOP="$BASEDIR/chopctrl.pl"
CDROM="`ls -l "$WINEDIR/dosdevices/" 2>/dev/null | grep \" d: -> \"| sed -e \"s/^.* d: -> \(.*\)$/\1/\"`"
#[ "$SFMIRROR" = "" ] && SFMIRROR="http://mesh.dl.sourceforge.net/sourceforge"
[ "$SFMIRROR" = "" ] && SFMIRROR="http://puzzle.dl.sourceforge.net/sourceforge"

#for Debian:
#BASEDIR="/usr/share/winetools"
#DIALOG="/usr/bin/Xdialog"
#WINESERVER="/usr/lib/wine/wineserver"

# to generate the pot template use "xgettext -L Shell -o po/wt0.9.pot  wt0.9jo findwine"
# to generate a language template for your language call "msginit" in the directory po

init()
{
  unset WINEDLLOVERRIDES
  URL=""
  installer=""
  testname=""
  script=""
  winever=""
  dlsize=""
  dload=""
}


cleantmp()
{
  rm -Rf "$SYSDIR/sys/tmp/*"
}


mktemp_error()
{  
  $DIALOG  --title "`eval_gettext "*** ERROR ***"`" \
	   --no-buttons --infobox "`eval_gettext "Can not make a temporary file. Exiting..."`" 7 60
  exit $1
}


wineboot()
{
  waitforwineexit
  $DIALOG  --title "`eval_gettext "*** NOTICE ***"`" \
           --no-buttons --infobox "`eval_gettext "Simulating a Windows reboot. Please wait..."`" 7 60
  $WINE wineboot
}


waitforwineexit()
{
      n=0
      wdbcount="0"
      echo "`eval_gettext "waiting for wineservers to exit..."`"
      $DIALOG  --title "`eval_gettext "*** NOTICE ***"`" \
	       --no-buttons --infobox "`eval_gettext "Waiting for wineservers to exit...\nPlease wait..."`" 7 60
#      while [ "$n" != "$WAIT" ]; do
      while [ true ]; do
        ps xwww --User $USER |grep "wineserver"|grep -v "grep wineserver" &>/dev/null
	[ "$?" != "0" ] && break
	ps xwww --User $USER |grep winedbg|grep -v "grep winedbg" &>/dev/null
	if [ "$?" = "0" ]; then
	  if [ "$wdbcount" = "3" ]; then
	    $DIALOG --title "`eval_gettext "wine status"`" \
	      --cancel-label "`eval_gettext "kill debugger"`" \
	      --ok-label "`eval_gettext "continue"`" \
	      --yesno "`eval_gettext "The wine debugger was startet. If your installation does not continue\nfor a while you should switch to the console where you started winetools\nfrom to debug or let me kill it to continue here.\nSometimes you don't have to do anything to continue."`" 9 70	#'
	    if [ "$?" !=   "0" ]; then
	      for n in `ps xwww --User $USER|grep winedbg|grep -v "grep winedbg"|sed -e "s/^\(.\+\)pts.\+$/\1/"`; do
	        kill $n
	      done
	      sleep 1s
	      for n in `ps xwww --User $USER|grep winedbg|grep -v "grep winedbg"|sed -e "s/^\(.\+\)pts.\+$/\1/"`; do
	        kill -9 $n
	      done
	    fi
            $DIALOG  --title "`eval_gettext "*** NOTICE ***"`" \
                     --no-buttons --infobox "`eval_gettext "Waiting for wineservers to exit...\nPlease wait..."`" 7 60
	  else
	    wdbcount=$(($wdbcount+1))
	  fi
	else
	  wdbcount="0"
	fi
	n=$(($n+1))
	sleep 1s
        if [ "$n" = "$WAIT" ]; then
          $DIALOG --title "`eval_gettext "wine status"`" --no-cancel \
	          --msgbox "`eval_gettext "There is still a wineserver running after $n seconds waiting.\n
On slow computers or while downloading files this need not mean\n
anything. If you think Wine hangs, you may consider killing it\n
on the console by typing \"wineserver -kill\"."`" 9 60
	  n=0
        fi
      done
      if [ "$n" = "$WAIT" ]; then
        $DIALOG --title "`eval_gettext "wine status"`" --no-cancel \
	  --msgbox "`eval_gettext "There is still a wineserver running after $n seconds waiting.\nOn slow computers or while downloading files this need not mean\nanything. If you think Wine hangs, you may consider killing it."`"  7 60
      else
        echo "`eval_gettext "all wineservers endet after $n seconds..."`"
      fi
}


#########################
### Create fake drive ###
#########################
function createdrive()
{
  WAIT=10
  waitforwineexit
  WAIT=$INIWAIT
  if [ -e "$WINEDIR/drive_c/windows/regedit.exe" -a "$1" = "NEW" ]; then
    $DIALOG --title "Create Fake Windows Drive" \
            --yesno "`eval_gettext "Remove existing Fake Windows drive?"`" 7 60
    [ "$?" = "1" ] && return
  fi

  if [ "$1" = "UPDATE" ]; then
    if [ ! -d "$WINEDIR" ] ;then
      $DIALOG --title "`eval_gettext "Update an old Fake Windows drive"`" \
              --no-cancel \
              --msgbox "`eval_gettext "Can't find existing Fake Windows drive!"`" 7 60
      return
    fi

    grep "^Winetools $RELEASE configuration = installed at " "$CONFIG" &>/dev/null
    if [ "$?" = "0" ]; then
      $DIALOG --title "WineTools" \
              --yesno "`eval_gettext "It seems that the existing Fake Windows drive already\nhas an up to date Wine configuration, so there is\nno need to update. Do you want to continue?"`" 9 60
      [ "$?" = "1" ] && return
    fi

    $DIALOG --title "WineTools" \
            --yesno "`eval_gettext "To update an existing Fake Windows drive which was created with\nan older version of Wine and/or Winetools say 'Yes'. But note that\nthe configuration of Wine changes very often and so it can't be\nguaranteed that all will be working as expected. The normal way\nis to create a *new* Fake Windows drive and reinstall the\napplications. At least you should save your current Wine directory\nto make a rollback possible. Do you really want to continue?"`" 14 60
    [ "$?" = "1" ] && return
  fi

  cdrommount="`grep -e "cdrom" -e "dvd" -e "supermount" /etc/fstab`"	#|cut -d\  -f 1|paste -s|sed -e "s/	/,/"`"
  [ "$cdrommount" = "" ] && cdrommount="/mnt/cdrom"
  TMP=`mktemp ${TMPDIR:-/tmp}/cdrom.XXXXXX` || mktemp_error "$?"
  $DIALOG --title "`eval_gettext "Create/Update Fake Windows Drive"`" \
          --inputbox "`eval_gettext "What's the mount point of the cdrom/dvd drive?\n\nYour /etc/fstab says:\n$cdrommount"`" \
          600x300 "`echo "$cdrommount"|sed -e "s/\ \+/ /g"|tr '\t' ' '|cut -d\  -f 2|head -1`" 2> $TMP #'
  retval=$?
  if [ "$retval" = "0" ]; then
    cdrommount=`cat $TMP`
    rm -f $TMP
  else
    cdrommount=""
    return
  fi

  [ "$username" = "" ] && username="`grep \"^${LOGNAME}:\" /etc/passwd|cut -d: -f 5`"
  TMP=`mktemp ${TMPDIR:-/tmp}/username.XXXXXX` || mktemp_error "$?"
  $DIALOG -stdout --title "`eval_gettext "Create/Update Fake Windows Drive"`" \
          --inputbox "`eval_gettext "What's your username?"`" \
          600x300 "$username" > $TMP
  retval=$?
  if [ "$retval" = "0" ]; then
    username=`cat $TMP`
    rm -f $TMP
  else
    username="Change preferred owner in ~/.wine/system.reg"
    return
  fi

  [ "$organization" = "" ] && organization="`cat /etc/sysconfig/organization 2>/dev/null`"
  TMP=`mktemp ${TMPDIR:-/tmp}/organization.XXXXXX` || mktemp_error "$?"
  $DIALOG -stdout --title "`eval_gettext "Create/Update Fake Windows Drive"`" \
          --inputbox "`eval_gettext "What's your organization?"`" \
          600x300 "$organization" > $TMP
  retval=$?
  if [ "$retval" = "0" ]; then
    organization=`cat $TMP`
    rm -f $TMP
  else
    organization="Change preferred organization in ~/.wine/system.reg"
    return
  fi

  cd ~

  if [ "$1" = "NEW" ]; then
    rm -Rf .wine
    mkdir ~/.wine
    touch "$WINEDIR/.no_debug_window_flag"
    touch "$WINEDIR/.no_prelaunch_window_flag"
    wineprefixcreate
  fi

  # Drive autodetection via winecfg
  rm $WINEDIR/dosdevices/d: 2>/dev/null
  rm $WINEDIR/dosdevices/d:: 2>/dev/null
  ln -s ${cdrommount} $WINEDIR/dosdevices/d:
  rm $WINEDIR/dosdevices/f: 2>/dev/null
  rm $WINEDIR/dosdevices/f:: 2>/dev/null
  ln -s $SYSDIR ~/.wine/dosdevices/f:
  winecfg -D

  # now we have to check whether we have a suitable configuration now
  if [ ! -e "$WINEDIR/drive_c/windows/regedit.exe" ] && [ ! -e "$WINEDIR/c/windows/regedit.exe" ]; then
#    rm -Rf .wine
    $DIALOG --title "`eval_gettext "Create/Update Fake Windows Drive"`" \
            --no-cancel \
            --msgbox "`eval_gettext "Fake Windows drive *not* created!"`" 7 60
    return
  fi

  $WINE regedit.exe $BASEDIR/wt-config.reg
  waitforwineexit

  echo "Winetools $RELEASE configuration = installed at `date \"+%d.%m.%Y %H:%M:%S\"`" >>$CONFIG

  [ -e "$WINEDIR/drive_c/windows/winhlp32.exe" ] && mv "$WINEDIR/drive_c/windows/winhlp32.exe" "$WINEDIR/drive_c/windows/winhlp32.exe.wine"
  # mv "$WINEDIR/drive_c/windows/system32/regsvr32.exe" "$WINEDIR/drive_c/windows/system32/regsvr32.exe.wine"
  cp $BASEDIR/scripts/dos "$BINDIR"
  cp $BASEDIR/scripts/uninstall "$BINDIR"

  # find drive C:
  cd "$WINEDIR"
  DRIVEC=""
  [ -d "$WINEDIR/drive_c" ] && [ ! -h "$WINEDIR/drive_c" ] && { DRIVEC="$WINEDIR/drive_c";others="c fake_windows"; }
  [ -d "$WINEDIR/c" ] && [ ! -h "$WINEDIR/c" ] && { DRIVEC="$WINEDIR/c";others="drive_c fake_windows"; }
  [ -d "$WINEDIR/fake_windows" ] && [ ! -h "$WINEDIR/fake_windows" ] && { DRIVEC="$WINEDIR/fake_windows";others="c drive_c"; }
  [ "$DRIVEC" = "" ] && { echo "`eval_gettext "no fake drive C: found! Setting to $WINEDIR/drive_c!"`";DRIVEC="$WINEDIR/drive_c";mkdir -p "$DRIVEC"; }
  [ "$DRIVEC" = "" ] || echo "`eval_gettext "Drive C: is $DRIVEC, links will be made for $others"`"
  for n in $others; do
#    ln -s "$DRIVEC" "$WINEDIR/$n"
    echo "Linking $DRIVEC to $n..."
    [ ! -e "$n" ] && ln -s "$DRIVEC" "$n"
  done

  # find ... to create links
  # "ProgramFiles" "CommonFilesDir" "ProgramFilesDir"
  grep "\"ProgramFiles\"=\"" $WINEDIR/system.reg | cut -d\" -f 4 | sed -e "s/c:\\\\\\\//" -e "s@\\\\\\\@/@g" > $WINEDIR/PF.tmp
  LocalizedDir=`cat "$WINEDIR/PF.tmp"`
  if [ "$LocalizedDir" != "Program Files" ]; then
    echo "Linking \"$WINEDIR/c/${LocalizedDir}\" to \"$WINEDIR/c/Program Files\""
    mkdir "$WINEDIR/c/Program Files" 2>/dev/null
    mv "$WINEDIR/c/${LocalizedDir}/"* "$WINEDIR/c/Program Files"
    rmdir "$WINEDIR/c/${LocalizedDir}"
    ln -s "$WINEDIR/c/Program Files" "$WINEDIR/c/${LocalizedDir}"
  fi
  grep "\"CommonFilesDir\"=\"" $WINEDIR/system.reg | cut -d\" -f 4 | sed -e "s/c:\\\\\\\//" -e "s@\\\\\\\@/@g" > $WINEDIR/PF.tmp
  LocalizedDir=`cat "$WINEDIR/PF.tmp"`
  if [ "$LocalizedDir" != "Program Files/Common Files" ]; then
    echo "Linking \"$WINEDIR/c/${LocalizedDir}\" to \"$WINEDIR/c/Program Files/Common Files\""
    mkdir "$WINEDIR/c/Program Files/Common Files" 2>/dev/null
    mv "$WINEDIR/c/${LocalizedDir}/"* "$WINEDIR/c/Program Files/Common Files" 2>/dev/null
    rmdir "$WINEDIR/c/${LocalizedDir}"
    ln -s "$WINEDIR/c/Program Files/Common Files" "$WINEDIR/c/${LocalizedDir}"
  fi
  rm "$WINEDIR/PF.tmp"

  echo "*new* fake Windows drive = installed at `date \"+%d.%m.%Y %H:%M:%S\"`" >>$CONFIG

  touch "$WINEDIR/c/config.sys"
  touch "$WINEDIR/c/autoexec.bat"
  [ -e "$WINEDIR/drive_c/Programme" ] || ln -s "$WINEDIR/c/Program Files" "$WINEDIR/drive_c/Programme"

# Don't link to /tmp to avoid conflicts with Wines of different users
#  ln -s /tmp "$WINEDIR/c/tmp"
#  ln -s /tmp "$WINEDIR/c/temp"
  mkdir "$WINEDIR/c/tmp" 2>/dev/null
  mkdir "$WINEDIR/c/temp" 2>/dev/null

  CDROM="`ls -l $WINEDIR/dosdevices/|grep \" d: -> \"| sed -e \"s/^.* d: -> \(.*\)$/\1/\"`"

  # replace user and organization  
  sed -e "s@Change preferred owner in ~/.wine/system.reg@$username@g" $WINEDIR/system.reg > $WINEDIR/system.reg1
  sed -e "s@Change preferred organization in ~/.wine/system.reg@$organization@g" $WINEDIR/system.reg1 > $WINEDIR/system.reg
  rm $WINEDIR/system.reg1

  wineboot

  . ${BASEDIR}/findwine

  if [ "$1" = "NEW" ]; then
    $DIALOG --title "`eval_gettext "Create Fake Windows Drive"`" \
            --no-cancel \
            --msgbox "`eval_gettext "Fake Windows drive created in ~/.wine."`" 7 60
  else
    $DIALOG --title "`eval_gettext "Update Fake Windows Drive"`" \
            --no-cancel \
            --msgbox "`eval_gettext "Fake Windows drive .wine updated."`" 7 60
  fi
}


##################
### Fonts menu ###
##################
function fonts()
{
init
needsw  "\*new\* fake Windows drive" "--no-cancel"
needsw "dcom98.exe" "--no-cancel"
needsw "Microsoft Internet Explorer.*" "--no-cancel"

TMP=`mktemp ${TMPDIR:-/tmp}/menu.XXXXXX` || mktemp_error "$?"
$DIALOG -stdout --title "`eval_gettext "TrueType Fonts"`" \
	--cancel-label "`eval_gettext "Main menu"`" \
	--check "`eval_gettext "Show Info"`" \
	--icon $BASEDIR/icon/font.xpm \
        --menu "`eval_gettext "
*** Microsoft's TrueType core fonts ***
These fonts are needed by many Windows programs
so you should install them. Note that you install them
for Wine, not for your whole Linux system. Use the
\"Show Info\" feature to learn more about the fonts.
"`" 400x410 0 \
        "Andale" "" \
        "Arial Black" "" \
        "Comic Sans" "" \
        "Courier New"  "" \
        "Georgia"  "" \
	"Impact"  "" \
	"Times New Roman"  "" \
	"Trebuchet"  "" \
	"Verdana"  "" \
	"Webdings"  "" > $TMP #'
	
retval=$?

choice=`cat $TMP|grep -v "checked"`
checked="F"
[ "`cat $TMP|grep \"checked\"`" = "checked" ] && checked="T"

rm -f $TMP

case $retval in
0)

echo "`eval_gettext "Choice is $choice"`"
case "$choice" in
"Andale")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="andale32.exe"
    dlsize="198384"
    fontsinstall
  }
;;
"Arial Black")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="arialb32.exe"
    dlsize="168176"
    fontsinstall
  }
;;
"Comic Sans")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="comic32.exe"
    dlsize="246008"
    fontsinstall
  }
;;
"Courier New")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="courie32.exe"
    dlsize="646368"
    fontsinstall
  }
;;
"Georgia")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="georgi32.exe"
    dlsize="392440"
    fontsinstall
  }
;;
"Impact")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="impact32.exe"
    dlsize="173288"
    fontsinstall
  }
;;
"Times New Roman")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="times32.exe"
    dlsize="661728"
    fontsinstall
  }
;;
"Trebuchet")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="trebuc32.exe"
    dlsize="357200"
    fontsinstall
  }
;;
"Verdana")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="verdan32.exe"
    dlsize="351992"
    fontsinstall
  }
;;
"Webdings")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="webdin32.exe"
    dlsize="185072"
    fontsinstall
  }
esac
fonts
;;
1)
    mainmenu
;;
esac
}

##############################
### Fonts download/install ###
##############################
function fontsinstall()
{
  cd $SYSDIR/fonts

  dload="$SFMIRROR/corefonts/${fontname}"
  sysname="${fontname}"
  realinstall "" "--nofail"
}


#########################################
### Install system software and files ###
#########################################
function testsw()
{
    echo "$1 to check"
    if [ ! -e $WINEDIR ] ;then
      # to not create a .wine directory when checking
      return 1;
    fi

    # test via registry
    $WINE regedit /e ~/.wine/installed.reg "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" >/dev/null 2>&1
    KEY=$?
    if [ "$KEY" = "0" ]; then
        grep "\"DisplayName\"=" ~/.wine/installed.reg | sed -e "s/.*=\"\(.*\)\".*/\1/g"|sort > $WINEDIR/installed-software
        grep "QuietDisplayName\"=" ~/.wine/installed.reg | sed -e "s/.*=\"\(.*\)\".*/\1/g"|sort > $WINEDIR/quiet-installed-software
        rm ~/.wine/installed.reg
        grep "^$1$" ~/.wine/installed-software
        INSTALLED=$?
    fi
    if [ "$KEY" = "0" ] && [ "$INSTALLED" = "0" ]; then
      echo "`eval_gettext "software installation verified by registry value"`"
    else
      grep "^$1$" ~/.wine/quiet-installed-software 2>/dev/null
      if [ "$?" = "0" ]; then
        echo "`eval_gettext "software installation verified by quiet registry value"`"
      else
#        # test via path
#        testfile=`winepath -u "$1"`
#        if [ -s "$testfile" ]; then
#          echo "software installation verified by path"
#        else
          # test via logfile
	  echo "`eval_gettext "software installation verified by $CONFIG"`"
          grep "^$1 = installed at " $CONFIG 2>/dev/null
#        fi
      fi
    fi
}


function needsw()
{
  testsw "$1"
  if [ "$?" != "0" ]; then
    echo "`eval_gettext "dependency "$1" *not* fulfilled"`"
    if [ "$2" = "--no-cancel" ]; then
      boxstring="`eval_gettext "This software depends on "`\"$1\".\n`eval_gettext "Your config file states that you have not installed\n"`\"$1\"`eval_gettext " yet. In that case it could be\nthat installation or execution of the software fails."`"
      $DIALOG  --title "`eval_gettext "*** HINT ***"`"\
              --msgbox  "$boxstring" 9 60
    else
      boxstring="`eval_gettext "This software depends on "`\"$1\".\n`eval_gettext "Your config file states that you have not installed\n"`\"$1\"`eval_gettext " yet. In that case you will\nnot be able to install the desired software.\nContinue anyway?"`"
      $DIALOG  --title "`eval_gettext "*** ERROR ***"`" \
               --defaultno --yesno  "$boxstring" 12 60
    fi
    if [ "$?" = "0" ]; then
      # continue anyway
      return 0
    else
      # abort
      return 1
    fi
  else
    echo "`eval_gettext "dependency "$1" fulfilled"`"
  fi
  # continue
  return 0
}


function mustnotsw()
{
  testsw "$1"
  if [ "$?" = "0" ]; then
    $DIALOG  --title "`eval_gettext "*** ERROR ***"`"\ 
             --defaultno --yesno "`eval_gettext "Your config file states that you have already installed $1.\nIn that case the installation of your desired software will fail!\nContinue anyway?"`" 9 70
    if [ "$?" = "0" ]; then
      # continue anyway
      return 0
    else
      # abort
      return 1
    fi
  fi
  # continue
  return 0
}


function showinfo()
{
  if [ "$checked" = "T" ]; then
    [ "$URL" = "" ] && return "0"
    "$BROWSER" "$URL" &
    return "0"
  else
    return "1"
  fi
}


function sysinstallsw()
{
  cd $SYSDIR/sys
  if [ "$dlsize" != "selected" ]; then
    $DIALOG  --title "`eval_gettext "Download File"`" \
             --yesno "`eval_gettext "If you downloaded the file by yourself (e.g. in a different language)\nyou can use this one instead of the default.\nDo you want to use the default?"`" 10 60
  else
    false
  fi
  if [ "$?" = "0" ]; then
    realinstall "$1" "$2"
    failed="$?"
  else
    TMP=`mktemp ${TMPDIR:-/tmp}/menu.XXXXXX` || mktemp_error "$?"
    $DIALOG -stdout --title "`eval_gettext "Select File"`" --fselect "~/.wine/c/" 50 70 >$TMP
    if [ "$?" = "0" ]; then
      sysname="`cat $TMP`"
      dirname=`dirname "$sysname"`
      filename=`basename "$sysname"`
      rm "$WINEDIR/dosdevices/y:" 2>/dev/null
      ln -s "$dirname" "$WINEDIR/dosdevices/y:"
      sysname="y:\\$filename"
      installer="$WINE $sysname"
      dload="none"
      dlsize="selected"
      realinstall "$1" "$2"
      failed="$?"
    else
      failed="99"
    fi
    rm $TMP
  fi
  echo "`eval_gettext "Failed: $failed"`"
  return "$failed"
}

function sysinstall()
{
  cd $SYSDIR/sys
  realinstall "$1" "$2"
}

# This function does the real work.
# $1	--noboot	inhibits boot
#	--nocheck	disables check for existing package
# $2	--nofail	disables check for failed
#
function realinstall()
{
  if [ "$1" = "--nocheck" ]; then
    shift
  else
    if [ "$testname" = "" ]; then
      testsw "$sysname"
    else
      testsw "$testname"
    fi
    if [ "$?" = "0" ]; then
      $DIALOG  --title "`eval_gettext "Software Exists"`"\
               --yesno "`eval_gettext "The config file says the software you want\nto install is already installed. Continue?"`" 7 60
      if [ "$?" != "0" ]; then
        return "99"
      fi
    fi
  fi

  if [ "$dload" = "none" ]; then
    [ "$dlsize" = "" ] && mount_cd
  else
    PROGRESS="`ls -l "$sysname" 2>/dev/null |sed -e \"s/\ \+/,/g\"|cut -d\, -f5`"
    realdownload=1
    [ -n "$PROGRESS" ] && echo "$PROGRESS bytes previously downloaded"
    if [ "$PROGRESS" = "$dlsize" ]; then
#      $DIALOG  --title "Download File Exists" --yesno "The required download file already exists. Do you want to use this one?" 7 60
#      if [ "$?" = "0" ]; then
        realdownload=0
#      else
#        realdownload=1
#      fi
    fi

    if [ "$realdownload" = "1" ]; then
      echo "`eval_gettext "downloading $dload to $sysname with $dlsize bytes..."`"
      PROGRESS="0"
      > $sysname
      {
        wget "$dload" -O "$sysname" 2>wget.errors &
        echo 0
        while [ "$PROGRESS" != "$dlsize" ]
        do
          PROGRESS="`ls -l "$sysname" |sed -e \"s/\ \+/,/g\"|cut -d\, -f5`"
          grep "Not Found." wget.errors &>/dev/null && PROGRESS="$dlsize"
          echo $[PROGRESS*100/dlsize] 
          sleep 1s
        done
        echo 100
      }  | $DIALOG  --title "`eval_gettext "Downloading"`" --gauge "`eval_gettext "Downloading"`" 7 60 0
      grep "Not Found." wget.errors &>/dev/null
      if [ "$?" = "0" ]; then
        echo "$sysname = download failed at `date \"+%d.%m.%Y %H:%M:%S\"`" >>$CONFIG
        ERR="`pwd`/wget.errors"
        $DIALOG --title "`eval_gettext "wine status"`" \
                --no-cancel \
                --msgbox "`eval_gettext "It seems that the download has failed.\nInspect $ERR for reasons."`" 7 70
        return "1"
      fi
    fi
  fi

  TMP=`mktemp ${TMPDIR:-/tmp}/wineinstall.XXXXXX` || mktemp_error "$?"

  # Some apps (e.g. Wordviewer inst.) are searching all drives for other components and run into an infinite loop
  # when searching drive z: which is linking to / , so hide it temporary. Others (e.g. msxml4 inst.) need z:.
  if [ "$sysname" = "wd97vwr32.exe" -o "$sysname" = "xlViewer.exe" -o "$sysname" = "PPView97.exe" -o "$sysname" = "ppviewer.exe" -o \
       "$sysname" = "Microsoft Office 97" -o "$sysname" = "Microsoft Office 95" ]; then
     [ -e "$WINEDIR/dosdevices/z:" ] && mv "$WINEDIR/dosdevices/z:" "$WINEDIR/dosdevices/.z:"
  fi

  if [ "$installer" = "" ]; then
  {
    echo "WINEDEBUG=\"$WINEDEBUG\" WINEDLLOVERRIDES=\"$WINEDLLOVERRIDES\" $WINE ./$sysname"
    WINEDEBUG="$WINEDEBUG" WINEDLLOVERRIDES="$WINEDLLOVERRIDES" $WINE ./$sysname
    echo "$?" >$TMP
  } &
  elif [ "$installer" = "***SEARCH***" ]; then
    # check for autorun first
    if [ -e "${CDROM}/autorun.inf" ]; then
      echo "found autorun.inf"
      installer="$WINE D:\\`grep -i "OPEN=" "${CDROM}/autorun.inf"|sed -e "s/[Oo][Pp][Ee][Nn]=\(.*\)$/\1/"`"
      # chop off the last character if needed
      installer=`"$CHOP" "$installer"`	#`
    elif [ -e "${CDROM}/[Ss][Ee][Tt][Uu][Pp].[Ee][Xx][Ee]" ]; then
      installer="$WINE D:\\setup.exe"
    elif [ -e "${CDROM}/[Ii][Nn][Ss][Tt][Aa][Ll][Ll].[Ee][Xx][Ee]" ]; then
      installer="$WINE D:\\install.exe"
    elif [ -e "${CDROM}/[Ii][Nn][Ss][Tt].[Ee][Xx][Ee]" ]; then
      installer="$WINE D:\\inst.exe"
    elif [ -e "${CDROM}/[Aa][Uu][Tt][Oo][Pp][Ll][Aa][Yy].[Ee][Xx][Ee]" ]; then
      installer="$WINE D:\\autoplay.exe"
    else
      echo "no installer found..."
      $DIALOG --title "`eval_gettext "wine status"`" \
              --no-cancel \
              --msgbox "`eval_gettext "WineTools could not find an installer.\nTry again with manually finding it."`" 7 70
    fi
    if [ "$installer" != "***SEARCH***" ]; then
    {
      echo "installer found as \"$installer\""
      echo "WINEDEBUG=\"$WINEDEBUG\" WINEDLLOVERRIDES=\"$WINEDLLOVERRIDES\" $installer"
      WINEDEBUG="$WINEDEBUG" WINEDLLOVERRIDES="$WINEDLLOVERRIDES" $installer
      echo "$?" >$TMP
    } &
    fi
  else
  {
    echo "WINEDEBUG=\"$WINEDEBUG\" WINEDLLOVERRIDES=\"$WINEDLLOVERRIDES\" $installer"
    WINEDEBUG="$WINEDEBUG" WINEDLLOVERRIDES="$WINEDLLOVERRIDES" $installer
    echo "$?" >$TMP
  } &
  fi
  sleep 3s
  waitforwineexit
  failed="`cat $TMP`"
  echo "`eval_gettext "Failed: $failed"`"
  [ "$2" = "--nofail" ] && failed="0"

  [ -e "$WINEDIR/dosdevices/.z:" ] && mv "$WINEDIR/dosdevices/.z:" "$WINEDIR/dosdevices/z:"

  if [ "$testname" = "" ]; then
    echo "`eval_gettext "check installation by return value..."`"
    [ "$failed" = "0" ] && echo "$sysname = installed at `date \"+%d.%m.%Y %H:%M:%S\"`" >>$CONFIG
    [ "$failed" = "1" ] && echo "$sysname = installation failed at `date \"+%d.%m.%Y %H:%M:%S\"`" >>$CONFIG
  else
    echo "`eval_gettext "check installation by path or registry value..."`"
    waitforwineexit
    testsw "$testname"
    failed="$?"
    [ "$failed" = "0" ] && echo "$testname = installed at `date \"+%d.%m.%Y %H:%M:%S\"`" >>$CONFIG
    [ "$failed" = "1" ] && echo "$testname = installation failed at `date \"+%d.%m.%Y %H:%M:%S\"`" >>$CONFIG
  fi

  [ "$1" = "--noboot" ] || wineboot

  echo "`eval_gettext "Failed: $failed"`"
  if [ "$failed" != "0" ] ; then
    $DIALOG --title "`eval_gettext "wine status"`" \
            --no-cancel \
            --msgbox "`eval_gettext "It seems that the installation has failed."`" 7 70
  else
    if [ "$script" != "" ]; then
      for n in $script; do
        if [ -e "$BINDIR/$n" ]; then
          echo -n "`eval_gettext "There is already a script called $n in $BINDIR..."`"
          diff -q "$BASEDIR/scripts/$n" "$BINDIR/$n" &>/dev/null
          if [ "$?" != "0" ]; then
            echo -n "`eval_gettext " and it is not the same as the one we want to copy!"`"
            mv -f "$BINDIR/$n" "$BINDIR/$n.wtsave"
            $DIALOG  --title "`eval_gettext "*** NOTICE ***"`"\
                     --msgbox "`eval_gettext "There is already a script called $n in\n$BINDIR. I renamed this to $n.wtsave."`" 12 60
          fi
          echo ""
        fi
        cp -a "$BASEDIR/scripts/$n" "$BINDIR"
      done
      $DIALOG  --title "`eval_gettext "*** NOTICE ***"`"\
               --msgbox "`eval_gettext "To start the installed software WineTools has copied\nthe following start scripts to your $BINDIR directory:\n\n$script"`" 12 60
    fi
  fi

  if [ "$dload" = "none" ]; then
    umount_cd
  fi

  return $failed
}


# get Windows system path of the registry
function getSystemPath()
{
  SYSTEM_PATH_REG=`grep -ih \"winsysdir\"\=\" $WINEDIR/system.reg`
  SYSTEM_PATH_WIN=`echo $SYSTEM_PATH_REG |cut --delimiter=\" --fields=4`

  [ -z "$SYSTEM_PATH_WIN" ] && SYSTEM_PATH_WIN=c:\\windows\\system32
  SYSTEM_PATH_LINUX=`winepath "$SYSTEM_PATH_WIN" |grep .wine/`

  [ -z "$SYSTEM_PATH_LINUX" ] && SYSTEM_PATH_LINUX=$WINEDIR/drive_c/windows/system32
  echo sytempath=$SYSTEM_PATH_LINUX
  return
}

#########################
###  System Software  ###
#########################
function systemmenu()
{
init
needsw  "\*new\* fake Windows drive" "--no-cancel"
needsw "dcom98.exe" "--no-cancel"
needsw "Microsoft Internet Explorer.*" "--no-cancel"

TMP=`mktemp ${TMPDIR:-/tmp}/menu.XXXXXX` || mktemp_error "$?"
$DIALOG -stdout --title "`eval_gettext "System Software"`" \
	--cancel-label "`eval_gettext "Main menu"`" \
	--icon $BASEDIR/icon/computer.xpm \
	--check "`eval_gettext "Show Info"`" \
        --menu "`eval_gettext "
*** Windows System Software ***
This is very basic software you normaly need for
many programs. Note that you might have to have a
valid license of Windows >98 for that. The MS-Installer
is the most important. For database applications use
the MDAC and Jet installations.
"`" 400x460 0 \
        "Windows Installer"  "" \
	"Visual Basic 5 Runtime" "" \
        "Visual Basic 6 Runtime" "" \
        "Visual C++ run-time English" "" \
        "Visual C++ run-time German" "" \
	"MDAC 2.8 and Jet 4.0 SP8 English" "" \
	"MDAC 2.8 and Jet 4.0 SP8 German" "" \
	"MDAC 2.8 and Jet 4.0 SP8 Italian" "" \
	"MDAC 2.8 and Jet 4.0 SP8 Norwegian" "" \
	"MDAC 2.8 and Jet 4.0 SP8 Spanish" "" \
	"MSXML 4.0 Service Pack 2 English" "" \
	"MSXML 4.0 Service Pack 2 German" "" \
	"MSXML 4.0 Service Pack 2 Italian" "" \
        "Windows Script 5.6 English"  "" \
        "Windows Script 5.6 German"  "" \
        "Windows Script 5.6 Italian"  "" \
        "Windows Script 5.6 Norwegian"  "" \
	"Common Controls 5.0" "" > $TMP

retval=$?

choice=`cat $TMP|grep -v "checked"`
checked="F"
[ "`cat $TMP|grep \"checked\"`" = "checked" ] && checked="T"
rm -f $TMP

case $retval in
0)

echo "Choice is $choice"
case "$choice" in
"HTML Help Update Package")
# menu was below "Windows Script 5.6 German":
# "HTML Help Update Package" "" \
  URL="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/htmlhelp/html/vsconhh1start.asp"
  showinfo || {
    dload="http://download.microsoft.com/download/winntsrv40/Install/Q323255/NT4/EN-US/hhupd.exe"
    # was: dload="http://go.microsoft.com/fwlink/?LinkId=14498"
    dlsize="750888"
    # was: dlsize="752944"
    sysname="HHUPD.EXE"
    sysinstall
  }
;;
"MDAC 2.8 and Jet 4.0 SP8 English")
  $DIALOG   --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Note that the installer will install MDAC twice. Follow\nit, otherwise you will not have all database drivers."`" 7 60
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/c/d/f/cdfd58f1-3973-4c51-8851-49ae3777586f/MDAC_TYP.EXE"
    dlsize="5556616"
    sysname="MDAC_TYP.EXE"
    sysinstall
  }
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=4335216c-8cdd-4168-a030-46f815d3f5cd"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/4/3/9/4393c9ac-e69e-458d-9f6d-2fe191c51469/Jet40SP8_9xNT.exe"
      dlsize="3872168"
      sysname="Jet40SP8_9xNT.exe"
      sysinstall
    fi
  }
  [ $checked = "T" ] || {
    dload="http://download.microsoft.com/download/c/d/f/cdfd58f1-3973-4c51-8851-49ae3777586f/MDAC_TYP.EXE"
    dlsize="5556616"
    sysname="MDAC_TYP.EXE"
    sysinstall "--nocheck"
  }
;;
"MDAC 2.8 and Jet 4.0 SP8 Italian")
  $DIALOG   --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Note that the installer will install MDAC twice. Follow\nit, otherwise you will not have all database drivers."`" 7 60
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c&DisplayLang=it"
  showinfo || {
    dload="http://download.microsoft.com/download/f/f/6/ff6bf59e-0955-4f0c-a218-c7fd53d1e31b/MDAC_TYP.EXE"
    dlsize="5561736"
    sysname="MDAC_TYP.EXE"
    sysinstall
  }
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=it&FamilyID=4335216c-8cdd-4168-a030-46f815d3f5cd"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/9/0/d/90d6430d-cea6-4c7c-9773-11a2b4cadeb9/Jet40SP8_9xNT.exe"
      dlsize="3872168"
      sysname="Jet40SP8_9xNT.exe"
      sysinstall
    fi
  }
  [ $checked = "T" ] || {
    dload="http://download.microsoft.com/download/f/f/6/ff6bf59e-0955-4f0c-a218-c7fd53d1e31b/MDAC_TYP.EXE"
    dlsize="5561736"
    sysname="MDAC_TYP.EXE"
    sysinstall "--nocheck"
  }
;;
"MDAC 2.8 and Jet 4.0 SP8 German")
  $DIALOG   --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Note that the installer will install MDAC twice. Follow\nit, otherwise you will not have all database drivers."`" 7 60
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=de&FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c"
  showinfo || {
    dload="http://download.microsoft.com/download/a/b/9/ab965707-fbab-48bc-8c33-a4cfd44255c6/MDAC_TYP.EXE"
    dlsize="5568952"
    sysname="MDAC_TYP.EXE"
    sysinstall
  }
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=4335216c-8cdd-4168-a030-46f815d3f5cd&DisplayLang=de"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/1/3/3/133bff47-685e-4a59-b8ba-b129b4c850a1/Jet40SP8_9xNT.exe"
      dlsize="3877800"
      sysname="Jet40SP8_9xNT.exe"
      sysinstall
    fi
  }
  [ $checked = "T" ] || {
    dload="http://download.microsoft.com/download/a/b/9/ab965707-fbab-48bc-8c33-a4cfd44255c6/MDAC_TYP.EXE"
    dlsize="5568952"
    sysname="MDAC_TYP.EXE"
    sysinstall "--nocheck"
  }
;;
"MDAC 2.8 and Jet 4.0 SP8 Norwegian")
  $DIALOG   --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Note that the installer will install MDAC twice. Follow\nit, otherwise you will not have all database drivers."`" 7 60
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=no&FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c"
  showinfo || {
    dload="http://download.microsoft.com/download/0/8/c/08c1881c-73b1-4c75-9bcd-e08c494ddee1/MDAC_TYP.EXE"
    dlsize="5551224"
    sysname="MDAC_TYP.EXE"
    sysinstall
  }
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=4335216c-8cdd-4168-a030-46f815d3f5cd&DisplayLang=no"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/d/d/6/dd686adc-5008-4e20-9c9c-a407a7fad153/Jet40SP8_9xNT.exe"
      dlsize="3866536"
      sysname="Jet40SP8_9xNT.exe"
      sysinstall
    fi
  }
  [ $checked = "T" ] || {
    dload="http://download.microsoft.com/download/0/8/c/08c1881c-73b1-4c75-9bcd-e08c494ddee1/MDAC_TYP.EXE"
    dlsize="5551224"
    sysname="MDAC_TYP.EXE"
    sysinstall "--nocheck"
  }
;;
"MDAC 2.8 and Jet 4.0 SP8 Spanish")
  $DIALOG   --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Note that the installer will install MDAC twice. Follow\nit, otherwise you will not have all database drivers."`" 7 60
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=es&FamilyID=6c050fe3-c795-4b7d-b037-185d0506396c"
  showinfo || {
    dload="http://download.microsoft.com/download/b/3/c/b3cbdb35-80a5-4fa2-a9af-ad84d1757f6b/MDAC_TYP.EXE"
    dlsize="5558904"
    sysname="MDAC_TYP.EXE"
    sysinstall
  }
  URL="http://support.microsoft.com/default.aspx?scid=kb;es;239114"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/c/4/3/c436a74c-5dc3-44e0-b332-fc3bbd30e7cd/Jet40SP8_9xNT.exe"
      dlsize="3871656"
      sysname="Jet40SP8_9xNT.exe"
      sysinstall
    fi
  }
  [ $checked = "T" ] || {
    dload="http://download.microsoft.com/download/b/3/c/b3cbdb35-80a5-4fa2-a9af-ad84d1757f6b/MDAC_TYP.EXE"
    dlsize="5558904"
    sysname="MDAC_TYP.EXE"
    sysinstall "--nocheck"
  }
;;
"MSXML 4.0 Service Pack 2 English")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=3144b72b-b4f2-46da-b4b6-c5d7485f2b42&displaylang=en"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/9/6/5/9657c01e-107f-409c-baac-7d249561629c/msxml.msi"
      dlsize="5289984"
      sysname="msxml.msi"
      installer="$WINE msiexec /i f:\\sys\\msxml.msi"	# /qn ADDLOCAL=MSXML"
      sysinstall
    fi
  }
;;
"MSXML 4.0 Service Pack 2 German")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=3144b72b-b4f2-46da-b4b6-c5d7485f2b42&displaylang=de"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/5/f/d/5fda3c88-bd50-43cf-a845-73614e974e91/msxmlger.msi"
      dlsize="5314560"
      sysname="msxmlger.msi"
      installer="$WINE msiexec /i f:\\sys\\msxmlger.msi"	# /qn ADDLOCAL=MSXML"
      sysinstall
    fi
  }
;;
"MSXML 4.0 Service Pack 2 Italian")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=3144b72b-b4f2-46da-b4b6-c5d7485f2b42&displaylang=it"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/4/8/1/481cb246-adc9-4a9d-95fd-b26b148f42b5/msxmlitn.msi"
      dlsize="5287936"
      sysname="msxmlitn.msi"
      installer="$WINE msiexec /i f:\\sys\\msxmlitn.msi"	# /qn ADDLOCAL=MSXML"
      sysinstall
    fi
  }
;;
"Common Controls 5.0")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=6f94d31a-d1e0-4658-a566-93af0d8d4a1e&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/platformsdk/Comctl32/5.80.2614.3600/W9XNT4/EN-US/50comupd.exe"
    sysname="50comupd.exe"
    dlsize="509984"
    sysinstall
  }
;;
"Visual C++ run-time German")
  URL="http://support.microsoft.com/kb/259403/de"
  showinfo || {
    dload="http://download.microsoft.com/download/vc60pro/update/2/w9xnt4/en-us/vc6redistsetup_deu.exe"
    sysname="vc6redistsetup_deu.exe"
    installer="$WINE vc6redistsetup_deu.exe /T:f:\\sys"
    dlsize="1837888"
    sysinstall
    dload="none"
    sysname="vcredist.exe"
    installer=""
    dlsize="none"
    sysinstall
    rm "$SYSDIR/sys/vcredist.exe"
  }
;;
"Visual C++ run-time English")
  URL="http://support.microsoft.com/default.aspx?scid=kb;en-us;259403"
  showinfo || {
    dload="http://download.microsoft.com/download/vc60pro/update/1/w9xnt4/en-us/vc6redistsetup_enu.exe"
    sysname="vc6redistsetup_enu.exe"
    installer="$WINE vc6redistsetup_enu.exe /T:f:\\sys"
    dlsize="1833232"
    sysinstall
    dload="none"
    sysname="vcredist.exe"
    installer=""
    dlsize="none"
    sysinstall
    rm "$SYSDIR/sys/vcredist.exe"
  }
;;
"Visual Basic 5 Runtime")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=05ae09e6-082a-4cd1-99cd-8911b6034c20&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/vb50pro/utility/1/win98/EN-US/Msvbvm50.exe"
    sysname="Msvbvm50.exe"
    dlsize="992864"
    # Success of Msvbvm50.exe isn't identifiable
    sysinstall "" "--nofail"
  }
;;
"Visual Basic 6 Runtime")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=bf9a24f9-b5c5-48f4-8edd-cdf2d29a79d5&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/vb60pro/Redist/sp5/WIN98Me/EN-US/vbrun60sp5.exe"
    sysname="vbrun60sp5.exe"
    dlsize="1044168"
    sysinstall
  }
;;
"Windows Installer")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=cebbacd8-c094-4255-b702-de3bb768148f&DisplayLang=en"
  showinfo || {
    $DIALOG  --title "*** WARNING ***" --defaultyes --yesno "`eval_gettext "Although it is generally a good idea to install the Windows Installer it could\nbe that some very old installer based installations will fail afterwards.\nContinue anyway?"`" 9 70
    if [ "$?" = "0" ]; then
      dload="http://download.microsoft.com/download/WindowsInstaller/Install/2.0/W9XMe/EN-US/InstMsiA.exe"
      sysname="InstMsiA.exe"
      dlsize="1709160"
      # we have to move Wine's msiexec out of the way during install
      getSystemPath
      if [ -h "$SYSTEM_PATH_LINUX/msiexec.exe" ] ;then
        mv "$SYSTEM_PATH_LINUX/msiexec.exe" "$SYSTEM_PATH_LINUX/msiexec.exe.wine"
      fi
      sysinstall
    fi
  }
;;
"Windows Script 5.6 English")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=0a8a18f6-249c-4a72-bfcf-fc6af26dc390&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/winscript56/Install/5.6/W9XNT4Me/EN-US/scr56en.exe"
    sysname="scr56en.exe"
    dlsize="732768"
    sysinstall
  }
;;
"Windows Script 5.6 German")
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=de&FamilyID=0a8a18f6-249c-4a72-bfcf-fc6af26dc390"
  showinfo || {
    dload="http://download.microsoft.com/download/f/6/5/f655b268-b18b-4e36-b698-b52b766fd5e2/scr56de.exe"
    sysname="scr56de.exe"
    dlsize="695768"
    sysinstall
  }
;;
"Windows Script 5.6 Italian")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=0a8a18f6-249c-4a72-bfcf-fc6af26dc390&DisplayLang=it"
  showinfo || {
    dload="http://download.microsoft.com/download/5/9/3/59366042-b6cb-4b86-8abd-a819e44ed203/scr56it.exe"
    sysname="scr56it.exe"
    dlsize="693720"
    sysinstall
  }
;;
"Windows Script 5.6 Norwegian")
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=no&FamilyID=0a8a18f6-249c-4a72-bfcf-fc6af26dc390"
  showinfo || {
    dload="http://download.microsoft.com/download/c/9/1/c917a569-be4c-4181-bb55-519f75070e19/scr56no.exe"
    sysname="scr56no.exe"
    dlsize="691672"
    sysinstall
  }
;;
esac
systemmenu
;;

1)
    mainmenu
;;
esac
}


#########################
###     Base Setup    ###
#########################
systemsoftware()
{
init

TMP=`mktemp ${TMPDIR:-/tmp}/menu.XXXXXX` || mktemp_error "$?"
$DIALOG -stdout --title "`eval_gettext "Base Setup"`" \
	--cancel-label "`eval_gettext "Main menu"`" \
	--icon $BASEDIR/icon/computer.xpm \
	--check "`eval_gettext "Show Info"`" \
        --menu "`eval_gettext "
This is the point where you have to start with
WineTools. Create a new or update an old fake
Windows drive and go through the other points of
this menu before you continue with installations.
"`" 400x440 0 \
	"`eval_gettext "Create a Fake Windows drive"`" "" \
        "`eval_gettext "Update an old Fake Windows drive"`" "" \
	" " "" \
	"TrueType Font Arial" "" \
        "DCOM98" "" \
	"Microsoft Foundation Classes 4.x" "" \
	" " "" \
	"Internet Explorer 6.0 SP1 Brazilian" "" \
	"Internet Explorer 6.0 SP1 Chinese" "" \
	"Internet Explorer 6.0 SP1 Chinese(tw)" "" \
	"Internet Explorer 6.0 SP1 Dutch" "" \
	"Internet Explorer 6.0 SP1 English" "" \
	"Internet Explorer 6.0 SP1 French" "" \
	"Internet Explorer 6.0 SP1 German" "" \
	"Internet Explorer 6.0 SP1 Italian" "" \
	"Internet Explorer 6.0 SP1 Japanese" "" \
	"Internet Explorer 6.0 SP1 Korean" "" \
	"Internet Explorer 6.0 SP1 Norwegian" "" \
	"Internet Explorer 6.0 SP1 Spanish" "" > $TMP
	
retval=$?

choice=`cat $TMP|grep -v "checked"`
checked="F"
[ "`cat $TMP|grep \"checked\"`" = "checked" ] && checked="T"
rm -f $TMP

case $retval in
0)

echo "`eval_gettext "Choice is $choice with checked=$checked"`"
case "$choice" in
"`eval_gettext "Create a Fake Windows drive"`")
  URL="http://www.von-thadden.de/Joachim/WineTools/"
  showinfo || {
    createdrive NEW
  }
;;
"`eval_gettext "Update an old Fake Windows drive"`")
  URL="http://www.von-thadden.de/Joachim/WineTools/"
  showinfo || {
    createdrive UPDATE
  }
;;
"TrueType Font Arial")
  URL="http://corefonts.sourceforge.net/"
  showinfo || {
    fontname="arial32.exe"
    dlsize="554208"
    fontsinstall
  }
;;
"DCOM98")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=08b1ac1b-7a11-43e8-b59d-0867f9bdda66&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/d/1/3/d13cd456-f0cf-4fb2-a17f-20afc79f8a51/DCOM98.EXE"
    dlsize="1229056"
    sysname="dcom98.exe"
    export WINEDLLOVERRIDES="ole32=n"
    sysinstall
  }
;;
"Microsoft Foundation Classes 4.x")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=08b1ac1b-7a11-43e8-b59d-0867f9bdda66&DisplayLang=en"
  showinfo || {
    dload="http://www.dlldump.com/dllfiles/M/mfc40.dll"
    dlsize="924432"
    sysname="mfc40.dll"
    getSystemPath
    installer="cp mfc40.dll $SYSTEM_PATH_LINUX"
    sysinstall "--noboot"
    dload="http://www.dlldump.com/dllfiles/M/mfc42.dll"
    dlsize="995383"
    sysname="mfc42.dll"
    getSystemPath
    installer="cp mfc42.dll $SYSTEM_PATH_LINUX"
    sysinstall "--noboot"
  }
;;
"Internet Explorer 6.0 SP1 German"|"Internet Explorer 6.0 SP1 English"|"Internet Explorer 6.0 SP1 Brazilian"|"Internet Explorer 6.0 SP1 French"|"Internet Explorer 6.0 SP1 Norwegian"|"Internet Explorer 6.0 SP1 Dutch"|"Internet Explorer 6.0 SP1 Spanish"|"Internet Explorer 6.0 SP1 Italian"|"Internet Explorer 6.0 SP1 Chinese"|"Internet Explorer 6.0 SP1 Chinese(tw)"|"Internet Explorer 6.0 SP1 Japanese"|"Internet Explorer 6.0 SP1 Korean")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=1e1550cb-5e5d-48f5-b02b-20b602228de6&displaylang=en"
  showinfo || {
    needsw dcom98.exe
    needsw mfc40.dll
    if [ "$?" = "0" ]; then
      $DIALOG  --title "`eval_gettext "*** HINT ***"`" --msgbox "`eval_gettext "This is a full automatic installation of almost all\ncomponents of IE6 and Media Player 6.4.\nYou can add additional components\nlater by using the uninstaller."`" 11 70
      # a batch for automatic installation
      cp $BASEDIR/3rdParty/iebatch.txt $SYSDIR/sys
      # wine ie6setup.exe /C:"ie6wzd.exe /M:0 /S:""#e"
      # let the ie setup installing just minimal components
      echo -n "using "
      if [ "$choice" = "Internet Explorer 6.0 SP1 German" ]; then
        echo -n "`eval_gettext "german"`"
        setupdir="Windows Update Setup-Dateien"
        dlsize="496888"
        dl_locale="DE"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 English" ]; then
        echo -n "`eval_gettext "english"`"
        setupdir="Windows Update Setup Files"
        dlsize="491768"
        dl_locale="EN-US"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Italian" ]; then
        echo -n "`eval_gettext "italian"`"
        setupdir="File di installazione di Windows Update"
        dlsize="494328"
        dl_locale="IT"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Brazilian" ]; then
        echo -n "`eval_gettext "brazilian portuguese"`"
        setupdir="Configura�o dos Arquivos de Atualiza�o do Windows"
        dlsize="494328"
        dl_locale="PT-BR"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Spanish" ]; then
        echo -n "`eval_gettext "spanish"`"
        setupdir="Windows Update Setup Files"
        dlsize="494840"
        dl_locale="ES"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 French" ]; then
        echo -n "`eval_gettext "french"`"
        setupdir="Fichiers d'installation de Windows Update"
        dlsize="496376"
        dl_locale="FR"
        $DIALOG   --title "`eval_gettext "Hint"`" \
                  --no-cancel \
                  --msgbox "`eval_gettext "Note that Winetools will always say that the installation\nof French IE has failed even if it was successfull."`" 7 60
      fi	
      if [ "$choice" = "Internet Explorer 6.0 SP1 Norwegian" ]; then
        echo -n "`eval_gettext "norwegian"`"
        setupdir="Installasjonsfiler for Windows Update"
        dlsize="491768"
        dl_locale="NO"
        $DIALOG   --title "`eval_gettext "Hint"`" \
                  --no-cancel \
                  --msgbox "`eval_gettext "Note that Winetools will always say that the installation\nof Norwegian IE has failed even if it was successfull."`" 7 60
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Dutch" ]; then
        echo -n "`eval_gettext "dutsch"`"
        setupdir="Windows Update Setup-bestanden"
        dlsize="494328"
        dl_locale="NL"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Chinese" ]; then
        echo -n "`eval_gettext "chinese"`"
        setupdir="Windows Update Setup Files"
        dlsize="484088"
        dl_locale="CN"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Chinese(tw)" ]; then
        echo -n "`eval_gettext "chinese(tw)"`"
        setupdir="Windows Update Setup Files"
        dlsize="484088"
        dl_locale="TW"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Japanese" ]; then
        echo -n "`eval_gettext "japanese"`"
        setupdir="Windows update Setup Files"
        dlsize="488696"
        dl_locale="JA"
      fi
      if [ "$choice" = "Internet Explorer 6.0 SP1 Korean" ]; then
        echo -n "`eval_gettext "korean"`"
        setupdir="Windows update Setup Files"
        dlsize="486136"
        dl_locale="KO"
      fi
      echo "`eval_gettext " setup..."`"
      dload="http://download.microsoft.com/download/ie6sp1/finrel/6_sp1/W98NT42KMeXP/${dl_locale}/ie6setup.exe"
      if [ -s "$SYSDIR/sys/${setupdir}" ] && [ ! -e "$WINEDIR/c/windows/${setupdir}" ]; then
        cp -a "$SYSDIR/sys/${setupdir}" "$WINEDIR/c/windows"
        ln -s "$WINEDIR/c/windows/${setupdir}" "$WINEDIR/c/${setupdir}"
      fi
      sysname="ie6setup.exe"
      testname="Microsoft Internet Explorer.*"
      script="ie6 outlookexpress wmplayer"
      # we still need a special tuned config for IE6 installation
      # we have to move regsvr out of the way during install
      getSystemPath
      mv "$SYSTEM_PATH_LINUX/regsvr32.exe" "$SYSTEM_PATH_LINUX/regsvr32.exe.wine"
      sysinstall "--noboot"
      failed="$?"
      echo "`eval_gettext "Failed: $failed"`"
      # hack for French and Norwegian IE: can't detect success
      if [ "$failed" = "0" -o "$dl_locale" = "FR" -o "$dl_locale" = "NO" ]; then
        echo "`eval_gettext "installing new registry..."`"
        waitforwineexit
        # at least we disable this annoying Internet Connection Wizzard and make IE6 work!
        $WINE regedit $BASEDIR/3rdParty/ie6.reg
        wineboot
      fi
      # and we have to move regsvr back after the install
      mv "$SYSTEM_PATH_LINUX/regsvr32.exe" "$SYSTEM_PATH_LINUX/regsvr32.exe.win"
      mv "$SYSTEM_PATH_LINUX/regsvr32.exe.wine" "$SYSTEM_PATH_LINUX/regsvr32.exe"
      sizewt="`du -s \"$SYSDIR/sys/${setupdir}\"|cut -d\	 -f1`" 2>/dev/null
      sizewine="`du -s \"$WINEDIR/c/windows/${setupdir}\"|cut -d\	 -f1`"
      [ "$sizewt" = "" ] && sizewt=0
      [ "$sizewine" = "" ] && sizewine=0
      echo "`eval_gettext "Downloaded IE6-Files=$sizewine"`"
      echo "`eval_gettext "Winetools  IE6-Files=$sizewt"`"
      if [ $sizewt -lt $sizewine ]; then
        $DIALOG  --title "`eval_gettext "*** Copy downloaded files ***"`" --defaultno --yesno "`eval_gettext "Do you want to save the downloaded files for later?"`" 7 60
        [ "$?" = "0" ] && cp -a "$WINEDIR/c/windows/${setupdir}" "$SYSDIR/sys"
      fi
    fi
  }
;;
*)
  systemsoftware
;;
esac
systemsoftware
;;

1)
    mainmenu
;;
esac
}


#########################
###  Additional Soft  ###
#########################
additionalsoftware()
{
init
needsw "\*new\* fake Windows drive" "--no-cancel"
needsw "dcom98.exe" "--no-cancel"
needsw "Microsoft Internet Explorer.*" "--no-cancel"

TMP=`mktemp ${TMPDIR:-/tmp}/menu.XXXXXX` || mktemp_error "$?"

$DIALOG -stdout --title "`eval_gettext "Additional Software"`" \
	--cancel-label "`eval_gettext "Main menu"`" \
	--check "`eval_gettext "Show Info"`" \
	--item-help \
	--icon $BASEDIR/icon/apps.xpm \
        --treeview \ "`eval_gettext "
This software is known to work with Wine.
Select one to install and press OK. If you
hover with your mouse over an item a tooltip
will be displayed. To get more informations
check \"Show Info\" and press OK.
"`" 400x480 0 \
	"1" "Office" "" "1" "`eval_gettext "."`" \
	  "Excel Viewer 97 English" "Excel Viewer 97 English" "" "2" "`eval_gettext "."`" \
	  "Excel Viewer 97 German" "Excel Viewer 97 German" "" "2" "`eval_gettext "."`" \
	  "Excel Viewer 97 French" "Excel Viewer 97 French" "" "2" "`eval_gettext "."`" \
	  "InfoRapid KnowledgeMap 2005 German" "InfoRapid KnowledgeMap 2005 German" "" "2" "`eval_gettext "a knowledge map creator in german | Alternative: freemind | License: free for non-commercial use"`" \
	  "Microsoft Office 95" "Microsoft Office 95" "" "2" "`eval_gettext "Alternative: OpenOffice.org"`" \
	  "Microsoft Office 97" "Microsoft Office 97" "" "2" "`eval_gettext "Alternative: OpenOffice.org"`" \
	  "Microsoft Office 2000" "Microsoft Office 2000" "" "2" "`eval_gettext "Alternative: OpenOffice.org"`" \
	  "Powerpoint Viewer 97 English" "Powerpoint Viewer 97 English" "" "2" "`eval_gettext "."`" \
	  "Powerpoint Viewer 97 German" "Powerpoint Viewer 97 German" "" "2" "`eval_gettext "."`" \
	  "Powerpoint Viewer 2003 English" "Powerpoint Viewer 2003 English" "" "2" "`eval_gettext "."`" \
	  "Powerpoint Viewer 2003 German" "Powerpoint Viewer 2003 German" "" "2" "`eval_gettext "."`" \
	  "Powerpoint Viewer 2003 Italian" "Powerpoint Viewer 2003 Italian" "" "2" "`eval_gettext "."`" \
	  "Powerpoint Viewer 2003 Norwegian" "Powerpoint Viewer 2003 Norwegian" "" "2" "`eval_gettext "."`" \
	  "Scribble Papers" "Scribble Papers" "" "2" "`eval_gettext "handy tool for quick notes or as memory hook | License: freeware"`" \
	  "Word Viewer 97 English" "Word Viewer 97 English" "" "2" "`eval_gettext "."`" \
	  "Word Viewer 97 German" "Word Viewer 97 German" "" "2" "`eval_gettext "."`" \
	"2" "Business" "" "1" "`eval_gettext "."`" \
	  "ElsterFormular 2004-2005 German" "ElsterFormular 2004-2005 German" "" "2" "`eval_gettext "german paperless tax form software | License: freeware?"`" \
	  "StarMoney 5.0 German Homebanking" "StarMoney 5.0 German Homebanking" "" "2" "`eval_gettext "german homebanking software"`" \
	"3" "School Software" "" "1" "`eval_gettext "."`" \
	  "KLV 4 (german)" "KLV 4 (german)" "" "2" "`eval_gettext "Programm for school reports und class adminstration | License: shareware"`" \
	"3" "Science" "" "1" "`eval_gettext "."`" \
	  "BioEdit" "BioEdit" "" "2" "`eval_gettext "biological sequence alignment editor | License: freeware"`" \
	"4" "Edutainment" "" "1" "`eval_gettext "."`" \
	  "Encarta 99" "Encarta 99" "" "2" "`eval_gettext "Microsoft's multimedia encyclopedia, commercial | Alternative: www.wikipedia.org"`" \
	  "InfoRapid Internet-Zeitungsleser German" "InfoRapid Internet-Zeitungsleser German" "" "2" "`eval_gettext "Internet newspaper reader | License: freeware"`" \
	  "OpenSong 0.9.9." "OpenSong 0.9.9." "" "2" "`eval_gettext "OpenSong is a free, open-source software application created to manage lyrics, chords, lead sheets, overheads, computer projection, and more | License: open source software"`" \
	"5" "Games" "" "1" "`eval_gettext "give me input and I place them here!"`" \
	  "Future Pinball" "Future Pinball" "" "2" "`eval_gettext "real time Pinball Development System | License: free to use"`" \
	  "PowBallDX" "PowBallDX" "" "2" "`eval_gettext "little breakout game | License: freeware"`" \
	  "Steam" "Steam" "" "2" "`eval_gettext "Steam delivers Valve's games to your desktop and connects you to a massive gaming community"`" \
	"6" "Graphics" "" "1" "`eval_gettext "."`" \
	  "Adobe Photoshop 7.0" "Adobe Photoshop 7.0" "" "2" "`eval_gettext "image manipulation software, commercial | Alternative: The Gimp!"`" \
	  "Adobe Illustrator 9.0" "Adobe Illustrator 9.0" "" "2" "`eval_gettext "vector graphics software, commercial; look at www.linuxartist.org for alternatives | Alternative: OpenOffice.org's Impress or JFDraw"`" \
	  "ArtRage 1.1" "ArtRage 1.1" "" "2" "`eval_gettext "very creative drawing program | License: freeware"`" \
	  "FontPage" "FontPage" "" "2" "`eval_gettext "litte font lister | License: freeware"`" \
	  "GoogleEarth" "GoogleEarth" "" "2" "`eval_gettext "a 3D interface to the planet | License: free for personal use"`" \
	  "IrfanView 3.95" "IrfanView 3.95" "" "2" "`eval_gettext "very nice multimedia viewer and basic editing software | License: freeware"`" \
	  "NeatImage" "NeatImage" "" "2" "`eval_gettext "digital filter designed to reduce visible noise and grain in digital photographic images | License: shareware demo"`" \
	  "PhotoFiltre 6.1" "PhotoFiltre 6.1" "" "2" "`eval_gettext "complete image retouching program with many filters (>100) | License: freeware, but commercial and professional use is not authorized!"`" \
	  "Picasa2" "Picasa2" "" "2" "`eval_gettext "famous picture viewer and organizer | License: freeware"`" \
	  "Qimage" "Qimage" "" "2" "`eval_gettext "digital photo printing software | License: shareware"`" \
	  "Scrutico" "Scrutico" "" "2" "`eval_gettext "scan directories and extract all icons present in form of files (ICO) or of resources (EXE, DLL, ICL), in french but good understandable | License: freeware"`" \
	  "Typograf 4 Fontmanagement English" "Typograf 4 Fontmanagement English" "" "2" "`eval_gettext "fontmanager | License: shareware"`" \
	  "Typograf 4 Fontmanagement German" "Typograf 4 Fontmanagement German" "" "2" "`eval_gettext "fontmanager | License: shareware"`" \
	  "Ultimate Paint 1.91f" "Ultimate Paint 1.91f" "" "2" "`eval_gettext "nice image manipulation software with many effect filters | License: freeware"`" \
	"7" "Multimedia" "" "1" "`eval_gettext "."`" \
	  "DVD Shrink 3.2" "DVD Shrink 3.2" "" "2" "`eval_gettext "DVD copy software | License: freeware"`" \
	  "Noise Ninja" "Noise Ninja" "" "2" "`eval_gettext "removing noise and grain from digital photographs and scanned film images | License: freeware"`" \
	  "VirtualDub 1.6.1" "VirtualDub 1.6.1" "" "2" "`eval_gettext "video editing software | License: freeware"`" \
	"8" "Player" "" "1" "`eval_gettext "."`" \
	  "Acrobat Reader 6.0 English" "Acrobat Reader 6.0 English" "" "2" "`eval_gettext "PDF viewer | License: freeware | Alternative: xpdf or gv"`" \
	  "Acrobat Reader 6.0 German" "Acrobat Reader 6.0 German" "" "2" "`eval_gettext "PDF viewer | License: freeware | Alternative: xpdf or gv"`" \
	  "Acrobat Reader 6.0 Italian" "Acrobat Reader 6.0 Italian" "" "2" "`eval_gettext "PDF viewer | License: freeware | Alternative: xpdf or gv"`" \
	  "Acrobat Reader 6.0 Norwegian" "Acrobat Reader 6.0 Norwegian" "" "2" "`eval_gettext "PDF viewer | License: freeware | Alternative: xpdf or gv"`" \
	  "Acrobat Reader 6.0 Spanish" "Acrobat Reader 6.0 Spanish" "" "2" "`eval_gettext "PDF viewer | License: freeware | Alternative: xpdf or gv"`" \
	  "CoolPlayer" "CoolPlayer" "" "2" "`eval_gettext "sound player | License: open source software | Alternative: XMMS"`" \
	  "foobar2000" "foobar2000" "" "2" "`eval_gettext "advanced audio player"`" \
	  "IRon" "IRon" "" "2" "`eval_gettext "german online radio station listener | License: freeware | Alternative: StreamTuner"`" \
	  "Macromedia Flash Player Plugin for IE6" "Macromedia Flash Player Plugin for IE6" "" "2" "`eval_gettext "."`" \
	  "Macromedia Shockwave Player Plugin for IE6" "Macromedia Shockwave Player Plugin for IE6" "" "2" "`eval_gettext "."`" \
	  "QuickTime Player 6.5.2 English" "QuickTime Player 6.5.2 English" "" "2" "`eval_gettext "player for Apples QuickTime-Format | License: freeware | Alternative: XINE"`" \
	  "QuickTime Player 6.5.2 Norwegian" "QuickTime Player 6.5.2 Norwegian" "" "2" "`eval_gettext "player for Apples QuickTime-Format | License: freeware | Alternative: XINE"`" \
	  "QuickTime Player 5.0" "QuickTime Player 5.0" "" "2" "`eval_gettext "player for Apples QuickTime-Format | License: freeware | Alternative: XINE"`" \
	  "RealPlayer 10 German" "RealPlayer 10 German" "" "2" "`eval_gettext "player for RealMedia-Format | License: freeware | Alternative: HelixPlayer or XINE"`" \
	  "WinAmp 5 incl. Streamripper" "WinAmp 5 incl. Streamripper" "" "2" "`eval_gettext "multimedia player | License: freeware | Alternative: XMMS and StreamRipper"`" \
	"9" "File Tools" "" "1" "`eval_gettext "."`" \
	  "7-Zip" "7-Zip" "" "2" "`eval_gettext "file archiver with high compression ratio | License: open source software"`" \
	  "Total Commander 6.03a" "Total Commander 6.03a" "" "2" "`eval_gettext "a good file commander | License: shareware"`" \
	  "UltimateZip" "UltimateZip" "" "2" "`eval_gettext "a program for file compression, even better than WinZip | License: freeware"`" \
	  "WinZip 9.0 English" "WinZip 9.0 English" "" "2" "`eval_gettext "a program for file compression | License: shareware"`" \
	  "WinZip 9.0 German" "WinZip 9.0 German" "" "2" "`eval_gettext "a program for file compression | License: shareware"`" \
	"10" "Communication" "" "1" "`eval_gettext "."`" \
	  "Awasu 2.1 Personal Edition" "Awasu 2.1 Personal Edition" "" "2" "`eval_gettext "news feed reader | License: freeware | Alterative: rssowl"`" \
	  "Bottler XDCC Bot Interface" "Bottler XDCC Bot Interface" "" "2" "`eval_gettext "a net news file download robot | License: open source software"`" \
	  "DC++" "DC++" "" "2" "`eval_gettext "DC++ is an open source client for the Direct Connect protocol | License: open source software"`" \
	  "Eudora 6.2" "Eudora 6.2" "" "2" "`eval_gettext "a mail client | License: shareware | Alternative: one of the 10 million native Linux mailer"`" \
	  "Firefox 1.0.7" "Firefox 1.0.7" "" "2" "`eval_gettext "a browser | License: open source software | Alternative: this is the alternative ;-)"`" \
	  "Fort� Agent Newsreader 2.0" "Fort� Agent Newsreader 2.0" "" "2" "`eval_gettext "news reader | License: shareware | Alternative: Mozilla"`" \
	  "Google Toolbar 3 for IE6" "Google Toolbar 3 for IE6" "" "2" "`eval_gettext "Toolbar for IE6 to use Google functions | License: freeware | Alternative: Firefox with Googlebar"`" \
	  "GrabIt 1.4.7" "GrabIt 1.4.7" "" "2" "`eval_gettext "search the usenet | License: freeware"`" \
	  "Lauge 2.06 German" "Lauge 2.06 German" "" "2" "`eval_gettext "very nice eBay browser | License: freeware"`" \
	  "MailWasher Pro International Version" "MailWasher Pro International Version" "" "2" "`eval_gettext "deletes spam, viruses and unwanted emails right at the mail server | License: shareware"`" \
	  "Miranda IM" "Miranda IM" "" "2" "`eval_gettext "multi protocol instant messenger client with more than 300 plugins | License: freeware | Alternative: gaim"`" \
	  "mIRC 6.16" "mIRC 6.16" "" "2" "`eval_gettext "inter relay chat program | License: freeware | Alternative: xchat"`" \
	  "Phoner 1.78" "Phoner 1.78" "" "2" "`eval_gettext "SIP/ISDN VoIP SoftPhone | License: freeware | Alternative: kphone"`" \
	  "putty 0.58" "putty 0.58" "" "2" "`eval_gettext "telnet and secure shell client | License: freeware | Alternative: telnet and ssh"`" \
	  "Skype 1.1" "Skype 1.1" "" "2" "`eval_gettext "VoIP SoftPhone for the Skype protocoll | License: freeware | Alternative: Skype for Linux"`" \
	  "The Bat! 3.01 Professional" "The Bat! 3.01 Professional" "" "2" "`eval_gettext "a mail client | License: shareware | Alternative: one of the 10 million native Linux mailer"`" \
	  "X-Lite v2.0 Build 1105m English" "X-Lite v2.0 Build 1105m English" "" "2" "`eval_gettext "SIP VoIP SoftPhone | License: freeware | Alternative: kphone"`" \
	"11" "Database" "" "1" "`eval_gettext "."`" \
	  "Borland Database Engine (BDE) 5.1.1 English" "Borland Database Engine (BDE) 5.1.1 English" "" "2" "`eval_gettext "."`" \
	  "DBCrab 1.50 German with BDE 5.1.1 German" "DBCrab 1.50 German with BDE 5.1.1 German" "" "2" "`eval_gettext "little database editor with the Borland Database Engine | License: freeware, but not for commercial usage!"`" \
	  "PostgreSQL ODBC driver psqlODBC 8.00.0101" "PostgreSQL ODBC driver psqlODBC 8.00.0101" "" "2" "`eval_gettext "."`" \
	"12" "Tools" "" "1" "`eval_gettext "."`" \
	  "Dependency Walker" "Dependency Walker" "" "2" "`eval_gettext "shows library dependencies of executables, very handy for debugging with Wine programs | License: freeware"`" \
	  "Mozilla ActiveX Control" "Mozilla ActiveX Control" "" "2" "`eval_gettext "a replacement for the IE embedded | License: open source software | Alternative: this is the alternative ;-)"`" \
	  "SLD Codec Pack 1.5.3" "SLD Codec Pack 1.5.3" "" "2" "`eval_gettext "some more codecs for the media player"`" \
	  "Splash Screen Killer" "Splash Screen Killer" "" "2" "`eval_gettext "suppress splash screens that are annoying or in the way | License: freeware"`" \
	  "Xpdf 3.01" "Xpdf 3.01" "" "2" "`eval_gettext "some pdf conversion tools | License: open source software"`" \
	"13" "Misc" "" "1" "`eval_gettext "."`" \
	  "TVgenial" "TVgenial" "" "2" "`eval_gettext "german TV program guide | License: freeware | Alternative: www.tvtv.de"`" \
	> $TMP

#	  "Ultimate Paint LE" "Ultimate Paint LE" "" "2" "`eval_gettext "nice image manipulation software with not so many effect filters, but niftier interface | License: shareware"`" \
#	  "WinAmp 2 incl. Streamripper" "WinAmp 2 incl. Streamripper" "" "2" "`eval_gettext "multimedia player, older interface but faster ripping | License: freeware | Alternative: XMMS and StreamRipper"`" \
#	  "X-Lite v2.0 Build 1103m German" "X-Lite v2.0 Build 1103m German" "" "2" "`eval_gettext "SIP VoIP SoftPhone | License: freeware | Alternative: kphone"`" \
#	  "WinRAR 3.41 English" "WinRAR 3.41 English" "" "2" "`eval_gettext "a program for file compression | License: shareware"`" \
#	  "WinRAR 3.41 German" "WinRAR 3.41 German" "" "2" "`eval_gettext "a program for file compression | License: shareware"`" \
#'
retval=$?

choice=`cat $TMP|grep -v "checked"`
checked="F"
[ "`cat $TMP|grep \"checked\"`" = "checked" ] && checked="T"
rm -f $TMP

case $retval in
0)

echo "`eval_gettext "Choice is $choice"`"
case "$choice" in
"Splash Screen Killer")
  URL="http://www.digitallis.co.uk/pc/SplashKiller/index.html"
  showinfo || {
    mkdir "$WINEDIR/c/Programme/SplashKiller"
    dload="http://www.digitallis.co.uk/pc/downloads/SplashKiller.zip"
    dlsize="32224"
    sysname="SplashKiller.zip"
    installer="unzip -o SplashKiller.zip -d $WINEDIR/c/Programme/SplashKiller"
    script="splashkiller"
    sysinstall
  }
;;
"Microsoft Office 95"|"Microsoft Office 97"|"Microsoft Office 2000")
  URL="http://www.openoffice.org"
  showinfo || {
    if [ "$choice" = "Microsoft Office 2000" ]; then
      $DIALOG --title "`eval_gettext "Hint"`" \
	      --no-cancel \
	      --msgbox "`eval_gettext "If you are asked for, select drive D: for installation.\nNever install Office-Tools/Office-Assistents. They\nmight shredder your setup. During the first start of\nOutlook you should not decide\nto install Symantec Fax\nbecause it does no work."`" 12 60
      script="winword msword excel msexcel msaccess powerpoint mspowerpoint outlook msoutlook outlook.executor msfinder msquery msbinder"
    fi
    if [ "$choice" = "Microsoft Office 97" ]; then
      needsw "SplashKiller.zip" "--no-cancel"
      $DIALOG --title "`eval_gettext "Hint"`" \
	      --no-cancel \
	      --msgbox "`eval_gettext "During the first start of Word it complains about a broken\ninstall. Ignore it, cancel it and start it again. Also\nmsoutlook and msaccess might not work."`" 12 70
      script="winword msword excel msexcel msaccess powerpoint mspowerpoint outlook msoutlook outlook.executor msfinder msquery msbinder"
    fi
    if [ "$choice" = "Microsoft Office 95" ]; then
      needsw "SplashKiller.zip" "--no-cancel"
      $DIALOG --title "`eval_gettext "Hint"`" \
	      --no-cancel \
	      --msgbox "`eval_gettext "The installer will tell you at the end that the\ninstallation failed, but it did not!"`" 9 60
      script="msword95 msexcel95 msaccess95 mspowerpoint95 msschedule95 msbinder95"
    fi
    dload="none"
    dlsize=""
    sysname="$choice"
#    installer="$WINE d:\\setup.exe"
    installer="***SEARCH***"
    if [ "$choice" = "Microsoft Office 95" ]; then
      testname="Microsoft Office.*"
    else
      testname="${choice}.*"
    fi
    sysinstallsw
    if [ "$failed" = "0" ]; then
      if [ "$choice" = "Microsoft Office 97" ]; then
        echo "creating an empty WINEDIR/drive_c/windows/system32/MAPISVC.INF file"
        SYSTEM_PATH_LINUX=$?
        mv "$SYSTEM_PATH_LINUX/regsvr32.exe" "$SYSTEM_PATH_LINUX/regsvr32.exe.wine"
        touch "$SYSTEM_PATH_LINUX/MAPISVC.INF"
      fi
    fi
  }
;;
"Google Toolbar 3 for IE6")
  URL="http://toolbar.google.com/T3/index"
  showinfo || {
    dload="http://toolbar.google.com/T3/data/en/deleon/current/GoogleToolbarInstaller.exe"
    dlsize="705696"
    sysname="GoogleToolbarInstaller.exe"
    testname="Google Toolbar for Internet Explorer"
    script=""
    sysinstall
  }
;;
"Macromedia Flash Player Plugin for IE6")
  URL="http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
  showinfo || {
    $DIALOG   --title "`eval_gettext "Hint"`" \
              --no-cancel \
              --msgbox "`eval_gettext "This will also install the Yahoo-Toobar. The included popup blocker\nwill inhibit IE6 to open any windows. You probably want\nto disable this feature via the Yahoo-Toolbar settings."`" 9 60
    $WINE c:\\Program\ Files\\Internet\ Explorer\\IEXPLORE.EXE "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"
    wineboot
    rm -rf "$WINEDIR/c/windows/system32/Macromed/Download"
    testsw "Shockwave Flash"
    [ "$?" != "0" ] && $DIALOG --title "`eval_gettext "wine status"`" \
		               --no-cancel \
			       --msgbox "`eval_gettext "It seems that the installation has failed."`" 7 70
  }
;;
"Macromedia Shockwave Player Plugin for IE6")
  URL="http://sdc.shockwave.com/shockwave/download/download.cgi?"
  showinfo || {
    $WINE c:\\Program\ Files\\Internet\ Explorer\\IEXPLORE.EXE "http://sdc.shockwave.com/shockwave/download/download.cgi?"
    wineboot
    testsw "Macromedia Shockwave Player"
    [ "$?" != "0" ] && $DIALOG --title "`eval_gettext "wine status"`" \
		               --no-cancel \
			       --msgbox "`eval_gettext "It seems that the installation has failed."`" 7 70
  }
;;
"Word Viewer 97 English")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=0e56d944-38f6-4eb5-aca6-8bd280d5e6b1&displaylang=en"
  showinfo || {
    dload="http://www.nottinghamcity.gov.uk/downloads/wd97vwr32.exe"
    dlsize="3953640"
    sysname="wd97vwr32.exe"
    testname="Microsoft Word Viewer 97"
    script="winword wordview97"
    sysinstall
  }
;;
"Word Viewer 97 German")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=0e56d944-38f6-4eb5-aca6-8bd280d5e6b1&displaylang=de"
  showinfo || {
    dload="http://download.microsoft.com/download/word97win/wd97vwr/97/WIN98/DE/wd97vwr32.exe"
    dlsize="4364456"
    sysname="wd97vwr32.exe"
    testname="Microsoft Word Viewer 97"
    script="winword wordview97"
    sysinstall
  }
;;
"Excel Viewer 97 English")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyId=C8378BF4-996C-4569-B547-75EDBD03AAF0&displaylang=en"
  showinfo || {
    dload="http://www.nottinghamcity.gov.uk/downloads/xlViewer.exe"
    dlsize="3905464"
    sysname="xlViewer.exe"
    testname="Microsoft Excel Viewer 97"
    script="excel excelview97"
    sysinstall
  }
;;
"Excel Viewer 97 German")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyId=C8378BF4-996C-4569-B547-75EDBD03AAF0&displaylang=de"
  showinfo || {
    dload="http://download.microsoft.com/download/excel97win/xlviewer/1/WIN98/DE/xlviewer.exe"
    dlsize="3895976"
    sysname="xlViewer.exe"
    testname="Microsoft Excel Viewer 97"
    script="excel excelview97"
    sysinstall
  }
;;
"Excel Viewer 97 French")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyId=C8378BF4-996C-4569-B547-75EDBD03AAF0&displaylang=fr"
  showinfo || {
    dload="http://download.microsoft.com/download/excel97win/xlviewer/1/WIN98/FR/xlviewer.exe"
    dlsize="3959896"
    sysname="xlViewer.exe"
    testname="Microsoft Excel Viewer 97"
    script="excel excelview2003"
    sysinstall
  }
;;
"Powerpoint Viewer 97 English")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=7c404e8e-5513-46c4-aa4f-058a84a37df1&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/c/2/f/c2fd9ca4-4505-453b-84b6-5839b7baffd3/PPView97.exe"
    dlsize="2855552"
    sysname="PPView97.exe"
    testname="Microsoft PowerPoint Viewer 97"
    script="powerpoint ppointview97"
    sysinstall
  }
;;
"Powerpoint Viewer 97 German")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=7c404e8e-5513-46c4-aa4f-058a84a37df1&DisplayLang=de"
  showinfo || {
    dload="http://download.microsoft.com/download/powerpoint2000/ppview97/2000/WIN98/DE/PPView97.exe"
    dlsize="2838704"
    sysname="PPView97.exe"
    testname="Microsoft PowerPoint Viewer 97"
    script="powerpoint ppointview97"
    sysinstall
  }
;;
"Powerpoint Viewer 2003 English")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=428d5727-43ab-4f24-90b7-a94784af71a4&DisplayLang=en"
  showinfo || {
    dload="http://download.microsoft.com/download/a/1/a/a1adc39b-9827-4c7a-890b-91396aed2b86/ppviewer.exe"
    dlsize="1951432"
    sysname="ppviewer.exe"
    testname="Microsoft Office PowerPoint Viewer 2003"
    script="powerpoint ppointview2003"
    sysinstall
  }
;;
"Powerpoint Viewer 2003 German")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=428d5727-43ab-4f24-90b7-a94784af71a4&DisplayLang=de"
  showinfo || {
    dload="http://download.microsoft.com/download/f/e/2/fe23f2ca-19b8-4d4b-8275-35ec02699c8f/ppviewer.exe"
    dlsize="1949384"
    sysname="ppviewer.exe"
    testname="Microsoft Office PowerPoint Viewer 2003"
    script="powerpoint ppointview2003"
    sysinstall
  }
;;
"Powerpoint Viewer 2003 Italian")
  URL="http://www.microsoft.com/downloads/details.aspx?FamilyID=428d5727-43ab-4f24-90b7-a94784af71a4&DisplayLang=it"
  showinfo || {
    dload="http://download.microsoft.com/download/2/0/b/20b272be-4fc0-445d-9cd5-4225200f18a2/PPVIEWER.EXE"
    dlsize="1953992"
    sysname="PPVIEWER.EXE"
    testname="Microsoft Office PowerPoint - Visualizzatore 2003"
    script="powerpoint ppointview2003"
    sysinstall
  }
;;
"Powerpoint Viewer 2003 Norwegian")
  URL="http://www.microsoft.com/downloads/details.aspx?displaylang=no&FamilyID=428d5727-43ab-4f24-90b7-a94784af71a4"
  showinfo || {
    dload="http://download.microsoft.com/download/c/6/9/c69c5c64-50f1-4c77-8108-fc2bdf0b16cd/PPVIEWER.EXE"
    dlsize="1952456"
    sysname="PPVIEWER.EXE"
    testname="Microsoft Office PowerPoint Viewer 2003"
    script="powerpoint ppointview2003"
    sysinstall
  }
;;
"ElsterFormular 2004-2005 German")
  URL="https://www.elster.de/elfo_home.php"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      needsw "Jet40SP8_9xNT.exe"
      if [ "$?" = "0" ]; then
# Seems to change often. Currently (2005-10-21) HTTPS is not working correct.
#        dload="https://a248.e.akamai.net/f/248/13616/6h/oberfinanz.download.akamai.com/13616/download/2004/ElsterFormular2004.exe"
        dload="http://a248.e.akamai.net/f/248/13616/6h/oberfinanz.download.akamai.com/13616/download/2004/ElsterFormular2004-Setup.exe"
        dlsize="16278528"
        sysname="ElsterFormular2004-Setup.exe"
        testname="ElsterFormular 2004/2005"
        script="elster04"
        sysinstall
      fi
    fi
  }
;;
"StarMoney 5.0 German Homebanking")
  URL="http://www.starfinanz.de"
  showinfo || {
    needsw "MDAC_TYP.EXE"
    if [ "$?" = "0" ]; then
      needsw "Jet40SP8_9xNT.exe"
      if [ "$?" = "0" ]; then
        needsw "InstMsiA.exe"
        if [ "$?" = "0" ]; then
          # needs either English or German msxml
          testsw "msxml.msi"
          RET=$?
          if [ "$RET" != "0" ]; then
            needsw "msxmlger.msi"
            RET=$?
          fi
          if [ "$RET" = "0" ]; then
            dload="http://www.starmoney.de/download/smoney50web-lx/smoney50web.exe"
            dlsize="31419392"
            sysname="smoney50web.exe"
            testname="StarMoney 5.0 Full&Free"
            script="smoney50"
            # setup checks existance of wsock32.dll, so touch one
            getSystemPath
            touch $SYSTEM_PATH_LINUX/wsock32.dll
            sysinstall
            if [ ! -s $SYSTEM_PATH_LINUX/wsock32.dll ]; then
              rm $SYSTEM_PATH_LINUX/wsock32.dll
            fi
          fi
        fi
      fi
    fi
  }
;;
"Encarta 99")
  URL="http://www.wikipedia.org"
  showinfo || {
    dload="none"
    dlsize=""
    sysname=""
#    installer="$WINE d:\\setup.exe"
    installer="***SEARCH***"
    testname="Microsoft Encarta 99.*"
    script="encarta"
    sysinstallsw
  }
;;
"Acrobat Reader 6.0 English")
  URL="http://www.adobe.com/products/acrobat/reader_archive.html#Win"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
      dload="http://ardownload.adobe.com/pub/adobe/reader/win/6.x/6.0/enu/AdbeRdr60_enu_full.exe"
      dlsize="16706160"
      sysname="AdbeRdr60_enu_full.exe"
      testname="Adobe Reader 6.0.1.*"
      script="acro6"
      sysinstall
      [ "$failed" = "0" ] && $DIALOG --title "`eval_gettext "Hint"`" \
          --no-cancel \
          --msgbox "`eval_gettext "During the first start of the reader the splash screen will not\ndisappear. If this happens just type Enter and it will close."`" 7 60
    fi
  }
;;
"Acrobat Reader 6.0 German")
  URL="http://www.adobe.com/products/acrobat/reader_archive.html#Win"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
      dload="http://ardownload.adobe.com/pub/adobe/reader/win/6.x/6.0/deu/AdbeRdr60_deu_full.exe"
      dlsize="18676216"
      sysname="AdbeRdr60_deu_full.exe"
      testname="Adobe Reader 6.0.1.*"
      script="acro6"
      sysinstall
      [ "$failed" = "0" ] && $DIALOG --title "`eval_gettext "Hint"`" \
        --no-cancel \
        --msgbox "`eval_gettext "During the first start of the reader the splash screen will not\ndisappear. If this happens just type Enter and it will close."`" 7 60
    fi
  }
;;
"Acrobat Reader 6.0 Italian")
  URL="http://www.adobe.com/products/acrobat/reader_archive.html#Win"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
      dload="http://ardownload.adobe.com/pub/adobe/reader/win/6.x/6.0/ita/AdbeRdr60_ita_full.exe"
      dlsize="18500328"
      sysname="AdbeRdr60_ita_full.exe"
      testname="Adobe Reader 6.0.1.*"
      script="acro6"
      sysinstall
      [ "$failed" = "0" ] && $DIALOG --title "`eval_gettext "Hint"`" \
          --no-cancel \
          --msgbox "`eval_gettext "During the first start of the reader the splash screen will not\ndisappear. If this happens just type Enter and it will close."`" 7 60
    fi
  }
;;
"Acrobat Reader 6.0 Spanish")
  URL="http://www.adobe.com/products/acrobat/reader_archive.html#Win"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
      dload="http://ardownload.adobe.com/pub/adobe/reader/win/6.x/6.0/esp/AdbeRdr60_esp_full.exe"
      dlsize="18584448"
      sysname="AdbeRdr60_esp_full.exe"
      testname="Adobe Reader 6.0.1.*"
      script="acro6"
      sysinstall
      [ "$failed" = "0" ] && $DIALOG --title "`eval_gettext "Hint"`" \
        --no-cancel \
        --msgbox "`eval_gettext "During the first start of the reader the splash screen will not\ndisappear. If this happens just type Enter and it will close."`" 7 60
    fi
  }
;;
"Acrobat Reader 6.0 Norwegian")
  URL="http://www.adobe.com/products/acrobat/reader_archive.html#Win"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
      dload="http://ardownload.adobe.com/pub/adobe/reader/win/6.x/6.0/nor/AdbeRdr60_nor_full.exe"
      dlsize="17188944"
      sysname="AdbeRdr60_nor_full.exe"
      testname="Adobe Reader 6.0.1.*"
      script="acro6"
      sysinstall
      [ "$failed" = "0" ] && $DIALOG --title "`eval_gettext "Hint"`" \
        --no-cancel \
        --msgbox "`eval_gettext "During the first start of the reader the splash screen will not\ndisappear. If this happens just type Enter and it will close."`" 7 60
    fi
  }
;;
"RealPlayer 10 German")
  URL="http://www.real.com"
  showinfo || {
    # Link seems to be broken
    dload="http://software-dl.real.com/12bfb857c52156f58806/windows/RealPlayer10-5GOLD_de.exe"
    dlsize="13985184"
    sysname="RealPlayer10-5GOLD_de.exe"
    #dload="none"
    #dlsize=""
    #sysname="$choice"
    #installer="***SEARCH***"
    testname="RealPlayer"
    script="rplayer10"
    sysinstall
  }
;;
"SLD Codec Pack 1.5.3")
  URL="http://www.codec-download.com/modules.php?name=Downloads&d_op=viewdownload&cid=16"
  showinfo || {
    dload="http://www.codec-archiv.de/win/sld/SLDcodecpack1.5.3.exe"
    dlsize="4082450"
    sysname="SLDcodecpack1.5.3.exe"
    testname="SLD CODEC PACK 1.5.3"
    script=""
    sysinstall
    $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Don't use the included Zoom Player.\nIt does not work with Wine."`" 7 60
	    #'
  }    
;;
"ArtRage 1.1")
  URL="http://www.ambientdesign.com/artrage.html"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
      dload="http://highspeed1.movedigital.com:8080/badfs/badbal?secretcode=28ef07524097fffd9052abf7937cb84a&asid=523546&path=/web/files/movedigital/temp/523546/artrage_setup.msi"
      dlsize="1628672"
      sysname="artrage_setup.msi"
      installer="$WINE msiexec /i f:\\sys\\artrage_setup.msi"
      testname="ArtRage"
      script="artrage"
      sysinstall
    fi
  }
;;
"Lauge 2.06 German")
  URL="http://www.lauge.de"
  showinfo || {
    dload="http://www.lauge.de/public/Lauge206_setup.exe"
    dlsize="2526816"
    sysname="lauge206_setup.exe"
    testname="Lauge 2.06"
    script="lauge2"
    sysinstall
#    if [ "$failed" = "0" ]; then
#      cp "$BASEDIR/3rdParty/lauge-prefs.ini" "$WINEDIR/c/Program Files/Lauge/prefs.ini"
#    fi
  }
;;
"InfoRapid Internet-Zeitungsleser German")
  URL="http://www.inforapid.de/html/zeitungsleser.htm"
  CONTACT="info@inforapid.de"
  showinfo || {
    dload="http://www.inforapid.org/br/br.exe"
    dlsize="683318"
    sysname="br.exe"
    testname="InfoRapid Internet-Zeitungsleser"
    script="brrapid"
    sysinstall
  }
;;
"InfoRapid KnowledgeMap 2005 German")
  URL="http://www.inforapid.de/html/knowledgemap.htm"
  CONTACT="info@inforapid.de"
  showinfo || {
    dload="http://www.inforapid.org/ikm_deu/ikm_deu.exe"
    dlsize="4721207"
    sysname="ikm_deu.exe"
    testname="InfoRapid KnowledgeMap"
    script="ikmap"
    sysinstall    
    $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "For indexing PDF documents you have to install Xpdf."`" 7 60
    ln -s "$WINEDIR/c/Programme/xpdf-3.01-win32/pdftotext.exe" "$WINEDIR/c/Programme/ikMap/"
  }
;;
"Xpdf 3.01")
  URL="http://www.foolabs.com/xpdf/"
  CONTACT="derekn@foolabs.com"
  showinfo || {
    dload="ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.01-win32.zip"
    dlsize="1676542"
    sysname="xpdf-3.01-win32.zip"
    installer="unzip -o xpdf-3.01-win32.zip -d $WINEDIR/c/Programme/"
    script=""
    sysinstall
  }
;;
"WeatherScope 1.2.1")
# menu was:
# 	  "WeatherScope 1.2.1" "WeatherScope 1.2.1" "" "2" "`eval_gettext "Weather data browser from Oklahoma Climatological Survey (OCS) | License: freeware for non-commercial usage"`" \
  URL="http://www.ocs.ou.edu/software/"
  CONTACT="operator@mesonet.org"
  showinfo || {
    dload="http://sdg.ocs.ou.edu/builds/final/win/WeatherScope/WeatherScope-1.2.1.exe"
    dlsize="1224652"
    sysname="WeatherScope-1.2.1.exe"
    testname="WeatherScope"
    script="weatherscope"
    sysinstall
  }
;;
"OpenSong 0.9.9.")
  URL="http://www.opensong.org"
  CONTACT=""
  showinfo || {
    dload="$SFMIRROR/opensong/opensong-0.9.9-setup.exe"
    dlsize="3489213"
    sysname="opensong-0.9.9-setup.exe"
    testname="OpenSong .*"
    script="opensong"
    sysinstall
  }
;;
"VirtualDub 1.6.1")
  URL="http://www.virtualdub.org"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "During the first start go to Options-Preferences-Display and disable\nDirectX to prevent VD to mess up your display."`" 7 60
    mkdir "$WINEDIR/c/Programme/VirtualDub"
    dload="$SFMIRROR/virtualdub/VirtualDub-1.6.1.zip"
    dlsize="796130"
    sysname="VirtualDub-1.6.1.zip"
    installer="unzip -o VirtualDub-1.6.1.zip -d $WINEDIR/c/Programme/VirtualDub"
    script="virtualdub"
    sysinstall
  }
;;
"Bottler XDCC Bot Interface")
  URL="http://www.memelog.com/bottler/"
  showinfo || {
    dload="$SFMIRROR/bottler/Bottler_v3.3.1214.zip"
    dlsize="2987942"
    sysname="Bottler_v3.3.1214.zip"
    installer="unzip -o Bottler_v3.3.1214.zip -d $SYSDIR/sys/tmp"
    sysinstall
    init
    dload="none"
    dlsize="none"
    sysname="tmp/Bottler_v3.3.1214.exe"
    testname="Bottler"
    script="bottler"
    sysinstall
    cleantmp
  }
;;
"DVD Shrink 3.2")
  $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Due to legal issues this program has been removed."`" 7 60
  # deprecated code that never gets executed
  false && {
    URL="http://www.dvdshrink.org/"
    showinfo || {
      dload="http://files.dvdr-digest.com/encode/dvdshrink32setup.zip"
      dlsize="1094021"
      sysname="dvdshrink32setup.zip"
      installer="unzip -o dvdshrink32setup.zip -d $SYSDIR/sys/tmp"
      sysinstall
      init
      dload="none"
      dlsize="none"
      sysname="tmp/dvdshrink32setup.exe"
      testname="DVD Shrink 3.2"
      script="dvdshrink"
      sysinstall
      cleantmp
    }
  }
;;
"Total Commander 6.03a")
  URL="http://www.ghisler.com"
  showinfo || {
    dload="http://fileforum.betanews.com/sendfile/945901171/1/tcmd603a.exe"
    dlsize="1648632"
    sysname="tcmd603a.exe"
    testname="Total Commander (Remove or Repair)"
    script="wincmd totalcmd"
    sysinstall
  }
;;
"Noise Ninja")
  URL="http://www.picturecode.com"
  showinfo || {
    dload="http://www.picturecode.com/downloads/2_1_0/NoiseNinjaSetup_Win32_2_1_0.exe"
    dlsize="5037234"
    sysname="NoiseNinjaSetup_Win32_2_1_0.exe"
    testname="Noise Ninja 2 (Standalone Version)"
    script="noiseninja2"
    sysinstall
  }
;;
"Miranda IM")
  URL="http://www.miranda-im.org"
  showinfo || {
    dload="$SFMIRROR/miranda-icq/miranda-im-v0.3.3.1.exe"
    dlsize="742686"
    sysname="miranda-im-v0.3.3.1.exe"
    testname="Miranda IM"
    script="mirandaim"
    sysinstall
  }
;;
"Future Pinball")
  URL="http://www.futurepinball.com"
  showinfo || {
      dload="http://www.futurepinball.com/downloads/FuturePinballSetup.exe"
      dlsize="31026472"
      sysname="FuturePinballSetup.exe"
      testname="Future Pinball"
      script="futurepinball"
      # Save the current Wine configuration
      $WINE regedit.exe /e $SYSDIR/sys/tmp/current.reg "HKEY_CURRENT_USER\Software\Wine" >/dev/null 2>&1
      # Setting the global Windows version to win2k
      $WINE regedit.exe $BASEDIR/3rdParty/futurepinball.reg >/dev/null 2>&1
      waitforwineexit
      $DIALOG --title "`eval_gettext "Info"`" \
              --no-cancel \
              --msgbox "`eval_gettext "Future Pinball needs a 3D graphics card with a configured OpenGL\naccess. To prevent a Wine crash after starting the game first you\nshould open, start and stop the table LightSequencerDemo.fpt. Then\nit should be possible to open and play the table Sci-Fi Classic.fpt."`" 11 60
      sysinstall
      # Restore the former Windows version
      $WINE regedit $SYSDIR/sys/tmp/current.reg >/dev/null 2>&1
      waitforwineexit
    }
;;
"Steam")
  URL="http://www.steampowered.com"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
        needsw "Microsoft Word Viewer 97"
        if [ "$?" = "0" ]; then
          dload="http://steampowered.com/download/SteamInstall.exe"
          dlsize="727517"
          sysname="SteamInstall.exe"
          testname="Steam(TM)"
          script="steam"
          $WINE regedit.exe $BASEDIR/3rdParty/steaminstall.reg
          waitforwineexit
          $DIALOG --title "`eval_gettext "Info"`" \
                  --no-cancel \
                  --msgbox "`eval_gettext "After installation let the program update, then when prompted, enter\nyour username and password. Make SURE that 'Remember my\nusername and password' is checked. You cannot enter your username\nor password later. After that click OK, close the HTML window that\npops up by clicking the icon at the upper right corner. The Close\nbutton at the bottom does not work. Close the app."`" 13 60
          sysinstall
          $WINE regedit /d "HKEY_CURRENT_USER\Software\Wine\AppDefaults\Steam.exe" >/dev/null 2>&1
          waitforwineexit
        fi
      fi
    }
;;
"PowBallDX")
  URL="http://www.powproductions.co.uk/powball_index.html"
  showinfo || {
    dload="http://www.powproductions.co.uk/download/powballdx.exe"
    dlsize="833736"
    sysname="powball.exe"
    script="powball"
    sysinstall
    if [ "$failed" = "0" ]; then
      cp "$BASEDIR/3rdParty/PowBallDX.cfg" "$WINEDIR/c/Program Files/PowBallDX"
      $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "After the start enter the PowBall window extremely slow, otherwise\nyou will have a second cursor lying around in your sight."`" 7 60
    fi
  }
;;
"Dependency Walker")
  URL="http://www.dependencywalker.com"
  showinfo || {
    mkdir "$WINEDIR/c/Programme/DependencyWalker"
    dload="http://www.dependencywalker.com/depends21_x86.zip"
    dlsize="415352"
    sysname="depends21_x86.zip"
    installer="unzip -o "$sysname" -d $WINEDIR/c/Programme/DependencyWalker"
    script="depwalker"
    sysinstall
  }
;;
"Awasu 2.1 Personal Edition")
  URL="http://www.awasu.com"
  showinfo || {
    dload="http://download.awasu.com/2.1/Awasu-PersonalEdition-v2.1.exe"
    dlsize="4656290"
    sysname="Awasu-PersonalEdition-v2.1.exe"
    script="awasu"
    sysinstall
  }
;;
"Eudora 6.2")
  URL="http://www.eudora.com"
  showinfo || {
    dload="http://www.eudora.com/download/eudora/windows/6.2/Eudora_6.2.exe"
    dlsize="9537272"
    sysname="Eudora_6.2.exe"
    testname="Eudora"
    script="eudora"
    sysinstall
  }
;;
"GrabIt 1.4.7")
  URL="http://www.shemes.com"
  showinfo || {
    dload="http://www.shemes.demon.nl/GrabIt147b.exe"
    dlsize="1117550"
    sysname="GrabIt147b.exe"
    testname="GrabIt.*"
    script="grabit"
    sysinstall
  }
;;
"The Bat! 3.01 Professional")
  URL="http://www.ritlabs.com/en/"
  showinfo || {
    needsw "InstMsiA.exe"
    if [ "$?" = "0" ]; then
      dload="http://www.ritlabs.com/download/files3/the_bat/thebat_professional.msi"
      dlsize="9561600"
      sysname="thebat_professional.msi"
      installer="$WINE msiexec /i f:\\sys\\thebat_professional.msi"
      testname="The Bat.*"
      script="thebat"
      sysinstall
    fi
  }
;;
"BioEdit")
  URL="http://www.mbio.ncsu.edu/BioEdit/bioedit.html"
  showinfo || {
    dload="http://www.mbio.ncsu.edu/BioEdit/BioEdit.zip"
    dlsize="13025676"
    sysname="BioEdit.zip"
    installer="unzip -o BioEdit.zip -d $SYSDIR/sys/tmp"
    sysinstall
    init
    dload="none"
    dlsize="none"
    sysname="tmp/SETUP.EXE"
    testname="BioEdit"
    script="bioedit"
    sysinstall
    cleantmp
  }
;;
"QuickTime Player 6.5.2 English")
  URL="http://www.apple.com/quicktime/products/qt/"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	    --yesno "`eval_gettext "Note that you might have to change the fifo-Size in the player\nsettings for uninterrupted sound. A size of 333 was good for me.\nAlso you should set Quicktime Options for Video to GDI only.\nContinue?"`" 12 60
    if [ "$?" = "0" ]; then
      dload="http://appldnld.m7z.net/qtinstall.info.apple.com/pthalo/us/win/QuickTimeFullInstaller.exe"
      dlsize="12846248"
      sysname="QuickTimeFullInstaller.exe"
      testname="QuickTime"
      script="quicktime"
      sysinstallsw
    fi
  }
;;
"QuickTime Player 6.5.2 Norwegian")
  URL="http://www.apple.com/quicktime/products/qt/"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	    --yesno "`eval_gettext "Note that you might have to change the fifo-Size in the player\nsettings for uninterrupted sound. A size of 333 was good for me.\nAlso you should set Quicktime Options for Video to GDI only.\nContinue?"`" 12 60
    if [ "$?" = "0" ]; then
      dload="http://appldnld.m7z.net/qtinstall.info.apple.com/pthalo/no/win/QuickTimeFullInstaller.exe"
      dlsize="12883112"
      sysname="QuickTimeFullInstaller.exe"
      testname="QuickTime"
      script="quicktime"
      sysinstallsw
    fi
  }
;;
"QuickTime Player 5.0")
  URL="http://www.apple.com/quicktime/products/qt/"
  showinfo || {
#      $DIALOG --title "`eval_gettext "Hint"`" \
#	      --no-cancel \
#	      --msgbox "`eval_gettext "For older QuickTime installations you need the files on a CD\nor any other medium since they are not downloadable any more..."`" 7 60
    dload="http://a1408.g.akamai.net/5/1408/1388/dbc734498163af/1a1a1add51ba289b0f70dc4876df4db32250b12191fd6290f362cffe6acf3697fa73a21387bcec2150c5305fd63fad/QuickTimeInstaller.zip"
    dlsize="10039592"
    sysname="QuickTimeInstaller.zip"
    installer="unzip -o QuickTimeInstaller.zip -d $SYSDIR/sys/tmp"
    sysinstall
    init
    dload="none"
    dlsize="517792"
    sysname="tmp/QuickTimeCDInstaller/QuickTimeInstaller.exe"
    testname="QuickTime"
    script="quicktime"
    sysinstall
  }
;;
"Typograf 4 Fontmanagement German")
  URL="http://www.neuber.com/typograf/index.html"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Note that the installer will not quit with the finish button.\nYou have to quit the dialog by closing the window."`" 7 60
    $WINE regedit.exe $BASEDIR/3rdParty/typograf.reg
    waitforwineexit
    dload="http://www.neuber.biz/download/typo40d.exe"
    dlsize="1008304"
    sysname="typo40d.exe"
    script="typograf"
    sysinstall "" "-nofail"
  }
;;
"Typograf 4 Fontmanagement English")
  URL="http://www.neuber.com/typograph/index.html"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "Note that the installer will not quit with the finish button.\nYou have to quit the dialog by closing the window."`" 7 60
    $WINE regedit.exe $BASEDIR/3rdParty/typograf.reg
    waitforwineexit
    dload="http://www.neuber.biz/download/typo40e.exe"
    dlsize="982200"
    sysname="typo40e.exe"
    script="typograf"
    sysinstall "" "-nofail"
  }
;;
"FontPage")
  URL="http://bluefive.pair.com/fontpage.htm"
  needsw "vbrun60sp5.exe" "--no-cancel"
  showinfo || {
    dload="http://users.telenet.be/david.de.groot/progs/FontPage.zip"
    dlsize="1067116"
    sysname="FontPage.zip"
    installer="unzip -o FontPage.zip -d $SYSDIR/sys/tmp"
    sysinstall
    init
    dload="none"
    dlsize="1088401"
    sysname="tmp/setup.exe"
    testname="FontPage.*"
    script="fontpage"
    sysinstall
    cleantmp
  }
;;
"UltimateZip")
  URL="http://www.ultimatezip.de/"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	--no-cancel \
	--msgbox "`eval_gettext "When UltimateZip is started you will find a WinZip icon\nin the system tray. Right click and quit it.\nCheck that it never starts again!"`" 9 70
    dload="http://www.swe-von-schleusen.de/uz/27us/uzsetup.exe"
    dlsize="3468862"
    sysname="uzsetup.exe"
    testname="UltimateZip.*"
    script="uzip"
    sysinstall
  }
;;
"IRon")
  URL="http://www.zeitungs.info/public/programme.iron.html"
  showinfo || {
    needsw "RealPlayer" && {
      dload="http://download.zeitungs.info/download.php?what=iron_del.exe"
      dlsize="887665"
      sysname="iron_del.exe"
      testname="IRon.*"
      script="iron"
      sysinstall
    }
  }
;;
"TVgenial")
  URL="http://www.tvgenial.com/"
  showinfo || {
      dload="http://80.237.202.68/~admin1/downloads/TVgenial330.exe"
      dlsize="2034363"
      sysname="TVgenial330.exe"
      testname="TVgenial"
      script="tvgenial"
      sysinstall
  }
;;
"Scribble Papers")
  URL="http://home.arcor.de/jhoetger/scpapers/"
  showinfo || {
      dload="http://home.arcor.de/jhoetger/scpapers/SPSetup.exe"
      dlsize="1093018"
      sysname="SPSetup.exe"
      testname="Scribble Papers.*"
      script="scpapers"
      sysinstall
  }
;;
"Qimage")
  URL="http://www.ddisoftware.com/qimage/"
  CONTACT="mchaney@ddisoftware.com"
  showinfo || {  
    dload="http://www.ddisoftware.com/qimage/q05-117.exe"
    dlsize="5291848"
    sysname="q05-117.exe"
    testname="Qimage.*"
    script="qimage"
    sysinstall
  }
;;
"NeatImage")
  URL="http://www.neatimage.com"
  CONTACT="info@neatimage.com"
  showinfo || {  
    dload="http://www.neatimage.net/files/NeatSetup.exe"
    dlsize="1562106"
    sysname="NeatSetup.exe"
    testname="Neat Image .*"
    script="neatimage"
    sysinstall
  }
;;
"GoogleEarth")
  URL="http://earth.google.com/"
  showinfo || {  
    dload="http://dl.google.com/earth/GoogleEarthSetup.exe"
    dlsize="11817800"
    sysname="GoogleEarthSetup.exe"
    testname="Google Earth"
    script="googleearth"
    $DIALOG --title "`eval_gettext "Hint"`" \
      --no-cancel \
      --msgbox "`eval_gettext "GoogleEarth needs a 3D graphics card with a configured OpenGL\naccess. There are massive display problems at this stadium of\nWine, but at least the zoom function is working. Also notice\nthat initialization of setup could take any time."`" 10 70
    sysinstall
  }
;;
"KLV 4 (german)")
  needsw "MDAC_TYP.EXE" "--no-cancel"
  needsw "Jet40SP8_9xNT.exe" "--no-cancel"
  # This software is not installable in Wine 0.9. During setup there comes an error
  # about a missing dll. Then you can go into it's temporary folder c:\windows\temp\WZ...
  # and start the KLV.EXE, after that leave the setup and install again.
  URL="http://www.klv-software.de"
  CONTACT="info@klv-software.de"
  showinfo || {  
    dload="http://www.klv-software.de/download/install.exe"
    dlsize="4050944"
    sysname="install.exe"
    script="klv4"
    sysinstall
  }
;;
"7-Zip")
  URL="http://www.7-zip.org"
  CONTACT="ipavlov@users.sourceforge.net"
  showinfo || {  
    dload="$SFMIRROR/sevenzip/7z423.exe"
    dlsize="1071555"
    sysname="7z423.exe"
    testname="7-Zip .*"
    script="7-zip"
    sysinstall
  }
;;
"MailWasher Pro International Version")
  URL="http://www.firetrust.com/products/pro/"
  CONTACT="matthew.miller@firetrust.com"
  showinfo || {  
    dload="http://home.xtra.co.nz/hosts/nickbolton/mailwasherpro/mwp_419_international.exe"
    dlsize="5163606"
    sysname="mwp_419_international.exe"
    testname="MailWasher Pro.*"
    script="mailwasher"
    sysinstall
  }
;;
"X-Lite v2.0 Build 1105m English")
  URL="http://www.xten.com"
  CONTACT="corporate@xten.com"
  showinfo || {  
    dload="http://venom.xten.net/Files/x_lite-counterpath_Win32_1105x_21407.exe"
    dlsize="1266515"
    sysname="x_lite-counterpath_Win32_1105x_21407.exe"
    testname="X-Lite 2.0 .*"
    script="x-lite"
    sysinstall
  }
;;
#"X-Lite v2.0 Build 1103m German")
#  URL="http://www.globalipphones.com/_Pages/IndexFrameset/Frameset.aspx"
#  CONTACT="corporate@xten.com"
#  showinfo || {  
    # Link is broken
    # dload="http://www.globalipphones.com/_Pages/IndexFrameset/ContentFrame.aspx?gotoDownload=yes&un=gipp&vers=lite&lang=ger"
    # dlsize="2846154"
#    dload="none"
#    dlsize=""
#    sysname="$choice"
#    installer="***SEARCH***"
#    testname="X-Lite 2.0 .*"
#    script="x-lite"
#    sysinstallsw
#  }
#;;
"Phoner 1.78")
  URL="http://www.phoner.de/index_en.htm"
  CONTACT="info@phoner.de"
  showinfo || {  
    dload="http://www.phoner.de/PhonerSetup.exe"
    dlsize="1900087"
    sysname="PhonerSetup.exe"
    testname="Phoner .*"
    script="phoner"
    sysinstall
  }
;;
"Skype 1.1")
  URL="http://www.skype.com/"
  CONTACT="info@skype.com"
  showinfo || {  
    dload="http://www.skype.com/go/getskype"
    dlsize="7256768"
    sysname="SkypeSetup.exe"
    testname="Skype .*"
    script="skype-win"
    sysinstall
  }
;;
"Scrutico")
  URL="http://photofiltre.free.fr/frames_en.htm"
  CONTACT="photofiltre@free.fr"
  showinfo || {
      dload="http://photofiltre.free.fr/utils/Scrutico.zip"
      dlsize="544210"
      sysname="Scrutico.zip"
      installer="unzip -o Scrutico.zip -d $WINEDIR/c/Programme/Scrutico"
      script="scrutico"
      sysinstall
  }
;;
"PhotoFiltre 6.1")
  URL="http://photofiltre.free.fr/frames_en.htm"
  CONTACT="photofiltre@free.fr"
  showinfo || {
      dload="http://photofiltre.free.fr/utils/pf-setup-en.exe"
      dlsize="1607846"
      sysname="pf-setup-en.exe"
      testname="PhotoFiltre"
      script="photofiltre"
      sysinstall
      $DIALOG --title "`eval_gettext "Info"`" \
	      --yesno "`eval_gettext "Installing plugins now. This could take a while..."`" 9 70
      if [ "$?" = "0" ]; then
	cd "$SYSDIR/sys"
        wget -r -np "http://plugins.photofiltre.free.fr/plugins/"
        unzip -o "$SYSDIR/sys/plugins.photofiltre.free.fr/plugins/*.zip" -d "$WINEDIR/c/Programme/PhotoFiltre/Plugins"
	instfilter="`for n in \"$SYSDIR/sys/plugins.photofiltre.free.fr/plugins\"/*.zip; do basename \"$n\" \".zip\"; done | paste -s`"
        $DIALOG --title "`eval_gettext "Info"`" --wrap \
	        --msgbox "`eval_gettext "The following filters have been found and installed:\n$instfilter"`" 15 80
      fi
      $DIALOG --title "`eval_gettext "Info"`" \
	      --yesno "`eval_gettext "Installing selections, masks, patterns, and thumbnails now.\nThis could take a while, too..."`" 9 70
      if [ "$?" = "0" ]; then
	cd "$SYSDIR/sys"
        wget -r -np "http://photofiltre.free.fr/suppl/"
        unzip -o "$SYSDIR/sys/photofiltre.free.fr/suppl/pfs_*.zip" -d "$WINEDIR/c/Programme/PhotoFiltre/Selections"
	instfilter="`for n in \"$SYSDIR/sys/photofiltre.free.fr/suppl\"/pfs_*.zip; do basename \"$n\" \".zip\"; done | paste -s`"
        $DIALOG --title "`eval_gettext "Info"`" --wrap \
	        --msgbox "`eval_gettext "The following selections have been found and installed:\n$instfilter"`" 15 80
        unzip -o "$SYSDIR/sys/photofiltre.free.fr/suppl/pm_*.zip" -d "$WINEDIR/c/Programme/PhotoFiltre/Masks"
	instfilter="`for n in \"$SYSDIR/sys/photofiltre.free.fr/suppl\"/pm_*.zip; do basename \"$n\" \".zip\"; done | paste -s`"
        $DIALOG --title "`eval_gettext "Info"`" --wrap \
	        --msgbox "`eval_gettext "The following masks have been found and installed:\n$instfilter"`" 15 80
        unzip -o "$SYSDIR/sys/photofiltre.free.fr/suppl/mo_*.zip" -d "$WINEDIR/c/Programme/PhotoFiltre/Patterns"
	instfilter="`for n in \"$SYSDIR/sys/photofiltre.free.fr/suppl\"/mo_*.zip; do basename \"$n\" \".zip\"; done | paste -s`"
        $DIALOG --title "`eval_gettext "Info"`" --wrap \
	        --msgbox "`eval_gettext "The following patterns have been found and installed:\n$instfilter"`" 15 80
        unzip -o "$SYSDIR/sys/photofiltre.free.fr/suppl/th_*.zip" -d "$WINEDIR/c/Programme/PhotoFiltre/Vignette"
	instfilter="`for n in \"$SYSDIR/sys/photofiltre.free.fr/suppl\"/th_*.zip; do basename \"$n\" \".zip\"; done | paste -s`"
        $DIALOG --title "`eval_gettext "Info"`" --wrap \
	        --msgbox "`eval_gettext "The following thumbnails have been found and installed:\n$instfilter"`" 15 80
      fi
  }
;;
"Picasa2")
  URL="http://picasa.google.com/"
  showinfo || {
      dload="http://dl.google.com/picasa/picasa2-current.exe"
      dlsize="4126240"
      sysname="picasa2-current.exe"
      testname="Picasa 2"
      script="picasa2"
      sysinstall
  }
;;
"WinAmp 5 incl. Streamripper")
  URL="http://www.winamp.com/"
  showinfo || {
#    $DIALOG --title "`eval_gettext "Hint"`" \
#	--no-cancel \
#	--msgbox "When WinAmp is started you will find an icon\nin the system tray. Right click and quit it.\nCheck that it never starts again!" 9 70
      dload="http://download.nullsoft.com/winamp/client/winamp511_full_emusic-7plus.exe"
      dlsize="6077712"
      sysname="winamp508d_full_emusic-7plus.exe"
      testname="Winamp.*"
      script="winamp"
      sysinstall
      init
      dload="$SFMIRROR/streamripper/srwa5-1.61.3.exe"
      dlsize="856682"
      sysname="srwa5-1.61.3.exe"
      sysinstall
  }
;;
#"WinAmp 2 incl. Streamripper")
#  URL="http://www.winamp.com/"
#  showinfo || {
    # Link is broken.
    # dload="http://download.nullsoft.com/winamp/client/winamp291_full.exe"
    # dlsize="2320949"
    # sysname="winamp291_full.exe"
#    dload="none"
#    dlsize=""
#    sysname="$choice"
#    installer="***SEARCH***"
#    testname="Winamp.*"
#    script="winamp"
#    sysinstallsw
#    init
#    dload="$SFMIRROR/streamripper/srwa5-1.61.3.exe"
#    dlsize="856682"
#    sysname="srwa5-1.61.3.exe"
#    sysinstall
#  }
#;;
"foobar2000")
  URL="http://www.foobar2000.org"
  showinfo || {
      dload="http://www.foobar2000.org/foobar2000_special.exe"
      dlsize="2667342"
      sysname="foobar2000_special.exe"
      testname="foobar2000.*"
      script="foobar2000"
      sysinstall
  }
;;
"Firefox 1.0.7")
  URL="http://www.mozilla.org"
  showinfo || {
      dload="http://download.mozilla.org/?product=firefox-1.0.7&os=win&lang=en-US"
      dlsize="4878136"
      sysname="FirefoxSetup1.0.7.exe"
      testname="Mozilla Firefox .*"
      script="firefoxwt"
      sysinstall
  }
;;
"Mozilla ActiveX Control")
  URL="http://www.iol.ie/~locka/mozilla/control.htm"
  showinfo || {
      dload="http://www.iol.ie/~locka/mozilla/MozillaControl177.exe"
      dlsize="4764210"
      sysname="MozillaControl177.exe"
      testname="Mozilla ActiveX Control .*"
      script=""
      sysinstall
  }
;;
"Citrix Access Client package")
  # not installable because of broken registry key Netscape/Netscape Navigator/Viewers
  URL="http://www.citrix.com/lang/English/home.asp"
  showinfo || {
      dload="http://download2.citrix.com/FILES/en/products/client/ica/client9.1/Ica32Pkg.msi"
      dlsize="3652096"
      sysname="Ica32Pkg.msi"
      testname="Ica .*"
      installer="$WINE msiexec /i f:\\sys\\Ica32Pkg.msi"
      script="citrixclient"
      sysinstall
  }
;;
"CoolPlayer")
  URL="http://coolplayer.sourceforge.net/"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	--no-cancel \
	--msgbox "If playback is broken change Options - Output to \"Cooler Wave mapper\"." 6 70
      dload="$SFMIRROR/coolplayer/CoolPlayer215_Bin.zip"
      dlsize="325247"
      sysname="CoolPlayer215_Bin.zip"
      mkdir "$WINEDIR/c/Programme/CoolPlayer"
      installer="unzip -o CoolPlayer215_Bin.zip -d $WINEDIR/c/Programme/CoolPlayer"
      script="coolplayer"
      sysinstall
  }
;;
# In Wine 0.9 there was a stack overflow at program start, so disabled
#"Ultimate Paint LE")
#  URL="http://www.ultimatepaint.com/"
#  showinfo || {
#    mustnotsw "Ultimate Paint 1.*" && {
#      dload="http://www.ultimatepaint.com/up.zip"
#      dlsize="1775527"
#      sysname="up.zip"
#      installer="unzip -o up.zip -d $SYSDIR/sys/tmp"
#      sysinstall
#      init
#      dload="none"
#      dlsize="1808049"
#      sysname="tmp/setup.exe"
#      testname="Ultimate Paint 2.*"
#      script="upaint"
#      sysinstall
#      init
#      dload="http://www.ultimatepaint.com/deutsch286.zip"
#      dlsize="450784"
#      sysname="deutsch286.zip"
#      installer="unzip -o deutsch286.zip -d $WINEDIR/c/Programme/UP"
#      sysinstall
#      init
#      dload="http://www.ultimatepaint.com/magyar286.zip"
#      dlsize="488736"
#      sysname="magyar286.zip"
#      installer="unzip -o magyar286.zip -d $WINEDIR/c/Programme/UP"
#      sysinstall
#      $DIALOG --title "`eval_gettext "*** NOTE ***"`" \
#              --msgbox "`eval_gettext "Ultimate Paint may start with a zoom factor for new pictures\nthat produces an \"Out of Memory\" error but the program still works.\nGo to options-settings and set the zoom factor to 1-10."`" 12 60
#      cleantmp
#    }
#  }
#;;
"Ultimate Paint 1.91f")
  URL="http://www.megaluxltd.com/eng/index.html"
  showinfo || {
    mustnotsw "Ultimate Paint 2.*" && {
      dload="http://www.computerbild.de/programme/ultimatepaint.exe"
      dlsize="1800518"
      sysname="ultimatepaint.exe"
      testname="Ultimate Paint 1.*"
      script="upaint"
      sysinstall
      init
      dload="http://www.ultimatepaint.com/deutsch286.zip"
      dlsize="450784"
      sysname="deutsch286.zip"
      installer="unzip -o deutsch286.zip -d $WINEDIR/c/Programme/UP"
      sysinstall
      init
      dload="http://www.ultimatepaint.com/magyar286.zip"
      dlsize="488736"
      sysname="magyar286.zip"
      installer="unzip -o magyar286.zip -d $WINEDIR/c/Programme/UP"
      sysinstall
#      $DIALOG --title "`eval_gettext "*** NOTE ***"`" \
#              --msgbox "Ultimate Paint may start with a zoom factor for new pictures\nthat produces an \"Out of Memory\" error but the program still works.\nGo to options-settings and set the zoom factor to 1-10." 12 60
      cleantmp
    }
  }
;;
"Fort� Agent Newsreader 2.0")
  URL="http://www.forteinc.com/agent/index.php"
  showinfo || {
    dload="ftp://ftp3.forteinc.com/pub/agent/english/agentenu200-652.exe"
    dlsize="3818184"
    sysname="agentenu200-652.exe"
    testname="Fort� Agent"
    script="agentnr"
    sysinstall
  }
;;
"DBCrab 1.50 German with BDE 5.1.1 German")
  URL="http://www.dbcrab.de"
  CONTACT="feedback@dbcrab.de"
  showinfo || {
    dload="http://www.dbcrab.de/zip/dbcrab150.zip"
    dlsize="5418434"
    sysname="dbcrab150.zip"
    installer="unzip -o dbcrab150.zip -d $SYSDIR/sys/tmp"
    sysinstall
    init
    dload="none"
    dlsize="45312"
    sysname="tmp/SETUP.EXE"
    testname="DBCrab"
    script="dbcrab"
    sysinstall
    $WINE regedit "$BASEDIR/3rdParty/bde.reg"
    cleantmp
  }
;;
"Borland Database Engine (BDE) 5.1.1 English")
  URL="http://info.borland.com/devsupport/bde/"
  showinfo || {
    needsw "DBCrab"
    if [ "$?" = "0" ]; then
      for n in BDEADMIN.CNT BDEADMIN.EXE BDEADMIN.HLP BDEADMIN.TOC; do
        rm "$WINEDIR/c/Program Files/Common Files/Borland Shared/BDE/$n"
      done
      $WINE regedit "$BASEDIR/3rdParty/bde.reg"
      dload="ftp://ftpc.borland.com/pub/bde/devsupport/updates/bde511en.exe"
      dlsize="11895034"
      sysname="bde511en.exe"
      script="bdeadmin"
      sysinstall
      $WINE regedit "$BASEDIR/3rdParty/bde.reg"
    fi
  }
;;
"Borland Database Engine (BDE) 5.1.1 German")
  URL="http://info.borland.com/devsupport/bde/"
  showinfo || {
    dload="ftp://ftpc.borland.com/pub/bde/devsupport/updates/bde511ge.exe"
    dlsize="12039880"
    sysname="bde511ge.exe"
    testname="bde511.*exe"
    script="bdeadmin"
    sysinstall
  }
;;
"PostgreSQL ODBC driver psqlODBC 8.00.0101")
#"PostgreSQL ODBC driver psqlODBC 7.03.0200")
  URL="http://gborg.postgresql.org/project/psqlodbc/projdisplay.php"
  showinfo || {
#    dload="ftp://ftp.postgresql.org/pub/odbc/versions/full/psqlodbc-07_03_0200.zip"
#    dlsize="3781611"
#    sysname="psqlodbc-07_03_0200.zip"
    dload="ftp://ftp.postgresql.org/pub/odbc/versions/msi/psqlodbc-08_00_0101.zip"
    dlsize="194187"
    sysname="psqlodbc-08_00_0101.zip"
    installer="unzip -o $sysname -d $SYSDIR/sys/tmp"
    sysinstall
    init
    dload="none"
    dlsize="267776"
    sysname="tmp\\psqlodbc.msi"
    installer="$WINE msiexec /i f:\\sys\\${sysname}"
    testname="psqlODBC"
    script=""
    sysinstall    
    cleantmp
  }
;;
"mIRC 6.16")
  URL="http://www.mirc.com"
  showinfo || {
    dload="ftp://ftp.freenet.de/pub/mirc.com/mirc616.exe"
    dlsize="1302528"
    sysname="mirc616.exe"
    testname="mIRC"
    script="mirc"
    sysinstall
  }
;;
"IrfanView 3.95")
  URL="http://www.irfanview.com"
  showinfo || {
    needsw "vcredist.exe"
    if [ "$?" = "0" ]; then
      dload="http://fileforum.betanews.com/sendfile/967963863/1/iview395.exe"
      dlsize="895488"
      sysname="iview395.exe"
      testname="IrfanView.*"
      script="iview"
      sysinstall
      if [ "$failed" = "0" ]; then
        $DIALOG --title "IrfanView" \
	      --no-cancel \
	      --msgbox "Installing the Plugins now..." 7 60
        dload="http://fileforum.betanews.com/sendfile/1099412658/1/irfanview_plugins_395.exe"
        dlsize="4763648"
        sysname="irfanview_plugins_395.exe"
        testname=""
        script=""
        sysinstall
      fi
    fi
  }
;;
"putty 0.58")
  URL="http://www.chiark.greenend.org.uk/~sgtatham/putty/"
  showinfo || {
    dload="http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.58-installer.exe"
    dlsize="1277505"
    sysname="putty-0.58-installer.exe"
    testname="PuTTY version .*"
    script="putty puttyagent puttygen"
    sysinstall
  }
;;
"DC++")
  URL="http://dcplusplus.sourceforge.net"
  showinfo || {
    dload="$SFMIRROR/dcplusplus/DCPlusPlus-0.674.exe"
    dlsize="3130340"
    sysname="DCPlusPlus-0.674.exe"
    testname="DC++ .*"
    script="dc++"
    sysinstall
    if [ "$failed" = "0" ]; then
      $DIALOG --title "`eval_gettext "Hint"`" \
	    --no-cancel \
	    --msgbox "`eval_gettext "After first start disable the\n'progress bars for transfer'\nat advanced options."`" 9 60
    
    fi
  }
;;
"Adobe Photoshop 7.0")
  URL="http://www.gimp.org"
  showinfo || {
    dload="none"
    dlsize=""
    sysname="$choice"
    installer="***SEARCH***"
#    installer="$WINE d:\\setup.exe"
    testname="$choice"
    script="photoshop imageready"
    sysinstallsw
  }
;;
"Adobe Illustrator 9.0")
  URL="http://www.linuxartist.org"
  showinfo || {
    dload="none"
    dlsize=""
    sysname="$choice"
    installer="***SEARCH***"
#    installer="$WINE d:\\autoplay.exe"
    testname="$choice"
    script="illustrator"
    sysinstallsw
  }
;;
"WinZip 9.0 German")
  URL="http://www.winzip.com"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	--no-cancel \
	--msgbox "`eval_gettext "If the WinZip installer starts WinZip after completion of the installation quit it.\nAnd in the system tray you will also find a WinZip icon. Richt click and quit also.\nCheck that it never starts again!"`" 9 70
    dload="http://download.winzip.com/german/wz90gev.exe"
    dlsize="2609152"
    sysname="wz90gev.exe"
    testname="WinZip"
    script="winzip"
    sysinstall
  }
;;
"WinZip 9.0 English")
  URL="http://www.winzip.com"
  showinfo || {
    $DIALOG --title "`eval_gettext "Hint"`" \
	--no-cancel \
	--msgbox "`eval_gettext "If the WinZip installer starts WinZip after completion of the installation quit it.\nAnd in the system tray you will also find a WinZip icon. Richt click and quit also.\nCheck that it never starts again!"`" 9 70
    dload="http://download.winzip.com/winzip90.exe"
    dlsize="4077184"
    sysname="winzip90.exe"
    testname="WinZip"
    script="winzip"
    sysinstall
  }
;;
#"WinRAR 3.41 German")
#  # In Wine 0.9 WinRAR crashes on startup.
#  URL="http://www.winrar-rog.de"
#  showinfo || {
#    dload="http://www.rarlab.com/rar/wrar341d.exe"
#    dlsize="1144977"
#    sysname="wrar341d.exe"
#    testname="WinRAR .*"
#    script="winrar"
#    sysinstall
#  }    
#;;
#"WinRAR 3.41 English")
#  # In Wine 0.9 WinRAR crashes on startup.
#  URL="http://www.rarlab.com"
#  showinfo || {
#    dload="http://www.rarlab.com/rar/wrar341.exe"
#    dlsize="1164112"
#    sysname="wrar341d.exe"
#    testname="WinRAR .*"
#    script="winrar"
#    sysinstall
#  }    
#;;
*)
  additionalsoftware
;;
esac
additionalsoftware
;;

1)
    mainmenu
;;
esac
}

#################
### Main menu ###
#################

function mainmenu()
{
init
TMP=`mktemp ${TMPDIR:-/tmp}/menu.XXXXXX` || mktemp_error "$?"
$DIALOG -stdout --title "WineTools 0.9" \
	--cancel-label "`eval_gettext "exit"`" \
	--item-help \
	--icon $BASEDIR/icon/wt.xpm \
        --menu ""  400x500 0  \
        "`eval_gettext "Base setup"`" "" "`eval_gettext "Start here with WineTools!"`" \
        "`eval_gettext "Install Windows system software"`" "" "`eval_gettext "Important additional software."`" \
        "`eval_gettext "Install Microsoft TrueType core fonts"`" "" "`eval_gettext "Fonts many applications rely on."`" \
        "`eval_gettext "Install tested software"`" "" "`eval_gettext "Software know to work with Wine."`" \
	" " "" "" \
	"`eval_gettext "Control Center"`" "" "`eval_gettext "The Windows Control Center."`" \
	"`eval_gettext "Registry Editor"`" "" "`eval_gettext "Comfortably edit the registry."`" \
	"`eval_gettext "Show installed Software"`" "" "" \
	"`eval_gettext "Uninstaller"`" "" "`eval_gettext "Uninstall Windows software."`" \
	"`eval_gettext "Simulate a Windows reboot"`" "" "" \
	"`eval_gettext "Show active Wine processes"`" "" "" \
	"`eval_gettext "Kill all Wine processes"`" "" "" \
	" " "" "" \
	"`eval_gettext "Save your Wine directory"`" "" "`eval_gettext "Backup an actual installation."`" \
	"`eval_gettext "Restore your Wine directory"`" "" "`eval_gettext "Restore an old installation."`" \
	"`eval_gettext "Modify the Wine configuration"`" "" "`eval_gettext "Modify the configuration. Be careful! This can break your setup."`" \
	" " "" "" \
	"`eval_gettext "Read Intro again"`" "" "" \
	"`eval_gettext "About"`" "" "" > $TMP

retval=$?

choice=`cat $TMP|grep -v "checked"`
checked="F"
[ "`cat $TMP|grep \"checked\"`" = "checked" ] && checked="T"
rm -f $TMP

case $retval in
0)
echo "`eval_gettext "Choice is $choice"`"
case "$choice" in
"`eval_gettext "Read Intro again"`")
  about
  readme
  mainmenu
;;
"`eval_gettext "Base setup"`")
  systemsoftware
;;
"`eval_gettext "Install Windows system software"`")
  systemmenu
;;
"`eval_gettext "Install Microsoft TrueType core fonts"`")
  fonts
;;
"`eval_gettext "Install tested software"`")
  additionalsoftware
;;
"`eval_gettext "Control Center"`")
  $WINE control
  mainmenu
;;
"`eval_gettext "Registry Editor"`")
  $WINE regedit
  mainmenu
;;
"`eval_gettext "Uninstaller"`")
  $WINE uninstaller
  wineboot
  mainmenu
;;
"`eval_gettext "Simulate a Windows reboot"`")
  wineboot
  mainmenu
;;
"`eval_gettext "Show active Wine processes"`")
  TMP=`mktemp ${TMPDIR:-/tmp}/psout.XXXXXX` || mktemp_error "$?"
  ps axwww|grep wine|grep -v "grep wine" >$TMP
  $DIALOG --tailbox $TMP 60 80
  rm $TMP
  mainmenu
;;
"`eval_gettext "Show installed Software"`")
  testsw "testsw"
  TMP=`mktemp ${TMPDIR:-/tmp}/psout.XXXXXX` || mktemp_error "$?"
  echo -e "`eval_gettext " *** Installed software via registry *** "`" >$TMP
  cat $WINEDIR/installed-software >>$TMP
  echo -e "`eval_gettext "\n\n *** Quiet installed software via registry *** "`" >>$TMP
  cat $WINEDIR/quiet-installed-software >>$TMP
  echo -e "`eval_gettext "\n\n *** Hidden installed software via $CONFIG *** "`" >>$TMP
  grep " = installed at " "$CONFIG" >>$TMP
  echo -e "`eval_gettext "\n\n *** Failed software installations via $CONFIG *** "`" >>$TMP
  grep " = installation failed at " "$CONFIG" >>$TMP
  $DIALOG --no-cancel --tailbox $TMP 60 80
  rm $TMP
  mainmenu
;;
"`eval_gettext "Kill all Wine processes"`")
  $DIALOG  --defaultno --title "`eval_gettext "Kill"`" --yesno "`eval_gettext "Are you shure you want to kill *all* Wine processes???"`" 7 60
  $DIALOG  --title "`eval_gettext "*** NOTICE ***"`" --no-buttons --infobox "`eval_gettext "Please wait..."`" 7 60
  [ "$?" = "0" ] && $WINESERVER -kill
  mainmenu
;;
"`eval_gettext "Save your Wine directory"`")
  cd ~
  TMP=`mktemp ${TMPDIR:-/tmp}/description.XXXXXX` || mktemp_error "$?"
  $DIALOG -stdout --title "`eval_gettext "Create Fake Windows Drive"`" \
          --inputbox "`eval_gettext "Give a description for the file.\nIt will be called wine-<Description>.tar.gz:"`" 300x200 > $TMP
  if [ "$?" = "0" ]; then
    realtar="1"
    if [ -e "$SYSDIR/wine-`cat $TMP`.tar.gz" ]; then
      $DIALOG  --title "`eval_gettext "tar File Exists"`" --yesno "`eval_gettext "The file already exists. Do you want to overwrite?"`" 7 60
      if [ "$?" = "0" ]; then
        realtar="1"
      else
        realtar="0"
      fi
    fi
    if [ "$realtar" = "1" ]; then
      DESCRIPTION=`cat $TMP`
      (tar -cpvzf "$SYSDIR/wine-$DESCRIPTION.tar.gz" .wine; echo -e "`eval_gettext "===============================\nThe file was saved as \n$SYSDIR/wine-$DESCRIPTION.tar.gz\nYou can close the window now!"`")  &>$TMP &
      $DIALOG --tailbox $TMP 60 80
    fi
  fi
  rm $TMP
  mainmenu
;;
"`eval_gettext "Restore your Wine directory"`")
  cd ~
  TMP=`mktemp ${TMPDIR:-/tmp}/description.XXXXXX` || mktemp_error "$?"
  $DIALOG -stdout --title "`eval_gettext "Create Fake Windows Drive"`" \
          --inputbox "`eval_gettext "Give the description for the saved file.\nThe file will be called wine-<Description>.tar.gz:"`" 300x200 > $TMP
  if [ "$?" = "0" ]; then
    realtar="1"
    if [ -e "$SYSDIR/wine-`cat $TMP`.tar.gz" ]; then
      if [ -e ".wine" ]; then
        $DIALOG  --title "`eval_gettext ".wine exists"`" --defaultno --yesno "`eval_gettext "The .wine directory already exists. Do you want to delete it?"`" 7 60
        if [ "$?" = "0" ]; then
          rm -Rf .wine
	  if [ "$?" = "0" ]; then
            realtar="1"
	  else
            $DIALOG  --title "`eval_gettext "*** ERROR ***"`"\ --msgbox "`eval_gettext "There was a error deleting the .wine directory. We can not continue."`" 7 60
            realtar="0"
	  fi
        else
          $DIALOG  --title "`eval_gettext "*** NOTICE ***"`" --msgbox "`eval_gettext "We can not continue!"`" 7 60
          realtar="0"
        fi
      fi
    else
      $DIALOG  --title "`eval_gettext "*** ERROR ***"`"\ --msgbox "`eval_gettext "The tar file does not exist! We can not continue."`" 7 60
      realtar="0"
    fi
    if [ "$realtar" = "1" ]; then
      DESCRIPTION=`cat $TMP`
      (tar -xpvzf "$SYSDIR/wine-$DESCRIPTION.tar.gz"; echo -e "`eval_gettext "===============================\ndone. You can close the window now!"`")  &>$TMP &
      $DIALOG --tailbox $TMP 60 80
    fi
  fi
  rm $TMP
  mainmenu
;;
"`eval_gettext "Modify the Wine configuration"`")
  winecfg
  waitforwineexit
  mainmenu
;;
"`eval_gettext "About"`")
  about
  mainmenu
;;
*)
  mainmenu
;;
esac
;;

1)
    clear
;;
esac
}


#############
### About ###
#############
function about()
{
$DIALOG --title "`eval_gettext "About WineTools"`" \
	--msgbox \
"`eval_gettext "WineTools was initially written by Frank Hendriksen <frank@frankscorner.org>
and was extended and is maintained by Joachim von Thadden <thadden@web.de>
and Sven Paschukat <Sven.Paschukat@t-online.de>.

It is licensed under the GPL.

Send comments, bugreports, etc. to thadden@web.de or Sven.Paschukat@t-online.de.
Don't blame us for the code. It's a horrible hack but it works.

Note:	This software comes with absolutely no warranty.
	You will not get any support or help for WineTools, Wine, software
	installations, Linux or Microsoft Windows from the author. If you need
	help, ask the mailing lists at http://www.winehq.org/site/forums. If you
	want support, buy the commercial versions of wine: CodeWeavers
	CrossOver Office (http://www.codeweavers.com) for Desktop
	Applications or	TransGamings Cedega (formerly known as WineX)
	(http://www.transgaming.com) for playing games."`" 25 80

}


function readme()
{
    TMP=`mktemp ${TMPDIR:-/tmp}/README.XXXXXX` || mktemp_error "$?"
    if [ -e "${BASEDIR}/doc/README.${WINEVER}" ]; then
      cat ${BASEDIR}/doc/README.first ${BASEDIR}/doc/README.${WINEVER} > $TMP
    else
      cat ${BASEDIR}/doc/README.first ${BASEDIR}/doc/README.nover > $TMP
    fi
    $DIALOG --title "`eval_gettext "Intro"`" --fixed-font "" \
	--no-cancel \
	--textbox $TMP 35 60
    rm $TMP
}


####################
### Main Program ###
####################

. ${BASEDIR}/findwine --noexit

# take an old winetools.log to the new format
grep "^\*new\* fake Windows drive created at" "$CONFIG" &>/dev/null
if [ "$?" = "0" ]; then
  sed -e "s/\*new\* fake Windows drive created at/\*new\* fake Windows drive = installed at/" "$CONFIG" > "$CONFIG.new"
  mv -f "$CONFIG.new" "$CONFIG"
  echo "$CONFIG changed to new version"
fi

# find a browser
for n in dillo firefox mozilla konqueror; do
  BROWSER="`which $n 2>/dev/null`"
  [ "$BROWSER" = "" ] || break
done

echo "`eval_gettext "Browser is $BROWSER."`"

[ ! -d $SYSDIR ] && mkdir $SYSDIR

[ ! -d $SYSDIR/fonts ] && mkdir $SYSDIR/fonts

[ ! -d $SYSDIR/sys ] && mkdir -p $SYSDIR/sys/tmp

[ ! -d $SYSDIR/sys/tmp ] && mkdir $SYSDIR/sys/tmp

[ ! -d "${BINDIR}" ] && mkdir "${BINDIR}"

[ -e "$WINEDIR/dosdevices/f:" ] && rm "$WINEDIR/dosdevices/f:" && ln -s "$SYSDIR" "$WINEDIR/dosdevices/f:"

echo "WINEVER is \"$WINEVER\"."

# Version check
VER1=`echo ${WINEVER//[0-9]/}`
VER2=`echo ${VER1:0:1}`
if [ "$VER2" != "." ] ; then 
  # no '.' in the version number, so it's a version < 0.9
  if [ "$WINEVER" -lt "20050628" ]; then
    $DIALOG --title "`eval_gettext "*** ERROR ***"`" \
            --msgbox "`eval_gettext "Winetools cannot run with a Wine version older than 20050628..."`" 6 60
    exit $1
  fi
fi

if [ "$WINEVER" = "0.9" -o "$WINEVER" = "0.9.1" -o "$WINEVER" = "0.9.2" -o "$WINEVER" = "0.9.3" ]; then
  echo "`eval_gettext "Version of Wine is OK."`"
else
  $DIALOG --title "`eval_gettext "*** NOTICE ***"`" --msgbox "`eval_gettext "WineTools is tested with Wine 0.9 - Beta.\nYou use a different version so the results are unpredictable."`" 9 60
fi

echo "`eval_gettext "Calls to wine are executed as "`" "\"$WINE\"."
echo "`eval_gettext "Config is $CONFIG."`"

about
readme
mainmenu
