2020-02-21 21:29:54 -05:00
#!/bin/bash
export WTITLE = "Worlds Linux"
export WORLDSVER = "1922"
export WORLDSDIR = " $( dirname $( readlink -f $0 ) ) "
export WINEPREFIX = " $WORLDSDIR /prefix "
export WINEARCH = win32
export WORLDSINSTALL = " $WINEPREFIX /drive_c/Program Files/Worlds/WorldsPlayer by Worlds.com "
export INSTALLER = " $WORLDSDIR /WorldsInstaller.exe "
export WINE = $( which wine)
2022-05-21 00:20:14 -04:00
export WINETRICKSINSTALL = "win7 droid renderer=gdi glsl=disabled devenum wmp9 dmsynth wmv9vcm directplay quartz ie8 mimeassoc=off"
2020-02-21 21:29:54 -05:00
start ( ) {
2020-04-28 19:23:10 -04:00
errorcheck
zenity --info --title= " $WTITLE Installer " --text 'Welcome to the Worlds Linux setup installer maintained by Wirlaburla. This will setup and install Worlds for use on Linux systems through WINE.' --width= 320 --ok-label= "Next"
2022-05-21 00:20:14 -04:00
zenity --info --title= " $WTITLE Installer " --text 'NOTE: This wrapper has been known to become unreliable and may not work. Worlds is finnicky with WINE and may take manual tinkering to function.' --width= 320 --ok-label= "Next"
2020-04-28 19:23:10 -04:00
settings
}
errorcheck ( ) {
2022-05-21 00:20:14 -04:00
wine --version >> /dev/null || { zenity --error --title= " $WTITLE Installer - Error " --text "Wine wasn't found! Please install it before continuing" --width= 320 ; exit 1; }
2020-04-28 19:23:10 -04:00
winetricks --help >> /dev/null || { zenity --error --title= " $WTITLE Installer - Error " --text "Winetricks wasn't found! Please install it before continuing" --width= 320 ; exit 1; }
wget --help >> /dev/null || { zenity --error --title= " $WTITLE Installer - Error " --text "Wget wasn't found! Please install it before continuing" --width= 320 ; exit 1; }
2020-02-21 21:29:54 -05:00
}
settings ( ) {
2021-01-28 17:04:27 -05:00
SelOptions = $( zenity --list --title= " $WTITLE - Settings " --text= " Installer Options for $WTITLE " --column= 'Option' --column= 'Value' --cancel-label= 'Exit' --extra-button= 'Next' --width= 400 --height= 260 \
2020-04-28 19:23:10 -04:00
"Install Location" " $WORLDSDIR " \
"Wine Location" " $WINE " \
"Prefix Location" " $WINEPREFIX " \
"WineArch" " $WINEARCH " \
"Worlds Version" " $WORLDSVER " \
"Winetricks" " $WINETRICKSINSTALL " \
2>/dev/null)
case $SelOptions in
'Install Location' )
WORLDSDIRSEL = $( zenity --file-selection --directory --title= " $WTITLE - Install Location " --text= "Wrapper Install Location" --save --confirm-overwrite --width= 640 --height= 480)
if [ [ ! $? -eq 1 ] ] ; then
export WORLDSDIR = $WORLDSDIRSEL
fi
settings ; ;
'Wine Location' )
WINESEL = $( zenity --entry --title= " $WTITLE - Wine Binary Location " --text= "Path to wine binary" --entry-text= " $WINE " )
if [ [ ! $? -eq 1 ] ] ; then
export WINE = $WINESEL
fi
settings ; ;
'Prefix Location' )
WINEPREFIXSEL = $( zenity --file-selection --directory --title= " $WTITLE - WinePrefix " --text= "Worlds Prefix location" --save --confirm-overwrite --width= 640 --height= 480)
if [ [ ! $? -eq 1 ] ] ; then
export WINEPREFIX = $WINEPREFIXSEL
fi
settings ; ;
'WineArch' )
WINEARCHSEL = $( zenity --list --radiolist --title= " $WTITLE - WineArch " --text= "Architecture for Wine" --column= 'Use' --column= 'winearch' --hide-header --width= 100 --height= 200 \
TRUE 'win32' \
FALSE 'win64' )
if [ [ ! $? -eq 1 ] ] ; then
export WINEARCH = $WINEARCHSEL
fi
settings ; ;
'Worlds Version' )
WORVERSEL = $( zenity --list --radiolist --title= " $WTITLE - Worlds Version " --text= "Version of Worlds to install" --column= 'Use' --column= 'worldsver' --hide-header --width= 100 --height= 240 \
2022-05-21 00:20:14 -04:00
TRUE '1922a10' \
2020-04-28 19:23:10 -04:00
FALSE '1920' \
FALSE '1900' \
FALSE 'Custom' )
if [ [ ! $? -eq 1 ] ] ; then
export WORLDSVER = $WORVERSEL
fi
settings ; ;
'Winetricks' )
TRICKSEL = $( zenity --entry --title= " $WTITLE - Winetricks " --text= "Component to install." --entry-text= " $WINETRICKSINSTALL " --width= 400)
if [ [ ! $? -eq 1 ] ] ; then
export WINETRICKSINSTALL = $TRICKSEL
fi
settings ; ;
'Next' )
work ; ;
esac
2020-02-21 21:29:54 -05:00
}
work ( ) {
2020-04-28 19:23:10 -04:00
if [ [ " $WORLDSVER " -eq 'Custom' ] ] ; then
INSTALLERSEL = $( zenity --file-selection --title= " $WTITLE - Custom Worlds " --text= "Worlds Custom Executable" --width= 640 --height= 480 --file-filter= 'Windows Executable (exe) | *.exe' )
if [ [ ! $? -eq 1 ] ] ; then
export INSTALLER = $INSTALLERSEL
else
download1922
fi
JAVASEL = $( zenity --question --title= " $WTITLE - Java " --text= "Will this Worlds install require Java 6 to be installed?" --width= 300)
if [ [ ! $? -eq 1 ] ] ; then
java
fi
2022-05-21 00:20:14 -04:00
else
downloadVersion " $WORLDSVER "
2020-04-28 19:23:10 -04:00
fi
tricks
codec
worlds
launchscript | zenity --progress --title= " $WTITLE - Finalizing " --width= 300 --height= 50 --auto-close --auto-kill
2020-09-09 13:54:45 -04:00
chmod +x " $WORLDSDIR /launch.sh "
2020-04-28 19:23:10 -04:00
zenity --info --title= " $WTITLE " --text= " Worlds for Linux Wrapper has been setup and installed. You can now launch Worlds via the launch.sh script available at ' $WORLDSDIR '. " --width= 340 --height= 180
2020-02-21 21:29:54 -05:00
}
2022-05-21 00:20:14 -04:00
downloadVersion ( ) {
local ver = " $1 "
2020-04-28 19:23:10 -04:00
export WORLDSINSTALL = " $WINEPREFIX /drive_c/Program Files/Worlds Inc/WorldsPlayer - Win7 "
2022-05-21 00:20:14 -04:00
wget -O$INSTALLER " https://files.worlio.com/files/WorldsPlayer/software/Worlds $ver .exe " 2>& 1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --title= " $WTITLE - Worlds $ver " --text= "Starting Download.." --width= 300 --height= 50 --auto-close --auto-kill
if [ [ ! $ver -eq "1922a10" ] ] ; then
java
fi
2020-02-21 21:29:54 -05:00
}
java ( ) {
2020-04-28 19:23:10 -04:00
wget -O" $WORLDSDIR /JavaInstaller.exe " "http://users.worldsonline.com/jimbly/java/jre-6u23-windows-i586-s.exe" 2>& 1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --title= " $WTITLE - Downloading Java 6 " --text= "Starting Download..." --width= 300 --height= 50 --auto-close --auto-kill
$WINE " $WORLDSDIR /JavaInstaller.exe " /s 2>& 1 | zenity --title= " $WTITLE - Installing Java " --progress --pulsate --auto-close --width= 300 --height= 50 --auto-kill
2020-02-21 21:29:54 -05:00
}
tricks ( ) {
2020-04-28 19:23:10 -04:00
winetricks -f " $( echo $WINETRICKSINSTALL ) " 2>& 1 | zenity --title= " $WTITLE - Winetricks " --text= "Installing Components. This may require manual interaction." --progress --pulsate --auto-close --width= 340 --height= 50
2020-02-21 21:29:54 -05:00
}
codec( ) {
2020-04-28 19:23:10 -04:00
wget -O" $WORLDSDIR /K-Lite.exe " "https://files3.codecguide.com/K-Lite_Codec_Pack_1535_Full.exe" 2>& 1 | sed -u 's/.* \([0-9]\+%\)\ \+\([0-9.]\+.\) \(.*\)/\1\n# Downloading at \2\/s, ETA \3/' | zenity --progress --title= " $WTITLE - Downloading K-Lite " --text= "Starting Download..." --width= 300 --height= 50 --auto-close --auto-kill
$WINE " $WORLDSDIR /K-Lite.exe " 2>& 1 | zenity --title= " $WTITLE - Installing K-Lite " --text= "Please complete the setup." --progress --pulsate --auto-close --width= 300 --height= 50 --auto-kill
2020-02-21 21:29:54 -05:00
}
worlds ( ) {
2020-04-28 19:23:10 -04:00
wine " $( echo $INSTALLER ) " 2>& 1 | zenity --title= " $WTITLE - Worlds Install " --text= "Installing Worlds. Please complete the setup. Do NOT change the install location!" --progress --pulsate --auto-close --width= 300 --height= 50 --auto-kill
2020-02-21 21:29:54 -05:00
}
launchscript ( ) {
2022-05-21 00:20:14 -04:00
wget -O" $WORLDSDIR /launch.sh " "https://github.com/Wirlaburla/Worlds-LinuxScript/blob/master/launch.sh"
wget -qO- "http://www.worlds.net/favicon.ico" | convert - " $WORLDSDIR /icon.png "
2020-04-28 19:23:10 -04:00
rm " $WORLDSDIR /wrldslinux "
echo "# Configuration for Worlds on Linux." > " $WORLDSDIR /wrldslinux "
2021-01-28 17:04:27 -05:00
echo " export WINE=\" $WINE \" " >> " $WORLDSDIR /wrldslinux "
echo " export WINEPREFIX=\" $WINEPREFIX \" " >> " $WORLDSDIR /wrldslinux "
echo " export WORLDSDIR=\" $WORLDSDIR \" " >> " $WORLDSDIR /wrldslinux "
echo " export WORLDSINSTALL=\" $WORLDSINSTALL \" " >> " $WORLDSDIR /wrldslinux "
2020-04-28 19:23:10 -04:00
echo " source \" $WORLDSDIR /wlrdscmd\" " >> " $WORLDSDIR /wrldslinux "
2021-01-28 17:04:27 -05:00
touch " $WORLDSDIR /wlrdscmd "
2020-04-28 19:23:10 -04:00
rm " $HOME /Desktop/WorldsPlayer Win7.* "
2021-01-28 17:20:44 -05:00
menufile
}
menufile ( ) {
2022-05-21 00:20:14 -04:00
wget -O" $WORLDSDIR /worlds.desktop " "https://github.com/Wirlaburla/Worlds-LinuxScript/blob/master/worlds.desktop"
2021-01-28 17:31:17 -05:00
echo "" > " $HOME /.local/share/applications/worlds.desktop " #Making sure the file is clear.
2021-01-28 17:20:44 -05:00
while read line
do
2021-01-28 17:31:17 -05:00
line = ${ line / \$ {WORLDSDIR \} / $WORLDSDIR }
2021-01-28 17:20:44 -05:00
echo $line >> " $HOME /.local/share/applications/worlds.desktop "
done < " $WORLDSDIR /worlds.desktop "
2020-02-21 21:29:54 -05:00
}
start