#!/usr/bin/env bash
# info_ru: Автоматизация импорта данных
########################################################################
export PROG_URL="https://www.alta.ru"
export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export WINEPREFIX="alta"
export PROG_NAME="Заполнитель"
export PROG_ICON="altazap"
export BASE_PFX="alta_pfx_x86_v01"
export WH_WINDOWS_VER="10"
export WINEARCH="win32"
export INSTALL_DLL="corefonts eufonts lucida opensymbol tahoma cjkfonts vb6run mdac28 msxml3 msxml4 msxml6 mfc42 jet40 native_oleaut32"

AUTOINSTALL_EXE="${WH_TMP_DIR}/zapwin040225.zip"
AUTOINSTALL_UNPACK="${WH_TMP_DIR}/zapwin040225"
AUTOINSTALL_SETUP="${WH_TMP_DIR}/zapwin040225/setup.exe"

prepair_wine
if try_download "https://www1.alta.ru/pub/packets/distr/zapwin040225.zip" "${AUTOINSTALL_EXE}" ; then
    unpack "${AUTOINSTALL_EXE}" "${AUTOINSTALL_UNPACK}"
    try_remove_file "$AUTOINSTALL_EXE"

    wine_run_install "${AUTOINSTALL_SETUP}" /S /OVERWRITE
    try_remove_dir "$AUTOINSTALL_UNPACK"

    WIN_FILE_EXEC="$DRIVE_C/ALTA/zapoln.exe"
    create_desktop "$PROG_NAME" "$WIN_FILE_EXEC" "$PROG_ICON"
fi
