diff --git a/post_install.sh b/post_install.sh new file mode 100755 index 00000000..b7ab03c8 --- /dev/null +++ b/post_install.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +arduino_zephyr_rules () { +cat < /dev/null 2>&1; then + echo "Requesting root privileges via $PKEXEC..." + pkexec "${PWD}/post_install.sh" + else + echo + echo "You might need to configure permissions for uploading." + echo "To do so, run the following command from the terminal:" + echo "sudo \"${PWD}/post_install.sh\"" + echo + exit + fi + else + # Script was executed from another path. It is assumed this will only occur when user is executing script directly. + # So it is not necessary to provide the command line. + echo "Please run as root" + fi + + exit + fi + + arduino_zephyr_rules > /etc/udev/rules.d/60-arduino-zephyr.rules + + # reload udev rules + echo "Reload rules..." + udevadm trigger + udevadm control --reload-rules + + ;; +esac