From 53bc4a9477e57f3c5f8c5dda6283270d649d4536 Mon Sep 17 00:00:00 2001 From: mrtuxa Date: Thu, 13 Jul 2023 13:20:01 +0200 Subject: [PATCH] Update 'compile.sh' --- compile.sh | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) diff --git a/compile.sh b/compile.sh index a0b4046..cd668f3 100644 --- a/compile.sh +++ b/compile.sh @@ -1,19 +1,27 @@ -g++ -o radio *.cpp *.h `wx-config --cxxflags --libs` -lvlc -lcurl -ljsoncpp +if command -v sudo >/dev/null 2>&1 || command -v doas >/dev/null 2>&1; then + g++ -o radio *.cpp *.h `wx-config --cxxflags --libs` -lvlc -lcurl -ljsoncpp -if [ -x ./radio ] -then - read -p "Do u want to install the Binary? [y/N] " input + if [ -x ./radio ]; then + read -p "Do you want to install the Binary? [y/N] " input - if [ $input = "y" ] || [ $input = "Y" ] - then - mkdir -p ~/.config/radio++/ - touch ~/.config/radio++/sender - doas cp -v radio /usr/local/bin/ - echo "Finished!" + if [ "$input" = "y" ] || [ "$input" = "Y" ]; then + mkdir -p ~/.config/radio++/ + touch ~/.config/radio++/sender + + if command -v sudo >/dev/null 2>&1; then + sudo cp -v radio /usr/local/bin/ + elif command -v doas >/dev/null 2>&1; then + doas cp -v radio /usr/local/bin/ + fi + + echo "Finished!" + else + echo "Goodbye :c" + fi else - echo "bye :c" + echo "Something went wrong :/" + echo "Exiting..." fi else - echo "something went wrong :/" - echo "exit..." -fi + echo "Please log in as root and execute the script." +fi \ No newline at end of file