﻿#!/bin/bash

echo "2023 (с) СисАдмины ФО Пензенской области"
echo "Установка Wine 8.0 и СправкиБК в Astra Linux SE 1.7.4"

VERSION=$(</etc/astra_version)
SUB="1.7"

if [[ ! "$VERSION" =~ .*"$SUB".* ]]; then
    echo "Необходима ОС Astra Linux SE 1.7! Завершение..."
    exit
else
    echo "1 - Установить ПО"
    echo "2 - Выйти"
    read ACTION
fi;

case $ACTION in
1)if [[ ! -f /opt/wine-7.13/bin/wine ]]; then
    sudo apt install ia32-libs;
    sudo apt install libpaper-utils;
    sudo apt install wine -y;
    sudo apt install ca-certificates libmspack0 cabextract;
    wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks;
    chmod +x winetricks;
    sudo mv winetricks /usr/bin/;
    winetricks -f -q dotnet35sp1;
    winetricks -f -q msxml3;
    winetricks -f -q msxml4;
    winetricks -f -q msxml6;
    cd Загрузки;
    wget http://caravan.pizda.space/karloson-soft/spravkiBK/printer-driver-cups-pdf_3.0.1-5_amd64.deb;
    sudo dpkg -i printer-driver-cups-pdf_3.0.1-5_amd64.deb;
    sudo ln -s /usr/lib32/i386-linux-gnu/ /usr/lib/;
    wget http://caravan.pizda.space/karloson-soft/spravkiBK/wine-bk-5.21-0-astra-se16_ce212_amd64.deb;
    sudo dpkg -i wine-bk-5.21-0-astra-se16_ce212_amd64.deb;
    cd ~;
    mkdir WINE;
    cd WINE;
    wget http://caravan.pizda.space/karloson-soft/spravkiBK/wine-spravki-bk.tar.gz;
    tar -zxvf wine-spravki-bk.tar.gz;
    cd ~;
    cd Desktop;
    wget http://caravan.pizda.space/karloson-soft/spravkiBK/SpravkiBK.desktop;
    echo "Успешно выполнена!";
    exit;
    else echo "Wine-8.0 уже установлен в системе!";
  fi;;
2) exit;;
esac
