| 1234567891011121314151617181920212223242526272829303132 |
- #!/bin/sh
- /sbin/mount -uw /
- rm -f temp.nvm
- rm -f tempnvrm.txt
- fname=$2
- loc="/AppleInternal/Diags/WiFiFirmware/"$1"/"
- filename=$(echo $fname | cut -d'.' -f1)
- exts=$(echo $fname | cut -d'.' -f2)
- newfname=$filename"-orig."$exts
- if [ -f "$loc$newfname" ]; then
- echo "Backup nvram file exists!"
- else
- cp $loc$fname $loc$newfname
- fi
- cat $loc$fname | tr -c "[:print:]^\n" "\n" > temp.nvm
- if [ `cat temp.nvm | grep "btc_mode=4" | wc -l` -eq 0 ]; then
- len=$(cat temp.nvm | wc -l)
- i=1
- while [ `head -$i temp.nvm | tail -1 | grep "boardflags2" | wc -l` -eq 0 ]; do i=$(($i+1)); done
- head -$(($i-1)) temp.nvm > tempnvrm.txt
- echo "boardflags2=0x800000" >> tempnvrm.txt
- echo "btc_mode=4" >> tempnvrm.txt
- tail -n +$(($i+1)) temp.nvm >> tempnvrm.txt
- mv tempnvrm.txt $loc$fname
- fi
|