#!/bin/bash # Exit immediately if a command exits with a non-zero status set -e echo "Building Toak Native AOT executable..." dotnet publish -c Release -r linux-x64 systemctl --user stop toak.service >/dev/null 2>&1 || true systemctl --user disable toak.service >/dev/null 2>&1 || true echo "Installing to /usr/bin/toak... (This may prompt for your sudo password)" sudo cp bin/Release/net10.0/linux-x64/publish/Toak /usr/bin/toak if [ -d "/usr/share/zsh/site-functions" ]; then echo "Installing zsh completions..." sudo cp _toak /usr/share/zsh/site-functions/_toak fi echo "Installing and starting systemd user service..." mkdir -p ~/.config/systemd/user cp toak.service ~/.config/systemd/user/ systemctl --user daemon-reload systemctl --user enable --now toak.service echo "Installation complete! You can now run 'toak' from anywhere." echo "Note: You may need to restart your zsh shell or run 'autoload -Uz compinit && compinit' to enable completions." echo "The Toak daemon is running in the background."