wiringPi: Add udev rules to correct /dev/gpiomem permission
Signed-off-by: Yang Deokgyu <secugyu@gmail.com>
This commit is contained in:
1
debian/odroid-wiringpi.install
vendored
1
debian/odroid-wiringpi.install
vendored
@@ -2,3 +2,4 @@ debian/tmp/usr/bin
|
||||
debian/tmp/usr/man usr/share
|
||||
README.TXT usr/share/doc/wiringpi
|
||||
People usr/share/doc/wiringpi
|
||||
udev/rules.d tmp/odroid-wiringpi
|
||||
|
||||
47
debian/odroid-wiringpi.postinst
vendored
Normal file
47
debian/odroid-wiringpi.postinst
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
msg() {
|
||||
echo "odroid-wiringpi: $1"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
configure)
|
||||
if [ -c "/dev/gpiomem" ] && [ "$(stat -c "%a %G" "/dev/gpiomem")" != "660"*"odroid" ]; then
|
||||
hardware=$(fgrep Hardware /proc/cpuinfo | head -1 | awk '{ printf("%s %s %s\n", $3, $4, $5) }' | xargs)
|
||||
case "$(echo $hardware | tr [:upper:] [:lower:])" in
|
||||
*xu4)
|
||||
cp -f /tmp/odroid-wiringpi/rules.d/99-odroid-wiringpi-exynos.rules /etc/udev/rules.d
|
||||
;;
|
||||
*c1|*c2|*n2)
|
||||
cp -f /tmp/odroid-wiringpi/rules.d/99-odroid-wiringpi-aml.rules /etc/udev/rules.d
|
||||
;;
|
||||
*)
|
||||
msg "This system seems not ODROID"
|
||||
;;
|
||||
esac
|
||||
|
||||
msg "Reload udev..."
|
||||
[ -x "$(command -v udevadm)" ] \
|
||||
&& udevadm trigger \
|
||||
|| msg "udevadm not found. Please reboot to take effect"
|
||||
else
|
||||
msg "Not found $GPIOMEM"
|
||||
msg "You will not be able to use WiringPi without root permission"
|
||||
fi
|
||||
|
||||
msg "Remove temporary files..."
|
||||
rm -rf /tmp/odroid-wiringpi
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
19
debian/odroid-wiringpi.postrm
vendored
Normal file
19
debian/odroid-wiringpi.postrm
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
purge)
|
||||
rm -f /etc/udev/rules.d/99-odroid-wiringpi-*
|
||||
;;
|
||||
|
||||
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postrm called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user