winehelper/autoinstall/t-flex-cad17-applications
2025-04-24 08:18:47 +06:00

103 lines
3.1 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# info_ru: Приложения для T-FLEX CAD 17 (T-FLEX Анализ 17, T-FLEX Динамика 17, T-FLEX Зубчатые передачи 17, T-FLEX ЧПУ 17, T-FLEX Раскрой 17, T-FLEX Электротехника 17, T-FLEX VR 17, T-FLEX Печатные платы 17)
########################################################################
export WH_WINDOWS_VER="10"
export WH_WINE_USE="wine_x_tkg_10-0_amd64"
export BASE_PFX="tflex17_pfx_x64_v01"
export WINEARCH="win64"
export WINEPREFIX="tflex17"
BASE_URL="https://www.tflex.ru/downloads"
FILES=(
"T-FLEX Analysis 17.zip"
"T-FLEX Dynamics 17.zip"
"T-FLEX Gears 17.zip"
"T-FLEX CAM 17.zip"
"T-FLEX Nesting 17.zip"
"T-FLEX Electrical 17.zip"
"T-FLEX VR 17.zip"
"T-FLEX Circuits 17.zip"
)
UNPACK_APP="${WH_TMP_DIR}/unpack_applications"
prepair_wine
# Функция для распаковки файла
unpack_file() {
local archive="$1"
7z x -y "$archive" -o"${UNPACK_APP}"
}
# Функция для установки .msi файлов
install_msi_files() {
for msi_file in "${UNPACK_APP}"/*/*.msi; do
if [[ -f "$msi_file" ]]; then
echo "Установка $msi_file ..."
wine_run_install "$msi_file" /q
else
echo "Нет .msi файлов для установки в ${UNPACK_APP}/*."
fi
done
}
# Функция для кодирования URL
encode_url() {
local file_name="$1"
echo "${file_name// /%20}" # Заменяем пробелы на %20
}
# Вывод списка доступных файлов
list_files() {
echo "Доступные файлы для скачивания:"
for i in "${!FILES[@]}"; do
echo "$((i + 1)). ${FILES[$i]}"
done
}
# Скачивание одиночного файла
download_single() {
local index="$1"
local file_name="${FILES[$((index - 1))]}"
local file_url="$(encode_url "$file_name")"
local output="${WH_TMP_DIR}/${file_name// /_}"
if try_download "$BASE_URL/$file_url" "$output"; then
unpack_file "$output"
fi
}
# Скачивание всех файлов
download_all() {
for i in "${!FILES[@]}"; do
download_single "$((i + 1))"
done
}
# Основное меню
list_files
echo "Выберите опцию:"
echo "1. Скачать один файл и установить его."
echo "2. Скачать все файлы и установить их."
read -rp "Введите номер опции: " option
case "$option" in
1)
read -rp "Введите номер файла для скачивания (например, 1 для 'T-FLEX Analysis 17.zip'): " file_number
if [[ "$file_number" =~ ^[0-9]+$ ]] && (( file_number >= 1 && file_number <= ${#FILES[@]} )); then
download_single "$file_number"
else
echo "Неверный номер файла."
fi
;;
2)
download_all
;;
*)
echo "Неверный выбор. Попробуйте еще раз."
;;
esac
install_msi_files
try_remove_file ${WH_TMP_DIR}/*.zip
try_remove_dir "${UNPACK_APP}"