Check and delete outdated fwkeys (fix #683), also fix #685

- i have updated the keys in theapplewiki, they should be correct now
- also run full path for nvram erase all command
This commit is contained in:
LukeeGD 2025-02-25 20:29:50 +08:00
parent 376114a19b
commit 6bbf7807f0

View File

@ -2257,17 +2257,18 @@ device_fw_key_check() {
log "Checking firmware keys in $keys_path" log "Checking firmware keys in $keys_path"
if [[ -e "$keys_path/index.html" ]]; then if [[ -e "$keys_path/index.html" ]]; then
if [[ $(cat "$keys_path/index.html" | grep -c "$build") != 1 ]]; then if [[ $(cat "$keys_path/index.html" | grep -c "$build") != 1 ]]; then
log "Existing firmware keys are not valid. Deleting"
rm "$keys_path/index.html" rm "$keys_path/index.html"
fi fi
case $build in case $build in
1[23]* ) 1[23]* )
if [[ $(cat "$keys_path/index.html" | sed "s|DeviceTree.${device_model}ap||g" | grep -c "${device_model}ap") != 0 ]]; then if [[ $(cat "$keys_path/index.html" | sed "s|DeviceTree.${device_model}ap||g" | grep -c "${device_model}ap") != 0 ]]; then
log "Existing firmware keys seem to have incorrect filenames. Deleting"
rm "$keys_path/index.html" rm "$keys_path/index.html"
fi fi
;; ;;
esac esac
if [[ $(cat "$keys_path/index.html" | grep -c "2025-02-25") != 1 ]]; then
rm "$keys_path/index.html"
fi
fi fi
if [[ ! -e "$keys_path/index.html" ]]; then if [[ ! -e "$keys_path/index.html" ]]; then
@ -2290,6 +2291,7 @@ device_fw_key_check() {
fi fi
mv index.html "$keys_path/" mv index.html "$keys_path/"
fi fi
if [[ $1 == "base" ]]; then if [[ $1 == "base" ]]; then
device_fw_key_base="$(cat $keys_path/index.html)" device_fw_key_base="$(cat $keys_path/index.html)"
elif [[ $1 == "temp" ]]; then elif [[ $1 == "temp" ]]; then
@ -6618,7 +6620,7 @@ menu_ramdisk() {
continue continue
fi fi
log "Sending command for erasing all content and settings..." log "Sending command for erasing all content and settings..."
$ssh -p $ssh_port root@127.0.0.1 "nvram oblit-inprogress=5" $ssh -p $ssh_port root@127.0.0.1 "/usr/sbin/nvram oblit-inprogress=5"
log "Done. Reboot to apply changes, or clear NVRAM now to cancel erase" log "Done. Reboot to apply changes, or clear NVRAM now to cancel erase"
;; ;;
"remove4" ) device_ramdisk_setnvram;; "remove4" ) device_ramdisk_setnvram;;