another small optimization
authorFelix Fietkau <nbd@openwrt.org>
Sun, 9 Oct 2005 23:24:35 +0000 (23:24 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 9 Oct 2005 23:24:35 +0000 (23:24 +0000)
SVN-Revision: 2091

openwrt/package/webif/files/www/cgi-bin/webif/upgrade.sh

index 6b5fe9a166e9a051e12e4d7e71ebe2bbad76534a..50b85af01cc0914a67bd048410df6ede825833da 100755 (executable)
@@ -4,12 +4,15 @@
 header "System" "Firmware upgrade" "Firmware upgrade"
 
 strip_cybertan() {
-       dd if="$FORM_firmware" of=/tmp/upgrade.bin bs=32 skip=1 2>/dev/null
-       rm $FORM_firmware
+       (
+               dd of=/dev/null bs=32 count=1 2>/dev/null
+               cat > /tmp/upgrade.bin
+       ) < "$FORM_firmware"
+       rm "$FORM_firmware"
 }
 
 empty "$FORM_submit" || empty "$FORM_firmware" || {
-       [ -n $FORM_firmware ] && {
+       exists $FORM_firmware && {
                HEADER=$(head -c4 $FORM_firmware | hexdump -e "8/1 \"%x\"")
                grep BCM947 /proc/cpuinfo > /dev/null && {
                        case "$HEADER" in