Skip to content

Commit 702976f

Browse files
2E0PGSfacchinm
authored andcommitted
Display a more user friendly error if script isn't ran as root. symlink.
1 parent 4cd38aa commit 702976f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

build/linux/dist/install.sh

+12-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ xdg_install_f() {
6868

6969
# Add symlink for arduino so it's in users path
7070
echo "" # Ensure password request message is on new line
71-
sudo ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino
71+
if ! ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino; then
72+
echo "Adding symlink failed. Hope that's OK. If not then rerun as root with sudo."
73+
fi
7274

7375
# Clean up
7476
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
@@ -104,7 +106,9 @@ simple_install_f() {
104106

105107
# Add symlink for arduino so it's in users path
106108
echo "" # Ensure password request message is on new line
107-
sudo ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino
109+
if ! ln -s ${SCRIPT_PATH}/arduino /usr/local/bin/arduino; then
110+
echo "Adding symlink failed. Hope that's OK. If not then rerun as root with sudo."
111+
fi
108112

109113
# Clean up temp dir
110114
rm "${TMP_DIR}/${RESOURCE_NAME}.desktop"
@@ -148,7 +152,9 @@ xdg_uninstall_f() {
148152

149153
# Remove symlink for arduino
150154
echo "" # Ensure password request message is on new line
151-
sudo rm /usr/local/bin/arduino
155+
if ! rm /usr/local/bin/arduino; then
156+
echo "Removing symlink failed. Hope that's OK. If not then rerun as root with sudo."
157+
fi
152158

153159
}
154160

@@ -183,7 +189,9 @@ simple_uninstall_f() {
183189

184190
# Remove symlink for arduino
185191
echo "" # Ensure password request message is on new line
186-
sudo rm /usr/local/bin/arduino
192+
if ! rm /usr/local/bin/arduino; then
193+
echo "Removing symlink failed. Hope that's OK. If not then rerun as root with sudo."
194+
fi
187195

188196
}
189197

0 commit comments

Comments
 (0)