#!/bin/sh # This is a helper script intended to be called from # drivers/dahdi/firmware/Makefile to install the different firmware version. FIRMWARE_PATTERN=$1 FIRMWARE_VERSION=$2 DESTDIR=$3 if ! test -f ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} || ! test -f ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}; then echo "Installing ${FIRMWARE_PATTERN}.bin to hotplug firmware directories" tar --no-same-owner -xf ${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}.tar.gz || exit 1 install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/usr/lib/hotplug/firmware || exit 1 rm -rf ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-* touch ${DESTDIR}/usr/lib/hotplug/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} install -m 644 ${FIRMWARE_PATTERN}.bin ${DESTDIR}/lib/firmware || exit 1 rm -rf ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-* touch ${DESTDIR}/lib/firmware/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION} # Remove the .bin file so that if the version is reverted, it will not # be installed with a non-matching ${FIRMARE_VERSION} file. rm ${FIRMWARE_PATTERN}.bin else echo "Firmware ${FIRMWARE_PATTERN}.bin is already installed with required version ${FIRMWARE_VERSION}" fi