install_firmware 854 B

12345678910111213141516171819202122
  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. FIRMWARE_PATTERN=$1
  5. FIRMWARE_VERSION=$2
  6. DESTDIR=$3
  7. target="$DESTDIR/lib/firmware"
  8. if ! test -f $target/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}; then
  9. echo "Installing ${FIRMWARE_PATTERN}.bin to $target"
  10. tar --no-same-owner -xf ${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}.tar.gz || exit 1
  11. install -m 644 ${FIRMWARE_PATTERN}.bin $target || exit 1
  12. rm -rf $target/.${FIRMWARE_PATTERN}-*
  13. touch $target/.${FIRMWARE_PATTERN}-${FIRMWARE_VERSION}
  14. # Remove the .bin file so that if the version is reverted, it will not
  15. # be installed with a non-matching ${FIRMARE_VERSION} file.
  16. rm ${FIRMWARE_PATTERN}.bin
  17. else
  18. echo "Firmware ${FIRMWARE_PATTERN}.bin is already installed with required version ${FIRMWARE_VERSION}"
  19. fi