#!/usr/bin/env bash
# Author: Castro-Fidel (linux-gaming.ru)
########################################################################
[ "${update_loc}" = "RUS" ] && export BN_LOC=ruRU || export BN_LOC=enUS
export PW_AUTOINSTALL_EXE="${PW_USER_TEMP}/Battle.net-Setup-${BN_LOC}.exe"
start_portwine
if try_download "dist.blizzard.com/downloads/bna-installers/322d5bb9ae0318de3d4cde7641c96425/retail.1/Battle.net-Setup-${BN_LOC}.exe" "${PW_AUTOINSTALL_EXE}"
then
    # PW_START_PROGRESS_BAR "${loc_gui_installing_the} Battle Net. ${loc_gui_please_wait} "
    pw_kill_autostart Battle.net.exe &
    pw_run "${PW_AUTOINSTALL_EXE}"
    portwine_exe=`find "$WINEPREFIX/drive_c/" -type f -name "Battle.net.exe"`
    pw_stop_progress_bar
    portwine_create_shortcut
    try_remove_file "${PW_AUTOINSTALL_EXE}"
fi
stop_portwine
