diff options
Diffstat (limited to 'packaging/utils')
-rw-r--r-- | packaging/utils/bash_execute.sh | 19 | ||||
-rw-r--r-- | packaging/utils/clion-msys-mingw64-environment.bat | 17 | ||||
-rw-r--r-- | packaging/utils/clion-msys-msys-environment.bat | 20 | ||||
-rw-r--r-- | packaging/utils/compile-on-windows.sh | 71 | ||||
-rwxr-xr-x | packaging/utils/coverity-scan.sh | 219 | ||||
-rw-r--r-- | packaging/utils/installer.nsi | 34 | ||||
-rw-r--r-- | packaging/utils/package-windows.sh | 27 | ||||
-rw-r--r-- | packaging/utils/protoc.bat | 9 | ||||
-rw-r--r-- | packaging/utils/windows-openssh-to-msys.bat | 118 |
9 files changed, 534 insertions, 0 deletions
diff --git a/packaging/utils/bash_execute.sh b/packaging/utils/bash_execute.sh new file mode 100644 index 00000000..4092db96 --- /dev/null +++ b/packaging/utils/bash_execute.sh @@ -0,0 +1,19 @@ +#!/usr/bin/bash + +convert_path() { + local ARG="$1" + ARG="${ARG//C:\\//c/}" + ARG="${ARG//c:\\//c/}" + ARG="${ARG//C:\///c/}" + ARG="${ARG//c:\///c/}" + + echo "$ARG" +} + +declare params=() +for x in "${@}" +do + params+=("$(convert_path "${x}")") +done + +"${params[@]}" diff --git a/packaging/utils/clion-msys-mingw64-environment.bat b/packaging/utils/clion-msys-mingw64-environment.bat new file mode 100644 index 00000000..19035d8e --- /dev/null +++ b/packaging/utils/clion-msys-mingw64-environment.bat @@ -0,0 +1,17 @@ +@echo off +:: In Clion Toolchains +:: 1. Add a MinGW profile +:: 2. Set Toolset to C:\msys64\mingw64 +:: 3. Add environment and set the full path to this file, like: +:: C:\msys64\home\costa\src\netdata-ktsaou.git\packaging\utils\clion-mingw64-environment.bat +:: 4. Let everything else to Bundled and auto-detected +:: +set "batch_dir=%~dp0" +set "batch_dir=%batch_dir:\=/%" +set MSYSTEM=MINGW64 +set GOROOT=C:\msys64\mingw64 +set PATH="%PATH%;C:\msys64\mingw64\bin;C:\msys64\usr\bin;C:\msys64\bin" +::set PKG_CONFIG_EXECUTABLE=C:\msys64\mingw64\bin\pkg-config.exe +::set CMAKE_C_COMPILER=C:\msys64\mingw64\bin\gcc.exe +::set CMAKE_CC_COMPILER=C:\msys64\mingw64\bin\g++.exe +set PROTOBUF_PROTOC_EXECUTABLE=C:/msys64/mingw64/bin/protoc.exe diff --git a/packaging/utils/clion-msys-msys-environment.bat b/packaging/utils/clion-msys-msys-environment.bat new file mode 100644 index 00000000..9f0c095d --- /dev/null +++ b/packaging/utils/clion-msys-msys-environment.bat @@ -0,0 +1,20 @@ +@echo off
+:: In Clion Toolchains
+:: 1. Add a MinGW profile
+:: 2. Set Toolset to C:\msys64\mingw64
+:: 3. Add environment and set the full path to this file, like:
+:: C:\msys64\home\costa\src\netdata-ktsaou.git\packaging\utils\clion-mingw64-environment.bat
+:: 4. Let everything else to Bundled and auto-detected
+::
+set "batch_dir=%~dp0"
+set "batch_dir=%batch_dir:\=/%"
+set MSYSTEM=MSYS
+
+:: go exists only mingw64 / ucrt64 / etc, not under msys profile
+set GOROOT=C:\msys64\mingw64
+
+set PATH="%PATH%;C:\msys64\usr\bin;C:\msys64\bin;C:\msys64\mingw64\bin"
+::set PKG_CONFIG_EXECUTABLE=C:\msys64\mingw64\bin\pkg-config.exe
+::set CMAKE_C_COMPILER=C:\msys64\mingw64\bin\gcc.exe
+::set CMAKE_CC_COMPILER=C:\msys64\mingw64\bin\g++.exe
+set PROTOBUF_PROTOC_EXECUTABLE=%batch_dir%/protoc.bat
diff --git a/packaging/utils/compile-on-windows.sh b/packaging/utils/compile-on-windows.sh new file mode 100644 index 00000000..aa44771b --- /dev/null +++ b/packaging/utils/compile-on-windows.sh @@ -0,0 +1,71 @@ +#!/bin/sh + +# On MSYS2, install these dependencies to build netdata: +install_dependencies() { + pacman -S \ + git cmake ninja base-devel msys2-devel \ + libyaml-devel libzstd-devel libutil-linux libutil-linux-devel \ + mingw-w64-x86_64-toolchain mingw-w64-ucrt-x86_64-toolchain \ + mingw64/mingw-w64-x86_64-mold ucrt64/mingw-w64-ucrt-x86_64-mold \ + msys/gdb ucrt64/mingw-w64-ucrt-x86_64-gdb mingw64/mingw-w64-x86_64-gdb \ + msys/zlib-devel mingw64/mingw-w64-x86_64-zlib ucrt64/mingw-w64-ucrt-x86_64-zlib \ + msys/libuv-devel ucrt64/mingw-w64-ucrt-x86_64-libuv mingw64/mingw-w64-x86_64-libuv \ + liblz4-devel mingw64/mingw-w64-x86_64-lz4 ucrt64/mingw-w64-ucrt-x86_64-lz4 \ + openssl-devel mingw64/mingw-w64-x86_64-openssl ucrt64/mingw-w64-ucrt-x86_64-openssl \ + protobuf-devel mingw64/mingw-w64-x86_64-protobuf ucrt64/mingw-w64-ucrt-x86_64-protobuf \ + msys/pcre2-devel mingw64/mingw-w64-x86_64-pcre2 ucrt64/mingw-w64-ucrt-x86_64-pcre2 \ + msys/brotli-devel mingw64/mingw-w64-x86_64-brotli ucrt64/mingw-w64-ucrt-x86_64-brotli \ + msys/ccache ucrt64/mingw-w64-ucrt-x86_64-ccache mingw64/mingw-w64-x86_64-ccache \ + mingw64/mingw-w64-x86_64-go ucrt64/mingw-w64-ucrt-x86_64-go +} + +if [ "${1}" = "install" ] +then + install_dependencies || exit 1 + exit 0 +fi + +export PATH="/usr/local/bin:${PATH}" + +WT_ROOT="$(pwd)" +BUILD_TYPE="Debug" +NULL="" + +if [ -z "${MSYSTEM}" ]; then + build="${WT_ROOT}/build-${OSTYPE}" +else + build="${WT_ROOT}/build-${OSTYPE}-${MSYSTEM}" +fi + +if [ "$USER" = "vk" ]; then + build="${WT_ROOT}/build" +fi + +set -exu -o pipefail + +if [ -d "${build}" ] +then + rm -rf "${build}" +fi + +/usr/bin/cmake -S "${WT_ROOT}" -B "${build}" \ + -G Ninja \ + -DCMAKE_INSTALL_PREFIX="/opt/netdata" \ + -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \ + -DCMAKE_C_FLAGS="-O0 -ggdb -Wall -Wextra -Wno-char-subscripts -Wa,-mbig-obj -pipe -DNETDATA_INTERNAL_CHECKS=1 -D_FILE_OFFSET_BITS=64 -D__USE_MINGW_ANSI_STDIO=1" \ + -DNETDATA_USER="${USER}" \ + -DDEFAULT_FEATURE_STATE=Off \ + -DENABLE_H2O=Off \ + -DENABLE_LOGS_MANAGEMENT_TESTS=Off \ + -DENABLE_ACLK=On \ + -DENABLE_CLOUD=On \ + -DENABLE_ML=On \ + -DENABLE_BUNDLED_JSONC=On \ + -DENABLE_BUNDLED_PROTOBUF=Off \ + ${NULL} + +ninja -v -C "${build}" || ninja -v -C "${build}" -j 1 + +echo +echo "Compile with:" +echo "ninja -v -C \"${build}\" || ninja -v -C \"${build}\" -j 1" diff --git a/packaging/utils/coverity-scan.sh b/packaging/utils/coverity-scan.sh new file mode 100755 index 00000000..b69fea56 --- /dev/null +++ b/packaging/utils/coverity-scan.sh @@ -0,0 +1,219 @@ +#!/usr/bin/env bash +# +# Coverity scan script +# +# Copyright: SPDX-License-Identifier: GPL-3.0-or-later +# +# Author : Costa Tsaousis (costa@netdata.cloud) +# Author : Pawel Krupa (paulfantom) +# Author : Pavlos Emm. Katsoulakis (paul@netdata.cloud) +# shellcheck disable=SC1091,SC2230,SC2086 + +# To run manually, save configuration to .coverity-scan.conf like this: +# +# the repository to report to coverity - devs can set here their own fork +# REPOSITORY="netdata/netdata" +# +# the email of the developer, as given to coverity +# COVERITY_SCAN_SUBMIT_MAIL="you@example.com" +# +# the token given by coverity to the developer +# COVERITY_SCAN_TOKEN="TOKEN taken from Coverity site" +# +# the absolute path of the cov-build - optional +# COVERITY_BUILD_PATH="/opt/cov-analysis-linux64-2021.12/bin/cov-build" +# +# when set, the script will print on screen the curl command that submits the build to coverity +# this includes the token, so the default is not to print it. +# COVERITY_SUBMIT_DEBUG=1 +# +# Override the standard coverity build version we know is supported +# COVERITY_BUILD_VERSION="cov-analysis-linux64-2019.03" +# +# All these variables can also be exported before running this script. +# +# If the first parameter of this script is "install", +# coverity build tools will be downloaded and installed in /opt/coverity + +set -e + +INSTALL_DIR="/opt" + +# the version of coverity to use +COVERITY_BUILD_VERSION="${COVERITY_BUILD_VERSION:-cov-analysis-linux64-2023.6.2}" + +SCRIPT_SOURCE="$( + self=${0} + while [ -L "${self}" ] + do + cd "${self%/*}" || exit 1 + self=$(readlink "${self}") + done + cd "${self%/*}" || exit 1 + echo "$(pwd -P)/${self##*/}" +)" +REPO_ROOT="$(dirname "${SCRIPT_SOURCE}")/../.." + +. "${REPO_ROOT}/packaging/installer/functions.sh" + +JOBS=$(find_processors) +[ -z "${JOBS}" ] && JOBS=1 + +if command -v ninja 2>&1; then + ninja="$(command -v ninja)" +fi + +CMAKE_OPTS="${ninja:+-G Ninja}" +BUILD_OPTS="VERBOSE=1" +[ -n "${ninja}" ] && BUILD_OPTS="-v" +NETDATA_BUILD_DIR="${NETDATA_BUILD_DIR:-./build/}" + +if [ -f ".coverity-scan.conf" ]; then + source ".coverity-scan.conf" +fi + +repo="${REPOSITORY}" +if [ -z "${repo}" ]; then + fatal "export variable REPOSITORY or set it in .coverity-scan.conf" +fi +repo="${repo//\//%2F}" + +email="${COVERITY_SCAN_SUBMIT_MAIL}" +if [ -z "${email}" ]; then + fatal "export variable COVERITY_SCAN_SUBMIT_MAIL or set it in .coverity-scan.conf" +fi + +token="${COVERITY_SCAN_TOKEN}" +if [ -z "${token}" ]; then + fatal "export variable COVERITY_SCAN_TOKEN or set it in .coverity-scan.conf" +fi + +if ! command -v curl > /dev/null 2>&1; then + fatal "CURL is required for coverity scan to work" +fi + +# only print the output of a command +# when debugging is enabled +# used to hide the token when debugging is not enabled +debugrun() { + if [ "${COVERITY_SUBMIT_DEBUG}" = "1" ]; then + run "${@}" + return $? + else + "${@}" + return $? + fi +} + +scanit() { + progress "Scanning using coverity" + COVERITY_PATH=$(find "${INSTALL_DIR}" -maxdepth 1 -name 'cov*linux*') + export PATH=${PATH}:${COVERITY_PATH}/bin/ + covbuild="${COVERITY_BUILD_PATH}" + [ -z "${covbuild}" ] && covbuild="$(which cov-build 2> /dev/null || command -v cov-build 2> /dev/null)" + + if [ -z "${covbuild}" ]; then + fatal "Cannot find 'cov-build' binary in \$PATH. Export variable COVERITY_BUILD_PATH or set it in .coverity-scan.conf" + elif [ ! -x "${covbuild}" ]; then + fatal "The command '${covbuild}' is not executable. Export variable COVERITY_BUILD_PATH or set it in .coverity-scan.conf" + fi + + cd "${REPO_ROOT}" || exit 1 + + version="$(grep "^#define PACKAGE_VERSION" config.h | cut -d '"' -f 2)" + progress "Working on netdata version: ${version}" + + progress "Cleaning up old builds..." + rm -rf "${NETDATA_BUILD_DIR}" + + [ -d "cov-int" ] && rm -rf "cov-int" + + [ -f netdata-coverity-analysis.tgz ] && run rm netdata-coverity-analysis.tgz + + progress "Configuring netdata source..." + USE_SYSTEM_PROTOBUF=1 + ENABLE_GO=0 + prepare_cmake_options + + run cmake ${NETDATA_CMAKE_OPTIONS} + + progress "Analyzing netdata..." + run "${covbuild}" --dir cov-int cmake --build "${NETDATA_BUILD_DIR}" --parallel ${JOBS} -- ${BUILD_OPTS} + + echo >&2 "Compressing analysis..." + run tar czvf netdata-coverity-analysis.tgz cov-int + + echo >&2 "Sending analysis to coverity for netdata version ${version} ..." + COVERITY_SUBMIT_RESULT=$(debugrun curl --progress-bar \ + --form token="${token}" \ + --form email="${email}" \ + --form file=@netdata-coverity-analysis.tgz \ + --form version="${version}" \ + --form description="netdata, monitor everything, in real-time." \ + https://scan.coverity.com/builds?project="${repo}") + + echo "${COVERITY_SUBMIT_RESULT}" | grep -q -e 'Build successfully submitted' || echo >&2 "scan results were not pushed to coverity. Message was: ${COVERITY_SUBMIT_RESULT}" + + progress "Coverity scan completed" +} + +installit() { + ORIGINAL_DIR="${PWD}" + TMP_DIR="$(mktemp -d /tmp/netdata-coverity-scan-XXXXX)" + progress "Downloading coverity in ${TMP_DIR}..." + cd "${TMP_DIR}" + + debugrun curl --remote-name --remote-header-name --show-error --location --data "token=${token}&project=${repo}" https://scan.coverity.com/download/linux64 + + if [ -f "${COVERITY_BUILD_VERSION}.tar.gz" ]; then + progress "Installing coverity..." + cd "${INSTALL_DIR}" + + run sudo tar -z -x -f "${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz" || exit 1 + rm "${TMP_DIR}/${COVERITY_BUILD_VERSION}.tar.gz" + COVERITY_PATH=$(find "${INSTALL_DIR}" -maxdepth 1 -name 'cov*linux*') + export PATH=${PATH}:${COVERITY_PATH}/bin/ + elif find . -name "*.tar.gz" > /dev/null 2>&1; then + ls ./*.tar.gz + fatal "Downloaded coverity tool tarball does not appear to be the version we were expecting, exiting." + else + fatal "Failed to download coverity tool tarball!" + fi + + # Validate the installation + covbuild="$(which cov-build 2> /dev/null || command -v cov-build 2> /dev/null)" + if [ -z "$covbuild" ]; then + fatal "Failed to install coverity." + fi + + progress "Coverity scan tools are installed." + cd "$ORIGINAL_DIR" + + # Clean temp directory + [ -n "${TMP_DIR}" ] && rm -rf "${TMP_DIR}" + return 0 +} + +FOUND_OPTS="NO" +while [ -n "${1}" ]; do + if [ "${1}" = "--with-install" ]; then + progress "Running coverity install" + installit + shift 1 + elif [ -n "${1}" ]; then + # Clear the default arguments, once you bump into the first argument + if [ "${FOUND_OPTS}" = "NO" ]; then + OTHER_OPTIONS="${1}" + FOUND_OPTS="YES" + else + OTHER_OPTIONS+=" ${1}" + fi + + shift 1 + else + break + fi +done + +echo "Running coverity scan with extra options ${OTHER_OPTIONS}" +scanit "${OTHER_OPTIONS}" diff --git a/packaging/utils/installer.nsi b/packaging/utils/installer.nsi new file mode 100644 index 00000000..b78f52ff --- /dev/null +++ b/packaging/utils/installer.nsi @@ -0,0 +1,34 @@ +Outfile "netdata-installer.exe" +InstallDir "C:\netdata" + +RequestExecutionLevel admin + +Section + SetOutPath $INSTDIR + WriteUninstaller $INSTDIR\uninstaller.exe +SectionEnd + +Section "Install MSYS2 environment" + SetOutPath $TEMP + + SetCompress off + File "C:\msys64\msys2-installer.exe" + nsExec::ExecToLog 'cmd.exe /C "$TEMP\msys2-installer.exe" in --confirm-command --accept-messages --root $INSTDIR' + + Delete "$TEMP\msys2-installer.exe" +SectionEnd + +Section "Install MSYS2 packages" + ExecWait '"$INSTDIR\usr\bin\bash.exe" -lc "pacman -S --noconfirm msys/libuv msys/protobuf"' +SectionEnd + +Section "Install Netdata" + SetOutPath $INSTDIR\opt\netdata + + SetCompress off + File /r "C:\msys64\opt\netdata\*.*" +SectionEnd + +Section "Uninstall" + nsExec::ExecToLog 'cmd.exe /C "$INSTDIR\uninstall.exe" pr --confirm-command' +SectionEnd diff --git a/packaging/utils/package-windows.sh b/packaging/utils/package-windows.sh new file mode 100644 index 00000000..b6996b9e --- /dev/null +++ b/packaging/utils/package-windows.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +export PATH="/usr/local/bin:${PATH}" + +WT_ROOT="$(pwd)" +NULL="" + +if [ -z "${MSYSTEM}" ]; then + build="${WT_ROOT}/build-${OSTYPE}" +else + build="${WT_ROOT}/build-${OSTYPE}-${MSYSTEM}" +fi + +if [ "$USER" = "vk" ]; then + build="${WT_ROOT}/build" +fi + +set -exu -o pipefail + +ninja -v -C "${build}" install + +if [ ! -f "/msys2-installer.exe" ]; then + wget -O /msys2-installer.exe \ + "https://github.com/msys2/msys2-installer/releases/download/2024-05-07/msys2-x86_64-20240507.exe" +fi + +makensis "${WT_ROOT}/packaging/utils/installer.nsi" diff --git a/packaging/utils/protoc.bat b/packaging/utils/protoc.bat new file mode 100644 index 00000000..fe7a76f2 --- /dev/null +++ b/packaging/utils/protoc.bat @@ -0,0 +1,9 @@ +@echo off +:: +:: The problem with /usr/bin/protoc is that it accepts colon separated (:) paths at its parameters. +:: This makes C:/ being parsed as 2 paths: C and /, which of course both fail. +:: To overcome this problem, we use bash_execute.sh, which replaces all occurences of C: with /c. +:: +set "batch_dir=%~dp0" +set "batch_dir=%batch_dir:\=/%" +C:\msys64\usr\bin\bash.exe %batch_dir%/bash_execute.sh protoc %* diff --git a/packaging/utils/windows-openssh-to-msys.bat b/packaging/utils/windows-openssh-to-msys.bat new file mode 100644 index 00000000..829cb484 --- /dev/null +++ b/packaging/utils/windows-openssh-to-msys.bat @@ -0,0 +1,118 @@ +@echo off +:: +:: This script will: +:: +:: 1. install the windows OpenSSH server (either via dsim or download it) +:: 2. activate the windows OpenSSH service +:: 3. open OpenSSH TCP port at windows firewall +:: 4. create a small batch file to start an MSYS session +:: 5. Set the default OpenSSH startup script to start the MSYS session +:: +:: Problems: +:: On older windows versions, terminal emulation is broken. +:: So, on windows 10 or windows server before 2019, the ssh session +:: will not have proper terminal emulation and will be not be able to +:: be used for editing files. +:: For more info check: +:: https://github.com/PowerShell/Win32-OpenSSH/issues/1260 +:: + +:: Check if OpenSSH Server is already installed +sc query sshd >nul 2>&1 +if %errorlevel% neq 0 ( + echo "OpenSSH Server not found. Attempting to install via dism..." + goto :install_openssh_dism +) else ( + echo "OpenSSH Server is already installed." + goto :configure_openssh +) + +:: Install OpenSSH using dism +:install_openssh_dism +dism /online /Enable-Feature /FeatureName:OpenSSH-Client /All >nul 2>&1 +dism /online /Enable-Feature /FeatureName:OpenSSH-Server /All >nul 2>&1 + +:: Check if dism succeeded in installing OpenSSH +sc query sshd >nul 2>&1 +if %errorlevel% neq 0 ( + echo "OpenSSH installation via dism failed or is unavailable." + goto :install_openssh_manual +) else ( + echo "OpenSSH installed successfully using dism." + goto :configure_openssh +) + +:: Function to Install OpenSSH manually if dism fails +:install_openssh_manual +echo "Installing OpenSSH manually..." + +:: Download the latest OpenSSH release +set DOWNLOAD_URL=https://github.com/PowerShell/Win32-OpenSSH/releases/download/v9.5.0.0p1-Beta/OpenSSH-Win64.zip +set DOWNLOAD_FILE=%temp%\OpenSSH-Win64.zip +set INSTALL_DIR=C:\Program Files\OpenSSH-Win64 + +:: Create the installation directory if it doesn't exist +if not exist "%INSTALL_DIR%" mkdir "%INSTALL_DIR%" + +:: Attempt to download OpenSSH using Invoke-WebRequest and TLS configuration +powershell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; try { Invoke-WebRequest -Uri '%DOWNLOAD_URL%' -OutFile '%DOWNLOAD_FILE%' -UseBasicParsing; exit 0 } catch { exit 1 }" +if %errorlevel% neq 0 ( + echo "Invoke-WebRequest download failed. Attempting to download using curl..." + curl -L -o "%DOWNLOAD_FILE%" "%DOWNLOAD_URL%" + if %errorlevel% neq 0 ( + echo "Failed to download OpenSSH using curl. Exiting..." + exit /b 1 + ) +) + +:: Unzip directly to INSTALL_DIR (flatten the folder structure) +powershell -Command "Expand-Archive -Path '%DOWNLOAD_FILE%' -DestinationPath '%INSTALL_DIR%' -Force" +if %errorlevel% neq 0 ( + echo "Failed to unzip OpenSSH package." + exit /b 1 +) + +:: Move inner contents to INSTALL_DIR if nested OpenSSH-Win64 folder exists +if exist "%INSTALL_DIR%\OpenSSH-Win64" ( + xcopy "%INSTALL_DIR%\OpenSSH-Win64\*" "%INSTALL_DIR%\" /s /e /y + rmdir "%INSTALL_DIR%\OpenSSH-Win64" /s /q +) + +:: Add the OpenSSH binaries to the system PATH +setx /M PATH "%INSTALL_DIR%;%PATH%" + +:: Register OpenSSH utilities as services using PowerShell +powershell -ExecutionPolicy Bypass -Command "& '%INSTALL_DIR%\install-sshd.ps1'" + +:: Verify if manual installation succeeded +sc query sshd >nul 2>&1 +if %errorlevel% neq 0 ( + echo "Manual OpenSSH installation failed. Exiting..." + exit /b 1 +) else ( + echo "OpenSSH installed successfully manually." + goto :configure_openssh +) + +:configure_openssh +:: Ensure OpenSSH Server service is set to start automatically and start the service +sc config sshd start= auto +net start sshd + +:: Create msys2.bat file with specific content +set MSYS2_PATH=C:\msys64 +if not exist "%MSYS2_PATH%" ( + echo "Error: %MSYS2_PATH% does not exist." + exit /b 1 +) + +echo @%MSYS2_PATH%\msys2_shell.cmd -defterm -here -no-start -msys > %MSYS2_PATH%\msys2.bat + +:: Run PowerShell command to set default shell +powershell -Command "New-ItemProperty -Path 'HKLM:\SOFTWARE\OpenSSH' -Name 'DefaultShell' -Value '%MSYS2_PATH%\msys2.bat' -PropertyType String -Force" + +:: Open the Windows Firewall for sshd (using PowerShell) +powershell -Command "New-NetFirewallRule -Name 'OpenSSH-Server-In-TCP' -DisplayName 'OpenSSH Server (sshd) Incoming' -Description 'Allow incoming SSH traffic via OpenSSH server' -Enabled True -Direction Inbound -Protocol TCP -LocalPort 22 -Action Allow" + +echo "OpenSSH has been successfully configured with MSYS2 as the default shell, and the firewall has been opened for sshd." +pause |