is_proj/scripts/build.sh
2026-01-21 00:23:28 +03:00

81 lines
1.9 KiB
Bash
Executable file
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.

#!/bin/bash
set -e
echo "=== AuthApp build script ==="
# -------------------------------
# Проверка ОС
# -------------------------------
if [ ! -f /etc/os-release ]; then
echo "Cannot detect OS"
exit 1
fi
. /etc/os-release
if [ "$ID" != "debian" ] || [ "$VERSION_ID" != "12" ]; then
echo "This project is supported only on Debian 12"
exit 1
fi
echo "OS check: Debian 12 OK"
# -------------------------------
# Проверка sudo
# -------------------------------
if ! command -v sudo >/dev/null 2>&1; then
echo "sudo is required but not installed"
exit 1
fi
# -------------------------------
# Установка curl
# -------------------------------
if ! command -v curl >/dev/null 2>&1; then
echo "Installing curl..."
sudo apt update
sudo apt install -y curl
else
echo "curl already installed"
fi
# -------------------------------
# Проверка dotnet
# -------------------------------
if ! command -v dotnet >/dev/null 2>&1; then
echo ".NET SDK not found, installing .NET 8 SDK..."
sudo apt update
sudo apt install -y \
ca-certificates \
libc6 \
libgcc-s1 \
libicu72 \
libssl3 \
libstdc++6 \
zlib1g
curl -fsSL https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -o packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb
sudo apt update
sudo apt install -y dotnet-sdk-8.0
else
echo ".NET SDK already installed"
fi
# -------------------------------
# Переменные среды
# -------------------------------
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_NOLOGO=1
# -------------------------------
# Сборка проекта
# -------------------------------
echo "Building project..."
dotnet build ../src/AuthApp.csproj -c Release -o ../build
echo "Build completed successfully"