#!/usr/bin/env bash
# info_ru: Установщик программного комплекса NetTest (демо-версия)
########################################################################
export PROG_URL="https://www.kpolyakov.spb.ru/prog/nettest/nettget.htm"
export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export WINEPREFIX="nettest"
export PROG_NAME="NetTest"
export BASE_PFX="none"
export WINEARCH="win64"
export INSTALL_DLL=""
export WH_WINDOWS_VER="10"

ZIP_FILE="$2"

if [[ -f "$ZIP_FILE" ]] \
&& [[ $ZIP_FILE =~ ".zip" ]]
then
    prepair_wine
    PROG_PATH="$DRIVE_C/nettest"
    if [[ $ZIP_FILE =~ "tests" ]] ; then
        unpack "$2" "$PROG_PATH/tests"
        print_info "Тесты $(basename "$ZIP_FILE") установлены."
        exit 0
    else
        unpack "$2" "$PROG_PATH"
    fi

    cp -fr "$PROG_PATH/fonts/"* "$DRIVE_C/windows/Fonts/"

    create_desktop "$PROG_NAME (Сервер)" "$PROG_PATH/testser.exe" "nettest_server"
    create_desktop "$PROG_NAME (Клиент)" "$PROG_PATH/testcli.exe" "nettest_client"
else
    fatal "Не найден файл архива для $PROG_NAME. Перезапустите по примеру:
    winehelper install $1 \"/путь/до/архива\""
fi




