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