Signed-off-by: Yang Deokgyu <secugyu@gmail.com> Signed-off-by: Luke Go <sangch.go@gmail.com> Change-Id: I0fd2de97d95bb8bf71cc1975081177571b1e8301
54 lines
1.3 KiB
Bash
54 lines
1.3 KiB
Bash
#!/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 -a Hardware /proc/cpuinfo | head -1 | awk '{ printf("%s %s %s\n", $3, $4, $5) }' | xargs)
|
|
[ "$hardware",, != *"odroid"* ] \
|
|
&& [ -f "/sys/firmware/devicetree/base/model" ] \
|
|
&& hardware=$(cat /sys/firmware/devicetree/base/model)
|
|
case "$(echo $hardware | tr [:upper:] [:lower:])" in
|
|
*xu4)
|
|
cp -f /tmp/odroid-wiringpi/rules.d/99-odroid-wiringpi-exynos.rules /etc/udev/rules.d/
|
|
;;
|
|
*c|*c1|*c2)
|
|
cp -f /tmp/odroid-wiringpi/rules.d/99-odroid-wiringpi-meson.rules /etc/udev/rules.d/
|
|
;;
|
|
*n2|*c4)
|
|
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
|