#!/bin/sh DIALOG="/opt/winetools/Xdialog" icondir="/opt/winetools/icon" fonturl="http://umn.dl.sourceforge.net/sourceforge/corefonts" fontdir="${HOME}/winetools/fonts" sysdir="${HOME}/winetools/sys" appdir="${HOME}/winetools/apps" scriptdir="/opt/winetools/scripts" . /opt/winetools/appsinstall ######################### ### Create fake drive ### ######################### function createdrive() { cd /opt/winetools $DIALOG --title "Create Fake Windows Drive" \ --no-cancel \ --inputbox "What's the mount point of the cdrom/dvd drive?\n e.g. /mnt/cdrom:" 300x200 2> /tmp/cdrom.tmp.$$ retval=$? cdrom=`cat /tmp/cdrom.tmp.$$` rm -f /tmp/cdrom.tmp.$$ case $retval in 0) sed s#cdrommount#${cdrom}#g config.orig > /tmp/config.1 ;; 1) mainmenu;; esac $DIALOG --title "Create Fake Windows Drive" \ --no-cancel \ --inputbox "What's the device name of the cdrom/dvd drive?\n e.g. /dev/cdrom:" 300x200 2> /tmp/cdrom.tmp.$$ retval=$? cdrom=`cat /tmp/cdrom.tmp.$$` rm -f /tmp/cdrom.tmp.$$ case $retval in 0) cp c_drive.tgz $HOME cd ~/ tar zxvf c_drive.tgz rm -f c_drive.tgz sed s#cdromdevice#${cdrom}#g /tmp/config.1 > ~/.wine/config rm -f /tmp/config.1 $DIALOG --title "Create Fake Windows Drive" \ --no-cancel \ --msgbox "Fake Windows drive created in ~/.wine." 0 0 case $? in 0) mainmenu;; esac ;; esac } ################## ### Fonts menu ### ################## function fonts() { $DIALOG --title "WineTools" \ --cancel-label "Main menu" \ --icon $icondir/font.xpm \ --menu "Install Corefonts" 400x300 0 \ "Andale" "" \ "Arial" "" \ "Arial Black" "" \ "Comic Sans" "" \ "Courier New" "" \ "Georgia" "" \ "Impact" "" \ "Times New Roman" "" \ "Trebuchet" "" \ "Verdana" "" \ "Webdings" "" 2> /tmp/menu.tmp.$$ retval=$? choice=`cat /tmp/menu.tmp.$$` rm -f /tmp/menu.tmp.$$ case $retval in 0) case $choice in Andale) fontname="andale32.exe" dlsize=198384 fontsinstall ;; Arial) fontname="arial32.exe" dlsize="554208" fontsinstall ;; "Arial Black") fontname="arialb32.exe" dlsize="168176" fontsinstall ;; "Comic Sans") fontname="comic32.exe" dlsize="246008" fontsinstall ;; "Courier New") fontname="courie32.exe" dlsize="646368" fontsinstall ;; Georgia) fontname="georgi32.exe" dlsize="392440" fontsinstall ;; Impact) fontname="impact32.exe" dlsize="173288" fontsinstall ;; "Times New Roman") fontname="times32.exe" dlsize="661728" fontsinstall ;; Trebuchet) fontname="trebuc32.exe" dlsize="357200" fontsinstall ;; Verdana) fontname="verdan32.exe" dlsize="351992" fontsinstall ;; Webdings) fontname="webdin32.exe" dlsize="185072" fontsinstall esac ;; 1) mainmenu ;; esac } ############################## ### Fonts download/install ### ############################## function fontsinstall() { { cd $fontdir touch $fontname wget ${fonturl}/${fontname} -O $fontname 2>/dev/null & echo 0 while [ "$PROGRESS" != "$dlsize" ] do PROGRESS=$(du -b $fontname > temp && cut -f 1 temp) echo $[PROGRESS*100/dlsize] done echo 100 } | $DIALOG --title "Downloading" --gauge "Downloading font" 7 60 0 wine ${fontdir}/$fontname fonts } ############################ ### Install system files ### ############################ function sysinstall() { { cd $sysdir touch $sysname wget $dload -O $sysname 2>/dev/null & echo 0 while [ "$PROGRESS" != "$dlsize" ] do PROGRESS=$(du -b $sysname > temp && cut -f 1 temp) echo $[PROGRESS*100/dlsize] done echo 100 } | $DIALOG --title "Downloading" --gauge "Downloading..." 7 60 0 } ######################### ### System files menu ### ######################### function systemmenu() { $DIALOG --title "WineTools" \ --cancel-label "Main menu" \ --icon $icondir/computer.xpm \ --menu "Install system files" 400x300 0 \ "DCOM98" "" \ "HTML Help Update Package" "" \ "Visual C++ run-time" "" \ "Visual Basic 5 Runtime" "" \ "Visual Basic 6 Runtime" "" \ "Windows Installer" "" \ "Windows Script 5.6" "" 2> /tmp/menu.tmp.$$ retval=$? choice=`cat /tmp/menu.tmp.$$` rm -f /tmp/menu.tmp.$$ case $retval in 0) case $choice in DCOM98) dload="wget http://download.microsoft.com/download/4/e/d/4ed95acc-1fcf-4d94-b811-a684c0a709de/DCOM98.EXE" dlsize="1229056" sysname="dcom98.exe" sysinstall WINEDLLOVERRIDES="ole32=n" wine ${sysdir}/dcom98.exe systemmenu ;; "HTML Help Update Package") dload="wget http://go.microsoft.com/fwlink/?LinkId=14498" dlsize="752944" sysname="HHUPD.EXE" sysinstall wine ${sysdir}/HHUPD.EXE systemmenu ;; "Visual C++ run-time") dload="wget http://franksworld.net/files/vcredist.exe" sysname="vcredist.exe" dlsize="1807072" sysinstall wine ${sysdir}/vcredist.exe systemmenu ;; "Visual Basic 5 Runtime") dload="wget http://download.microsoft.com/download/vb50pro/utility/1/win98/EN-US/Msvbvm50.exe" sysname="Msvbm50.exe" dlsize="992864" sysinstall wine ${sysdir}/Msvbm50.exe systemmenu ;; "Visual Basic 6 Runtime") dload="wget http://download.microsoft.com/download/vb60pro/install/6/Win98Me/EN-US/VBRun60.exe" sysname="VBRun60.exe" dlsize="1067688" sysinstall wine ${sysdir}/VBRun60.exe systemmenu ;; "Windows Installer") dload="wget http://download.microsoft.com/download/WindowsInstaller/Install/2.0/W9XMe/EN-US/InstMsiA.exe" sysname="InstMsiA.exe" dlsize="1709160" sysinstall wine ${sysdir}/InstMsiA.exe systemmenu ;; "Windows Script 5.6") dload="http://download.microsoft.com/download/winscript56/Install/5.6/W9XNT4Me/EN-US/scr56en.exe" sysname="scr56en.exe" dlsize="732768" sysinstall wine ${sysdir}/scr56en.exe systemmenu ;; esac ;; 1) mainmenu ;; esac } ############################ ### Install applications ### ############################ function appsmenu() { $DIALOG --title "WineTools" \ --cancel-label "Main menu" \ --icon $icondir/apps.xpm \ --menu "Install an application" 400x300 0 \ ">> Install applications info <<" ""\ " " "" \ "Acrobat Reader 5.1" "" \ "Agent Newsreader 2.0" "" \ "Eudora 6.0" "" \ "Excel Viewer" "" \ "Internet Explorer 6.0 SP1" "" \ "mIRC 6.0" "" \ "Notes 5" "" \ "Microsoft Office 2000" "" \ "Photoshop 7" "" \ "Powerpoint Viewer" "" \ "The Bat! 2.0" "" \ "Windows Media Player 6.4" "" \ "WinZip 9.0" "" 2> /tmp/menu.tmp.$$ retval=$? choice=`cat /tmp/menu.tmp.$$` rm -f /tmp/menu.tmp.$$ case $retval in 0) case $choice in ">> Install applications info <<") $DIALOG --title "WineTools" \ --msgbox "* If you use the Wine config generated by WineTools the applications will be installed in $HOME/.wine/fake_windows. * Install DCOM98 before you install an application. * Make sure you use the Wine config from WineTools. * There will be a startup script for the installed application in $HOME/bin." 0 0 case $? in 0) appsmenu ;; esac ;; "Acrobat Reader 5.1") acroread51 appsmenu ;; "Agent Newsreader 2.0") agent2 appsmenu ;; "Excel Viewer") excelviewer appsmenu ;; "Eudora 6.0") eudora6 appsmenu ;; "Internet Explorer 6.0 SP1") iexplorer appsmenu ;; "mIRC 6.0") mirc6 appsmenu ;; "Notes 5") notes5 appsmenu ;; "Microsoft Office 2000") office2000 appsmenu ;; "Photoshop 7") photoshop7 appsmenu ;; "Powerpoint Viewer") powerpointviewer appsmenu ;; "The Bat! 2.0") thebat2 appsmenu ;; "Windows Media Player 6.4") winmp appsmenu ;; "WinZip 9.0") winzip9 appsmenu ;; #"Word Viewer") # wordviewer # appsmenu esac ;; 1) mainmenu ;; esac } ################ function appinfo() { $DIALOG --title "Info" \ --msgbox "If you use the Wine config generated by WineTools the applications will be installed in $HOME/.wine/c. " 0 0 # There will be a startup script for the application in $HOME/bin. \ # If your fake Windows drive is located somewhere else you must edit the scripts." 0 0 } ################# ### Main menu ### ################# function mainmenu() { $DIALOG --title "WineTools 2.1.0" \ --cancel-label "exit" \ --icon $icondir/wt.xpm \ --menu "" 400x300 0 \ "Create a fake Windows drive" "" \ "Install Microsoft TrueType core fonts" "" \ "Install Windows system files" "" \ "Install applications" "" \ "Edit the Wine configuration file" "" \ " " "" \ "About" "" 2> /tmp/menu.tmp.$$ retval=$? choice=`cat /tmp/menu.tmp.$$` rm -f /tmp/menu.tmp.$$ case $retval in 0) case $choice in "Create a fake Windows drive") createdrive ;; "Install Microsoft TrueType core fonts") fonts ;; "Install Windows system files") systemmenu ;; "Install applications") appsmenu ;; "Edit the Wine configuration file") editconfig ;; "About") about esac ;; 1) clear ;; esac } ################### ### Edit config ### ################### function editconfig() { cp ~/.wine/config ~/.wine/config.bak text=`cat ~/.wine/config` cat << EOF > /tmp/xedit.$$ $text EOF $DIALOG --title "Edit Wine config" --fixed-font "" \ --ok-label "Save" \ --editbox /tmp/xedit.$$ 0 0 2>~/.wine/config case $? in 0) mainmenu ;; 1) cp ~/.wine/config.bak ~/.wine/config mainmenu ;; esac rm -f /tmp/xedit$$ } ############# ### About ### ############# function about() { $DIALOG --title "About WineTools" \ --msgbox "WineTools was written by Frank Hendriksen and is licensed under the GPL Send comments, bugreports, etc. to frank@franksworld.net" 0 0 case $? in 0) mainmenu;; esac } #################### ### Main Program ### #################### if [ ! -d ${HOME}/winetools ]; then mkdir ${HOME}/winetools fi if [ ! -d ${HOME}/winetools/fonts ]; then mkdir ${HOME}/winetools/fonts fi if [ ! -d ${HOME}/winetools/sys ]; then mkdir ${HOME}/winetools/sys fi if [ ! -d ${HOME}/winetools/apps ]; then mkdir ${HOME}/winetools/apps fi if [ ! -d ${HOME}/bin ]; then mkdir ${HOME}/bin fi mainmenu