#! /usr/bin/env sh if ! command -v dotnet &> /dev/null then echo "'dotnet' could not be found, please refer to your distribution's documentation to install it." echo "Hint: NixOS: nix shell nixpkgs#dotnet-sdk_9" echo "Hint: Fedora: sudo dnf5 install dotnet-sdk-9.0" exit1 fi if [ ! -f "MatrixAntiDmSpam.sln" ]; then echo "Please run this script from the root of the repository." exit 1 fi cd MatrixAntiDmSpam || exit 1 echo "Elevation required to install the service!" if [ ! -d "/opt/MatrixAntiDmSpam" ]; then echo "Creating directory /opt/MatrixAntiDmSpam" sudo mkdir -p /opt/MatrixAntiDmSpam fi # Ensure working directory is clean sudo rm -rf /opt/MatrixAntiDmSpam rm -rf bin/target # Build dotnet publish -c Release -o bin/target -p:PublishSingleFile=false # Install rm -rv bin/target/appsettings*.json sudo rsync -raP --delete-during bin/target/ /opt/MatrixAntiDmSpam