e98b4f9cad5a1626df4134b716d37c508aa20248
[dahdi/linux.git] / build_tools / install_firmware
1 #!/bin/sh
2 # This is a helper script intended to be called from
3 # drivers/dahdi/firmware/Makefile to install the different firmware version.
4
5 FIRMWARE_PATTERN=$1
6 FIRMWARE_VERSION=$2
7 DESTDIR=$3
8
9 if ! test -f ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} || ! test -f ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}; then
10         echo "Installing ${FIRMWARE_PATTERN}.bin to hotplug firmware directories"
11         set -e
12         install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/usr/lib/hotplug/firmware
13         rm -rf ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-*
14         touch ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}
15         install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/lib/firmware
16         rm -rf ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-*
17         touch ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}
18 else
19         echo "Firmware ${FIRMWARE_PATTERN}.bin is already installed with required version ${FIRMWARE_VERSION}"
20 fi