From fbc2964ad826c26e934eb6405fb78d2d050e89b6 Mon Sep 17 00:00:00 2001 From: suchmememanyskill <38142618+suchmememanyskill@users.noreply.github.com> Date: Sat, 1 Feb 2025 17:20:06 +0100 Subject: [PATCH] Make serial script work with both sudo and not sudo --- serial/install.sh | 8 +++++++- serial/uninstall.sh | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/serial/install.sh b/serial/install.sh index 2e57dfc..5609f96 100644 --- a/serial/install.sh +++ b/serial/install.sh @@ -8,8 +8,14 @@ if [ "$EUID" -eq 0 ]; then fi SERVICE_PATH="/etc/systemd/system/cyd-klipper-serial.service" else + echo "Are you sure you want to run this service as the current user?" + read -r -p "Make sure this user is logged in at boot! [y/N] " response + response=${response,,} # tolower + if ! [[ "$response" =~ ^(yes|y)$ ]]; then + exit + fi mkdir -p ~/.config/systemd/user - SERVICE_PATH="~/.config/systemd/user/cyd-klipper-serial.service" + SERVICE_PATH="$HOME/.config/systemd/user/cyd-klipper-serial.service" fi set -e diff --git a/serial/uninstall.sh b/serial/uninstall.sh index 34d210c..2d72807 100644 --- a/serial/uninstall.sh +++ b/serial/uninstall.sh @@ -16,4 +16,6 @@ else rm ~/.config/systemd/user/cyd-klipper-serial.service systemctl --user daemon-reload -fi \ No newline at end of file +fi + +rm -rf ./env \ No newline at end of file