3 # kinect_patch_udev_rules - Patch contrib/ udev rules file to load UACFirmware
5 # Copyright (C) 2016 Antonio Ospite <ao2@ao2.it>
7 # This program is free software. It comes without any warranty, to
8 # the extent permitted by applicable law. You can redistribute it
9 # and/or modify it under the terms of the Do What The Fuck You Want
10 # To Public License, Version 2, as published by Sam Hocevar. See
11 # http://sam.zoy.org/wtfpl/COPYING for more details.
15 [ $# -lt 3 ] && { echo "usage: $(basename "$0") <firmware path> <kinect_upload_fw path> <55-kinect_audio.rules path>" 1>&2; exit 1; }
20 [ "x$FIRMWARE_PATH" != "x" ] || { echo "Empty FIRMWARE_PATH" 1>&2; exit 1;}
21 [ "x$LOADER_PATH" != "x" ] || { echo "Empty LOADER_PATH" 1>&2; exit 1;}
23 # The udev rules file must exist the other files may not exist just yet: they
24 # may be under a prefixed path different from the final one, like in the case
25 # when this is called at package creation time.
26 [ -f "$UDEV_RULES_PATH" ] || { echo "Cannot find the udev rules file: $UDEV_RULES_PATH" 1>&2; exit 1; }
28 if grep -q "@LOADER_PATH@ @FIRMWARE_PATH@" "$UDEV_RULES_PATH";
30 sed -e "s|@LOADER_PATH@|${LOADER_PATH}|g" \
31 -e "s|@FIRMWARE_PATH@|${FIRMWARE_PATH}|g" \
34 echo "$UDEV_RULES_PATH does not contain the expected placeholders." 2>&1