Skip to content

Commit a77715f

Browse files
authored
Merge pull request #932 from per1234/post-install-macos-handling
Configure post-install script to only operate when platform installed on Linux machine
2 parents 1399d64 + 45e2945 commit a77715f

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

post_install.sh

+24-18
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,31 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0525", MODE:="0666"
1212
EOF
1313
}
1414

15-
if [ "$EUID" -ne 0 ]; then
16-
if [ -e "${PWD}/post_install.sh" ]; then
17-
echo
18-
echo "You might need to configure permissions for uploading."
19-
echo "To do so, run the following command from the terminal:"
20-
echo "sudo \"${PWD}/post_install.sh\""
21-
echo
22-
else
23-
# Script was executed from another path. It is assumed this will only occur when user is executing script directly.
24-
# So it is not necessary to provide the command line.
25-
echo "Please run as root"
15+
OS="$(uname -s)"
16+
case "$OS" in
17+
Linux*)
18+
if [ "$EUID" -ne 0 ]; then
19+
if [ -e "${PWD}/post_install.sh" ]; then
20+
echo
21+
echo "You might need to configure permissions for uploading."
22+
echo "To do so, run the following command from the terminal:"
23+
echo "sudo \"${PWD}/post_install.sh\""
24+
echo
25+
else
26+
# Script was executed from another path. It is assumed this will only occur when user is executing script directly.
27+
# So it is not necessary to provide the command line.
28+
echo "Please run as root"
29+
fi
30+
31+
exit
2632
fi
2733

28-
exit
29-
fi
34+
arduino_mbed_rules > /etc/udev/rules.d/60-arduino-mbed.rules
3035

31-
arduino_mbed_rules > /etc/udev/rules.d/60-arduino-mbed.rules
36+
# reload udev rules
37+
echo "Reload rules..."
38+
udevadm trigger
39+
udevadm control --reload-rules
3240

33-
# reload udev rules
34-
echo "Reload rules..."
35-
udevadm trigger
36-
udevadm control --reload-rules
41+
;;
42+
esac

0 commit comments

Comments
 (0)