forked from zephyrproject-rtos/ArduinoCore-zephyr
-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathpost_install.sh
More file actions
executable file
·49 lines (41 loc) · 1.18 KB
/
post_install.sh
File metadata and controls
executable file
·49 lines (41 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
arduino_zephyr_rules () {
cat <<EOF
# Arduino Zephyr rules
# Arduino UNO Q
# Operating mode
SUBSYSTEM=="usb", ATTR{idVendor}=="2341", ATTR{idProduct}=="0078", MODE="0666"
# EDL mode
SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", ATTR{idProduct}=="9008", MODE="0666"
EOF
}
OS="$(uname -s)"
case "$OS" in
Linux*)
if [ "$EUID" -ne 0 ]; then
if [ -e "${PWD}/post_install.sh" ]; then
if command -v pkexec > /dev/null 2>&1; then
echo "Requesting root privileges..."
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