From a1037edb2966f54c49decc64c83f736d08b59ec2 Mon Sep 17 00:00:00 2001 From: TomiEckert Date: Sat, 28 Feb 2026 13:13:02 +0100 Subject: [PATCH] feat: Add an uninstall script and make systemctl commands in the install script more robust. --- install.sh | 4 ++-- uninstall.sh | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) create mode 100755 uninstall.sh diff --git a/install.sh b/install.sh index 220034d..fc94393 100755 --- a/install.sh +++ b/install.sh @@ -6,8 +6,8 @@ set -e echo "Building Toak Native AOT executable..." dotnet publish -c Release -r linux-x64 -systemctl --user stop toak.service -systemctl --user disable toak.service +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 diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..2cbe7b6 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Exit immediately if a command exits with a non-zero status +set -e + +echo "Stopping and disabling Toak systemd service..." +systemctl --user stop toak.service || true +systemctl --user disable toak.service || true + +echo "Removing systemd service file..." +sudo rm -f ~/.config/systemd/user/toak.service +systemctl --user daemon-reload + +echo "Removing Toak executable..." +sudo rm -f /usr/bin/toak + +if [ -f "/usr/share/zsh/site-functions/_toak" ]; then + echo "Removing zsh completions..." + sudo rm -f /usr/share/zsh/site-functions/_toak +fi + +echo "Toak has been successfully uninstalled."