All pastes #1891207 Raw Edit

lotrosetup-0.1.5.sh

public shellscript v1 · immutable
#1891207 ·published 2010-06-28 16:49 UTC
rendered paste body
#!/bin/bash# lotrosetup.sh v0.1.6-wip# A setup script for running Lord of the Rings Online (tm) on a GNU/Linux# system using Wine.## Copyright (C) 2009-2010 Daniel Santos (daniel.santos@pobox.com)#               2009 G. Chaviaras (gabri3l@windowslive.com)## This program is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program.  If not, see <http://www.gnu.org/licenses/>.## Lord of the Rings Online is probably a trademark of Turbine, Inc.# If not, they may need a new attorney.# Revision History# ================# 0.1.6# 0.1.5#	* Utilizing winetricks win2k target instead of having users manually set it#	  via winecfg.#	* Re-added install for msvc runtimes (since they are needed again)#	* Modified install of msvcrt so it is now quite (no GUI to screw with)#	* Modified all wine/windows directory sniffing so that it calls wine's "cmd"#	  program to obtain the values from standard windows/dos shell variables.#	* Moved winecfg invocation and changed text, so it is not manditory anymore#	* Adding install for directx9 redistributable downloaded from turbine.## 0.1.4a#	* Added new download link for EU version## 0.1.4#	* Replaced bad assumptions about where wine user directory with call to#	  "wine cmd \c echo %USERPROFILE%".#	* Cleaned up user_profile & my_documents directory handling some more.#	* Using realpath when available for clarity when displaying paths.#	* Added download for an icon off of lotro.com to use on desktop#	* Added some variable documentation## History not recorded previous to 0.1.4# Initialization# ==============script_version="0.1.6-wip"				# script versionthis_script="${PWD}/$0"				# this scriptWINEPREFIX="${HOME}/.wine-lotro"	# default WINEPREFIXprogram_files_dir=""program_files_hard_dir=""user_profile_dir=""					# The wine user profile dir (possibly containing symlinks)user_profile_hard_dir=""			# The hard wine user profile dirmy_documents_dir=""					# The My Documents dirmy_documents_hard_dir=""			# The hard My Documents dirregion=""							# us or euregion_company=""					# Turbine for us, Codemasters for eulotro_dir=""						# The lotro dir (Program Files/Turbine/etc...)launcher_full_path=""				# The launcher script (in it's final location)#temp_dir="$(pwd)/lotrosetup.$$"		# temporary directorytypeset -i num_install_options=0typeset -i videomem=0				# Amount of video memorytypeset -i current_step=0			# Used by print_headertypeset -i root_pid=$$				# the root process ID of this scriptwinetricks_url="http://www.kegel.com/wine/winetricks"launcher_script_url="http://bmx-chemnitz.de/%7Emfr/LOTRO/lotrolauncher.script"urlencode_sh_url="http://www.shelldorado.de/scripts/cmds/urlencode.txt"dx9_url="http://download.level3.turbine.com/tdm/dependencies/dx9c.exe"# The installer_table variables hold installer information in a pipe# character delimited format, similar to an /etc/passwd file (which is# actually colen delimited).  Each line (record) has the following four# fields:# * Region# * Version Code# * High Resolution# * Title      - the primary text describing the download# * Resolution - either H for "High" or S for "Standard"# * Location   - the base domain name of the download location.# * URL        - the URL of the downloadinstaller_table="us|SoM|1|turbine.com    |http://cdn.content.turbine.com/sites/clientdl/lotro/lotrohigh.exeus|SoM|0|turbine.com    |http://cdn.content.turbine.com/sites/clientdl/lotro/lotrostandard.exeus|MoM|1|turbine.com    |http://download.lotro.level3.turbine.com/largecontent/lotro/moria/downloader/live/highres/LOTRO-US-MinesofMoria-Downloader-HighRes.exeus|MoM|0|turbine.com    |http://download.lotro.level3.turbine.com/largecontent/lotro/moria/downloader/live/standardres/LOTRO-US-MinesofMoria-Downloader-StandardRes.exeeu|SoM|1|codemasters.com|http://94.75.196.36/LOTRO/LOTROEU_Mirkwood_Installer/ENGB/Lord_Of_The_Rings_Online_Mirkwood_Installer_ENGB.exeeu|MoM|1|gamershell.com |http://www.gamershell.com/downloads/start.html?id=45212&mirror=6&cat=demo&filename=Lord_Of_The_Rings_Online_VII_B7_EN_GB.zip&ts=1251640397&auth=6a6877615a512e6449787a2f51eu|MoM|0|internode.com  |http://files-euaf-syd.games.on.net/download/349765761420-5937460637250-11447424108618-adaf14ad3bd598aedaf291e64f2e2ccc-494157377184-2008356-49301112096/Lord_Of_The_Rings_Online_VII_B7_EN_GB.zip"ini_file_settings="[Display]AllowFakeFullScreen=FalseFullScreen=True[Render]VideoPostEffects=FalseLandscapeStaticObjectShadows=Low"################################################################################ Function  : die# Parameters: An explaination of the failure.# Prints an error message with the specified text and exits with a non-zero# return value.###############################################################################die() {	echo >&2	echo "ERROR: $*" >&2	pkill -P $root_pid	kill $root_pid	exit 1}################################################################################ Function  : yesno# Parameters: 1 The first parameter is the default value (i.e., what is #               evaluated if the user just presses enter).  To have no default#               value, pass  an empty string or any character other than "y"#               or "n".#             2 All remaining arguments are treated as the prompt.# Prompts the user with the supplied prompt continually until a valid respose# is supplied (either "y" or "n" in any case or any word that starts with one# of those two characters).  Returns zero if "y" was supplied, non-zero# otherwise.###############################################################################yesno() {	# If an empty string is passed, then there is no default value	local default="${1:-z}"	shift	local prompt="$*"	while true; do		echo -n "${prompt}"		read		REPLY="${REPLY}${default}"		if [ "${REPLY:0:1}" = "y" ]; then			return 0;		elif [ "${REPLY:0:1}" = "n" ]; then			return 1;		fi		unset REPLY	done}################################################################################ Function  : print_header# Parameters: Text to pring# Prints a header to standard out.###############################################################################print_header() {	current_step=${current_step}+1	echo "################################################################################ Step ${current_step}: $*"}################################################################################ Function  : guess_video_memory_lspci# Parameters: none# Attempts to get size of video memory using lspci and returns it to standard# out.###############################################################################guess_video_memory_lspci() {	test -x /usr/sbin/lspci || return 1	slot="$(/usr/sbin/lspci |		grep "VGA compatible controller:" |		awk '{print $1}')"	test -n "${slot}" || return 1	echo "$(/usr/sbin/lspci -vs ${slot} |		egrep ' prefetchable\) \[size=[0-9]+M' |		perl -pe 's/.*size=([0-9]+)M.*/$1/g')" || return 1	return 0}################################################################################ Function  : guess_video_memory_xorg# Parameters: none# Attempts to get size of video memory from xorg log file and returns it to# standard out.###############################################################################guess_video_memory_xorg() {	test -r /var/log/Xorg.0.log || return 1	egrep "Memory: [0-9]+ kBytes" /var/log/Xorg.0.log |		perl -pe 's/.*Memory: ([0-9]+) kBytes.*/$1/g'}################################################################################ Function  : guess_video_memory# Parameters: none# Attempt to retrieve video memory size and stores it in the global videomem# variable.###############################################################################guess_video_memory() {	echo	echo "Sniffing video memory via lspci..."	typeset -i lspci_videomem="$(guess_video_memory_lspci)"	typeset -i lspci_result=$?	if [ $lspci_result -eq 0 ]; then		echo "...lspci says you have ${lspci_videomem}MiB of video memory."	else		echo "...lspci can't tell us how much video memory you have."	fi	echo	echo "Sniffing video memory from xorg log file..."	typeset -i xorg_videomem="$(guess_video_memory_xorg)/1024"	typeset -i xorg_result=$?	if [ $xorg_result -eq 0 ]; then		echo "...xorg things you have ${xorg_videomem}MiB of video memory."	else		echo "...can't get video memory from xorg log file."	fi	echo	if [ $lspci_result -ne 0 -a $xorg_result -ne 0 ]; then		echo "Failed to determine video memory, please specify correct amount."		return 1;	fi	# If we got a value from the xorg log, and it's greater than what we got	# from lspci, the xorg value is almost certainly the correct one.	if [ $xorg_videomem -eq $lspci_videomem ]; then		echo "Values agree\! Using ${xorg_videomem}."		videomem=$xorg_videomem	elif [ $lspci_result -ne 0 -o $xorg_videomem -gt $lspci_videomem ]; then		echo "Using value from xorg log file."		videomem=$xorg_videomem	else		echo "Using value from lspci."		videomem=$lspci_result	fi	return 0;}################################################################################ Function  : init_region# Parameters: none# Initializes all variables specific to either the US or EU regions.###############################################################################init_region() {	local table	case $region in		us) table="$installer_table_us"			region_company="Turbine"			;;		eu) table="$installer_table_eu"			region_company="Codemasters"			;;	esac	num_install_options=0	unset install_name	unset install_url	OLDIFS="$IFS"	IFS=""	for line in ${table}; do		if [ -n "$line" ]; then			num_install_options=${num_install_options}+1			install_name[${num_install_options}]="$(				echo $line | awk '-F|' '{print $1}'			)"			install_url[${num_install_options}]="$(				echo $line | awk '-F|' '{print $2}'			)"		fi	done	IFS="$OLDIFS"}################################################################################ Function  : resolve_hard_dir# Parameters: the directory to resolve# Get's the hard path of the supplied directory and outputs to standard out.# Returns non-zero upon failure.###############################################################################resolve_hard_dir() {	test -e "$1" || die "Directory does not exist: $1" >&2#	if [[ ! -e "$1" ]]; then#		die "Directory does not exist: $1" >&2#		return 1;#	fi	if which realpath > /dev/null 2>&1; then		realpath "$1"	else		echo "Warning: realpath not installed. Be aware that paths displayed  may include nested symlinks." >&2		echo "$1"	fi}################################################################################ Function  : get_wine_variable# Parameters: the name of the variable (without the surrounding percent signs)# Returns the *nix path equivilant to the supplied wine variable's path.###############################################################################get_wine_variable() {	winepath -u "$(wine cmd /c echo %"$1"% | tr -d '\r')" ||		die "Failed to get *nix path for wine variable $1"}################################################################################ Function  : init_wine_dirs# Parameters: none# Initializes the following variables:#   program_files_dir#   program_files_hard_dir#   user_profile_dir#   user_profile_hard_dir#   my_documents_dir#   my_documents_hard_dir###############################################################################init_wine_dirs() {	program_files_dir=$(get_wine_variable ProgramFiles)	program_files_hard_dir=$(resolve_hard_dir "${program_files_dir}")	# Initialize user_profile_dir	user_profile_dir=$(get_wine_variable USERPROFILE)	user_profile_hard_dir=$(resolve_hard_dir "${user_profile_dir}")	# Initialize my_documents_dir	# First try getting My Documents shell folder from registry	typeset my_documents_dos_dir=$(		grep '"Personal"="' "${WINEPREFIX}/userdef.reg" |		awk -F= '{print $2}' || echo "failed")	# Did it work or should we guess?	if [ "${my_documents_dos_dir}" != "failed" ]; then		my_documents_dir=$(eval winepath -u "${my_documents_dos_dir}")	else		# fuck it, just make an assumption...		my_documents_dir="${user_profile_dir}/My Documents"	fi	my_documents_hard_dir=$(resolve_hard_dir "${my_documents_dir}")}################################################################################ Function  : get_desktop_downloader# Parameters: none# Generate a standard .desktop entry to launch the installer# See http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.0.html###############################################################################get_desktop_downloader() {	cat << asdf[Desktop Entry]Version=1.0Type=ApplicationName=LOTRO DownloaderComment=Downloader for Lord of the Rings Online ${sel_name}.Exec=env WINEPREFIX="${WINEPREFIX}" wine "${installer_full_path}"Terminal=trueTerminalOptions=\sasdf}################################################################################ Function  : get_desktop_launcher# Parameters: none# Generate a standard .desktop entry for the launcher script using values from# global variables and output to standard out.###############################################################################get_desktop_launcher() {	# Try to download a usable icon first, otherwise, we can use mce.png, but	# it doesn't exist until after the install	typeset icon_path="${lotro_dir}/mce.png"	wget -O "${lotro_dir}/quest_ring.gif" http://content.turbine.com/sites/lorebook.lotro.com/images/icons/quest_ring.gif > /dev/null	if [ -f "${lotro_dir}/quest_ring.gif" ]; then		icon_path="${lotro_dir}/quest_ring.gif"	fi	cat << asdf[Desktop Entry]Version=1.0Type=ApplicationName=LOTRO LauncherComment=The Lord of the Rings Online patcher and launcher for GNU/Linux.Exec=env WINEPREFIX="${WINEPREFIX}" "${launcher_full_path}"Path="${lotro_dir}"# It would be better to use icon.ico, but it would need to be converted to a# .png or .svg first.Icon=${icon_path}Terminal=trueTerminalOptions=\sasdf}merged_registry_entries() {	tmp_reg_file=/tmp/lotrosetup.sh.$$.reg	cat << asdf > ${tmp_reg_file}REGEDIT4[HKEY_LOCAL_MACHINE\Software\Microsoft\NET Framework Setup\NDP\v1.1.4322]"Install"=dword:00000001"SP"=dword:00000001[HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\policy\v1.1]"4322"="3706-4322"[HKEY_CURRENT_USER\Software\Wine\Direct3D]"UseGLSL"="enabled""VideoMemorySize"="${videomem}"asdf	regedit ${tmp_reg_file} || die "registry setup failed (regedit returned non-zero)"	rm ${tmp_reg_file}}################################################################################ Function  : get_launcher_patch# Parameters: none# Extracts patch file from this script###############################################################################get_launcher_patch () {	tail -19 "${this_script}"}################################################################################ Function  : install_desktop_item# Parameters: The desktop file to install###############################################################################install_desktop_item() {	typeset desktop_file="$1"	if which xdg-desktop-icon > /dev/null; then		xdg-desktop-icon install --novendor "${desktop_file}" ||			die "xdg-desktop-icon failed"	else		echo "Can't find xdg-desktop-icon, attempting manual install..."		# Initialize with a best guess value		desktop_dir="${HOME}/Desktop"		if which xdg-user-dir > /dev/null; then			desktop_dir="$(xdg-user-dir DESKTOP)"		fi		test -e "${desktop_dir}" ||			die "Can't figure out which directory the desktop is in.  Please"\				"report this as a bug."		cp "${desktop_file}" "${desktop_dir}/" ||			die "failed to copy launcher to desktop"	fi}main() {	# Sanity checks	# =============	which winecfg > /dev/null || die "Wine does not appear to be installed."	which wget > /dev/null || die "wget not installed. This script requires wget."#	mkdir "${temp_dir}" || die "failed to create temporary directory ${temp_dir}."	# Intruduction & selection of WINEPREFIX	# ======================================	print_header "Intruction & WINEPREFIX Selection"	echo -n "Welcome to the LOTRO Linux Setup script v${script_version}!This script will setup Lord of the Rings Online on a GNU/Linux systemwith wine (http://winehq.org) installed.  It is reccomended that youinstall LOTRO in its own .wine directory to avoid conflits with otherapplications and that is what this script is designed to do.Please email bugs to daniel.santos@pobox.com or post tohttp://appdb.winehq.org/objectManager.php?sClass=version&iId=14566Enter the WINEPREFIX where you want to install LOTRO or press enterDEFAULT VALUE (${WINEPREFIX}): "	read	echo	echo	export WINEPREFIX="${REPLY:-"${WINEPREFIX}"}"	test -e ${WINEPREFIX} && die "${WINEPREFIX} already exists.  This script " \		"is only designed to create a fresh LOTRO install environment. " \		"Please move or remove ${WINEPREFIX} and run this script again."	# Region	# ======	print_header "Select Region"	unset REPLY	while [ "${REPLY}" != "us" -a "${REPLY}" != "eu" ]; do		echo "Enter the region you want to install.  Choices are 'us' and 'eu'."		echo -e "Region: \c "		read	done	region="${REPLY}"	# Video memory	# ============	print_header "Specify Video Memory"	guess_video_memory	let videomem_selected=0	while [ ${videomem_selected} -eq 0 ]; do		echo -n "Enter the amount of memory your video card has in MiB" \			"(${videomem}): "		read		let videomem="${REPLY:-${videomem}}"		test ${videomem} -gt 0 && let videomem_selected=1	done	echo "Video memory = ${videomem}MiB"	echo	echo	# Select install version	# ======================	print_header "Installation Type"	init_region	echo "\Select which version of LOTRO you want to install.  (Note that older versionscan be installed and the launcher will patch them. You can use this if youhave already downloaded a previous version and want to use that instead ofdownloading the new installer.)"	typeset -i i	for (( i=1; $i<=${num_install_options}; i=$i+1 )); do		echo "    ${i}. ${install_name[${i}]}"	done	echo	typeset -i selection=0	while [ ${selection} -lt 1 -o ${selection} -gt ${num_install_options} ]; do		echo -n "Enter selection [1-${num_install_options}]: "		read		let selection="${REPLY}" > /dev/null 2>&1	done	echo	echo	url="${install_url[${selection}]}"	sel_name="${install_name[${selection}]}"	# Settings Confirmation	# =====================	print_header "Confirm Settings"	echo "We are ready to begin.  Please confirm that your choices are correct."	echo "WINEPREFIX    = ${WINEPREFIX}"	echo "Video Memory  = ${videomem}MiB"	echo "Region        = ${region}"	echo "LOTRO Version = ${sel_name}"	echo	if yesno "y" "Continue with these settings [Y/n]? "; then		echo	else		echo		echo "Exiting.  (no changes have been made)."		exit 1	fi	echo	echo	# Create initial Wine directory	# =============================	print_header "Initializing Wine Environment"	echo "Initializing ${WINEPREFIX}... (this can take up to 30 seconds or so)	"	# Initialize the new WINEPREFIX and wait for the wineserver to exit	if which wineprefixcreate > /dev/null 2>&1 ; then		WINEDEBUG=fixme-all wineprefixcreate -w ||			die "wineprefixcreate returned non-zero"	else		WINEDEBUG=fixme-all wine cmd /c echo Succeeded ||			die "wineprefixcreate returned non-zero"	fi	wineserver -k	# Intialize user profile variables	sync	init_wine_dirs	# By default, we want to setup My Documents as non-linked.  The user can	# change this when running winecfg if they choose, but I find the default	# value to be a pain in the ass.	if [ -L "${my_documents_dir}" ]; then		rm "${my_documents_dir}"		mkdir -p "${my_documents_dir}"	fi	# Re-initialize variables	init_wine_dirs	echo "done!"	echo	echo	# Setup registry	# ==============	print_header "Setting up registry..."	merged_registry_entries	echo "done!"	echo	echo	# Install winetricks	# ==================	print_header "Installing Dependencies (winetricks)..."	echo "Installing winetricks..."	winetricks_dir="${program_files_hard_dir}"	mkdir -p "${winetricks_dir}"	winetricks="${winetricks_dir}/winetricks"	cd "${winetricks_dir}"	wget -nv "${winetricks_url}"	test -f "${winetricks}" || die "Failed to download or locate winetricks"	chmod u+x "${winetricks}" || die "chmod failed"	echo "done!"	echo	echo	# psudo-target to set windows version	"${winetricks}" win2k || die "Failed to set windows version via winetricks!"	# Install gecko	# =============	print_header "Installing Dependencies (Gecko)..."	# ignored on newer versions of wine, needed on older	"${winetricks}" gecko || die "Install of gecko failed!"	echo "done!"	echo	echo	# Install msvc run time if pre-MoM	# ================================	# OK, so it wasn't needed for MoM, but it's needed again for Siege of Mirkwood, go figure :(	#if [ ${selection} -gt 2 ]; then		print_header "Installing Dependencies (MSVC++ Runtime Libraries)..."		# this winetricks package includes sp1 now		WINETRICKS_QUIET=/q:a "${winetricks}" vcrun2005 ||			die "Install of visual C++ runtime libraries failed!"		echo "done!"		echo	#fi	# Install Turbine's bundling of the dx9 redistributable	# =============	print_header "Installing Microsoft Visual DirectX 9.0c Redistributable..."	wget ${dx9_url}	wine $(basename ${dx9_url})	# Run winecfg	# ===========	print_header "Configure Wine Environment"	echo "You may now (optionally) run the Wine configuration utility (winecfg) to makeany other desired changes prior to proceeding. Of particular interest, thisscript has altered the default \"My Documents\" location (you can change itunder the \"Desktop Integration\" tab if you wish."	if yesno "n" "Run the Wine configuration utility? [y/N]? "; then		echo "Running winecfg..."		WINEDEBUG=fixme-all winecfg ||			die "Failed to execute $(which winecfg) or winecfg returned non-zero."		echo "Waiting for wine server to exit..."		wineserver -w	fi	# Re-initialize values	init_wine_dirs	# Create initial UserPreferences.ini file	# =======================================	print_header "Creating initial UserPreferences.ini file..."	lotro_config_dir="${my_documents_dir}/The Lord of the Rings Online"	ini_file="${lotro_config_dir}/UserPreferences.ini"	typeset -i write_ini=1	mkdir -p "${lotro_config_dir}" || die "mkdir failed"	if [ -e "${ini_file}" ]; then		echo "The LOTRO perferences file $(resolve_hard_dir "${ini_file}") already exists."		if yesno "y" "Backup old file and create new one [Y/n]? "; then			ini_backup_file="${ini_file}.$(date '+%Y%m%d_%H%M%S')"			mv "${ini_file}" "${ini_backup_file}"		else			write_ini=0			echo "Ok, leaving it alone.  If you have problems, be sure and read the manual steps"			echo "for UserPreferences.ini on the appdb page for LOTRO. Press ENTER to continue."			read		fi	fi	if [ ${write_ini} -ne 0 ]; then		echo "${ini_file_settings}" > "${ini_file}" ||			die "failed to create initial UserPreferences.ini file"	fi	echo "done!"	echo	echo	# Install and patch launcher script	# ================================	print_header "Installing Launcher Script..."	lotro_dir="${program_files_hard_dir}/Turbine/The Lord of the Rings Online"	launcher_full_path="${lotro_dir}/lotrolauncher.sh"	mkdir -p "${lotro_dir}" || die "mkdir failed"	cd "${lotro_dir}" || die "cd failed"	wget -O lotrolauncher.sh "${launcher_script_url}" || die "failed to download launcher script"	wget -O urlencode.sh "${urlencode_sh_url}" || die "failed to download urlencoder script"	chmod u+x lotrolauncher.sh urlencode.sh || die "chmod failed"	echo "done!"	echo	echo	print_header "Patching Launcher Script..."	#wget "http://codemonger.org/lotro/lotrolauncher.sh.0.9.9d.patch" || die "failed to download launcher patch"	#patch < lotrolauncher.sh.0.9.9d.patch || die "patch failed!"	get_launcher_patch | patch || die "patch failed!"	#rm lotrolauncher.sh.0.9.9d.patch	echo "done!"	echo	echo	if yesno "y" "Would you like to create a desktop icon for the LOTRO launcher script [Y/n]? "; then		echo -n "Installing desktop icon... "		get_desktop_launcher > ${tmpdir}/lotro.desktop		install_desktop_item ${tmpdir}/lotro.desktop		#rm ${tmpdir}/lotro.desktop		echo "done!"	else		echo "Remember to run the launcher script with the correct WINEPREFIX environement variable set!"	fi	echo	echo	# Print Summary	# =============	print_header "Summary Report"#Installer program : $(resolve_hard_dir "${installer_full_path}")	echo "Your LOTRO Wine environement is now ready!  You may want to make a note of thefollowing information.WINEPREFIX        : ${WINEPREFIX}LOTRO Version     : ${sel_name}LOTRO ini file    : $(resolve_hard_dir "${ini_file}")Log file          : ${log_file}Be aware that the LOTRO setup program may complain that the default installdirectory \"C:\\Program Files\\${region_company}\\The Lord of the Rings Online\\\"already exists and asks if it should install there anyway.  Select yes, as thisscript creates it and pre-populates it with the lanucher script.Also note that if you want to change windows between LOTRO and otherapplications (eg. Mozila) run the LOTRO client in windowed mode or the gameMAY CRASH!"	# Download installer	# ==================	print_header "Downloading LOTRO installer..."	if yesno "y" "Would you to download the installer installer now?[Y/n]? "; then	echo	installer="$(basename "${url}")"	cd "${user_profile_dir}/Desktop" || die "cd failed"	installer_full_path="$(pwd)/${installer}"	if [ -e "${installer_full_path}" ]; then		echo "File ${installer_full_path} already exists..."	else		wget "${url}" || die "wget failed!"	fi	echo "done!"	echo	echo	# Create desktop entries	# ======================	print_header "Create desktop entries"	tmpdir="/tmp/lotrosetup.sh.$$"	mkdir -p ${tmpdir} || die "mkdir failed"	if yesno "y" "Would you like to create a desktop icon for the downloader/installer [Y/n]? "; then		echo -n "Installing desktop icon... "		get_desktop_downloader > ${tmpdir}/lotro_downloader.desktop		install_desktop_item ${tmpdir}/lotro_downloader.desktop		#rm ${tmpdir}/lotro_downloader.desktop		echo "done!"	else		echo "Remember to run the installer with the correct WINEPREFIX environement variable set!"	fi	echo	echo	#rmdir $tmpdir}log_file="$(pwd)/lotrosetup-$(date '+%Y-%m-%d-%H:%M:%S').log"main 2>&1 | tee "${log_file}"exit# The remainder of this script contains non-executable text--- lotrolauncher.script	2008-10-27 13:26:36.000000000 -0500+++ lotrolauncher.sh	2009-05-06 12:35:32.000000000 -0500@@ -181,6 +181,16 @@     --header 'SOAPAction: "http://www.turbine.com/SE/GLS/LoginAccount"' \     --post-data "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><LoginAccount xmlns=\"http://www.turbine.com/SE/GLS\"><username>${account}</username><password>${pass}</password><additionalInfo></additionalInfo></LoginAccount></soap:Body></soap:Envelope>" \     "${authServer_URL}" -O .launcher/GLSAuthServer.config++# If wget fails, try without certificate validation+if [ $? -ne 0 ]; then+    wget --no-check-certificate -nv \+        --header 'Content-Type: text/xml; charset=utf-8' \+        --header 'SOAPAction: "http://www.turbine.com/SE/GLS/LoginAccount"' \+        --post-data "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><LoginAccount xmlns=\"http://www.turbine.com/SE/GLS\"><username>${account}</username><password>${pass}</password><additionalInfo></additionalInfo></LoginAccount></soap:Body></soap:Envelope>" \+        "${authServer_URL}" -O .launcher/GLSAuthServer.config+fi+ if ! [ -r .launcher/GLSAuthServer.config ] ; then     echo -e "\nError: GLS auth server request failed. Wrong account/password?\n"     cd "$oldDir"