From 702976f8d6f7707b275d81d26f69c8c5dd8868d1 Mon Sep 17 00:00:00 2001 From: Peter Stevenson <2E0PGS@gmail.com> Date: Wed, 23 May 2018 12:30:46 +0100 Subject: [PATCH] Display a more user friendly error if script isn't ran as root. symlink. --- build/linux/dist/install.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build/linux/dist/install.sh b/build/linux/dist/install.sh index 0001f4832..78cf8772d 100755 --- a/build/linux/dist/install.sh +++ b/build/linux/dist/install.sh @@ -68,7 +68,9 @@ xdg_install_f() { # Add symlink for arduino so it's in users path echo "" # Ensure password request message is on new line - sudo ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino + if ! ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino; then + echo "Adding symlink failed. Hope that's OK. If not then rerun as root with sudo." + fi # Clean up rm "${TMP_DIR}/${RESOURCE_NAME}.desktop" @@ -104,7 +106,9 @@ simple_install_f() { # Add symlink for arduino so it's in users path echo "" # Ensure password request message is on new line - sudo ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino + if ! ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino; then + echo "Adding symlink failed. Hope that's OK. If not then rerun as root with sudo." + fi # Clean up temp dir rm "${TMP_DIR}/${RESOURCE_NAME}.desktop" @@ -148,7 +152,9 @@ xdg_uninstall_f() { # Remove symlink for arduino echo "" # Ensure password request message is on new line - sudo rm /usr/local/bin/arduino + if ! rm /usr/local/bin/arduino; then + echo "Removing symlink failed. Hope that's OK. If not then rerun as root with sudo." + fi } @@ -183,7 +189,9 @@ simple_uninstall_f() { # Remove symlink for arduino echo "" # Ensure password request message is on new line - sudo rm /usr/local/bin/arduino + if ! rm /usr/local/bin/arduino; then + echo "Removing symlink failed. Hope that's OK. If not then rerun as root with sudo." + fi }