^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) # install the aoe-specific udev rules from udev.txt into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) # the system's udev configuration
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) me="`basename $0`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) # find udev.conf, often /etc/udev/udev.conf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) # (or environment can specify where to find udev.conf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) if test -z "$conf"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) if test -r /etc/udev/udev.conf; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) conf=/etc/udev/udev.conf
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) conf="`find /etc -type f -name udev.conf 2> /dev/null`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) if test -z "$conf" || test ! -r "$conf"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) echo "$me Error: no udev.conf found" 1>&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) # find the directory where udev rules are stored, often
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) # /etc/udev/rules.d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) rules_d="`sed -n '/^udev_rules=/{ s!udev_rules=!!; s!\"!!g; p; }' $conf`"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) if test -z "$rules_d" ; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) rules_d=/etc/udev/rules.d
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) if test ! -d "$rules_d"; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) echo "$me Error: cannot find udev rules directory" 1>&2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) exit 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) fi
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"