#!/usr/bin/env bash
# info_ru: Комплект плагинов «Сметная система АВС» к BIM-системам.
########################################################################
export WH_WINE_USE="wine-9.0.14-alt1-amd64"
export WINEPREFIX="abccenter"
export PROG_NAME="ABC-BIM-Plugins-RU"
export BASE_PFX="none"
export WH_WINDOWS_VER="10"
export WINEARCH="win64"
# export INSTALL_DLL=""

prepair_wine
# Возможны точки либо нижнее подчеркивание в URL-адресе
try_get_page "https://abccenter.ru/download-ru/"
VERSION=$(read_page | grep -oP 'ABC-BIM-Plugins-RU_\K\d+[._]\d+[._]\d+'| sed -E 's/[._]/./g')
AUTOINSTALL_EXE="${WH_TMP_DIR}/ABC-BIM-Plugins-RU_${VERSION}.exe"

if try_download "https://abccenter.ru/wp-content/soft/ABC-BIM-Plugins-RU_${VERSION}_Setup.exe" "${AUTOINSTALL_EXE}" ; then
    wine_run_install "${AUTOINSTALL_EXE}" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /SP-
    try_remove_file "$AUTOINSTALL_EXE"
fi
