fragattack: updated ath9k_htc firmware install script

This commit is contained in:
Mathy Vanhoef 2020-07-21 15:47:29 +04:00 committed by Mathy Vanhoef
parent 584e024cb3
commit 26e2797247

View File

@ -1,23 +1,29 @@
#!/bin/bash
set -e
# Make backup of original firmware
if [[ ! -e /usr/lib/firmware/htc_7010.fw.backup ]];
then
cp /usr/lib/firmware/htc_7010.fw /usr/lib/firmware/htc_7010.fw.backup
cp /usr/lib/firmware/htc_9271.fw /usr/lib/firmware/htc_9271.fw.backup
echo "Made backup of original files (old directory)"
fi
function install() {
ORIGINAL=$1
MODIFIED=$2
if [[ ! -e /usr/lib/firmware/ath9k_htc/htc_7010-1.4.0.fw.backup ]];
then
cp /usr/lib/firmware/ath9k_htc/htc_7010-1.4.0.fw /usr/lib/firmware/ath9k_htc/htc_7010-1.4.0.fw.backup
cp /usr/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw /usr/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw.backup
echo "Made backup of original files (new directory)"
fi
# Create a backup of the original file
if [[ ! -e $ORIGINAL.backup ]];
then
cp $ORIGINAL $ORIGINAL.backup
fi
cp htc_*.fw /usr/lib/firmware/
cp htc_7010.fw /usr/lib/firmware/ath9k_htc/htc_7010-1.4.0.fw
cp htc_9271.fw /usr/lib/firmware/ath9k_htc/htc_9271-1.4.0.fw
echo "Copied compiled firmware to the system"
# Overwrite it with the modified firmware image
cp $MODIFIED $ORIGINAL
}
HTC7010=$(ls /lib/firmware/ath9k_htc/*7010* | grep -v backup)
HTC9271=$(ls /lib/firmware/ath9k_htc/*9271* | grep -v backup)
for ORIGINAL in $HTC7010
do
install $ORIGINAL htc_7010.fw
done
for ORIGINAL in $HTC9271
do
install $ORIGINAL htc_9271.fw
done