diff --git a/CMakeLists.txt b/CMakeLists.txt index a71166bb..22a2b250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -161,9 +161,10 @@ configure_file("${CMAKE_SOURCE_DIR}/include/config.hpp.cmake" "${CMAKE_SOURCE_DI install(TARGETS ${PROJECT_NAME} DESTINATION "bin" COMPONENT "binaries") -install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/lemonbuddy_wrapper.sh" - DESTINATION "bin" - COMPONENT "binaries") +install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/lemonbuddy_wrapper" + DESTINATION "bin" COMPONENT "binaries") +install(PROGRAMS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/lemonbuddy_terminate" + DESTINATION "bin" COMPONENT "binaries") install(FILES "examples/config" DESTINATION "share/examples/${PROJECT_NAME}" diff --git a/scripts/lemonbuddy_terminate b/scripts/lemonbuddy_terminate new file mode 100755 index 00000000..e0e8fc8e --- /dev/null +++ b/scripts/lemonbuddy_terminate @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +if [[ "$1" != "noconfirm" ]]; then + read -p "Send SIGKILL to terminate processes? [Y/n] " -r choice + + [[ "${choice^^}" == "Y" ]] || { + echo "Aborting..."; exit + } +fi + +pgrep -f "(lemonbuddy_wrapper|^lemonb(uddy|ar))" | xargs kill -9 >/dev/null 2>&1 + +if [[ $? -eq 0 ]]; then + echo "Kill signals successfully sent" +else + echo "Failed to send kill signal ($?)" +fi diff --git a/scripts/lemonbuddy_terminate.sh b/scripts/lemonbuddy_terminate.sh deleted file mode 100755 index 16b067ac..00000000 --- a/scripts/lemonbuddy_terminate.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -read -p "Send SIGKILL to terminate processes? [Y/n] " -r choice - -[[ "${choice^^}" == "Y" ]] || { - echo "Aborting..." - exit -} - -[[ "${choice^^}" == "Y" ]] && { - pgrep -f "(lemonbuddy_wrapper.sh|^lemonb(uddy|ar))" | xargs kill -9 >/dev/null 2>&1 - - if [[ $? -eq 0 ]]; then - echo "Kill signals successfully sent" - else - echo "Failed to send kill signal ($?)" - fi -} diff --git a/scripts/lemonbuddy_wrapper.sh b/scripts/lemonbuddy_wrapper similarity index 100% rename from scripts/lemonbuddy_wrapper.sh rename to scripts/lemonbuddy_wrapper