FIRMWARE_DIR="@firmwaredir@"
+get_consent() {
+ local firmware="${1}"
+
+ cat <<EOF
+
+You are going to flash the firmware on device. This is a dangerous operation
+that might potentially damage your device.
+
+Please do NOT TURN OFF the system while the update is in progress and do
+not abort the process.
+
+ Firmware file: ${firmware}
+
+EOF
+
+ local answer
+ while [ -t 0 -a -t 1 -a -t 2 ]; do
+ # Wait for user to type y
+ printf "Do you want to proceed? [y/n] "
+ read -r answer
+
+ case "${answer}" in
+ y|Y)
+ return 0
+ ;;
+ n|N)
+ echo "Aborting."
+ return 1
+ ;;
+ esac
+ done
+}
+
read_dmi() {
local what="${1}"
return 1
fi
+ echo "New firmware version available: ${new_version}"
+
# Perform update
- do_flashrom -p "internal" -w "${firmware}"
+ if get_consent "${firmware}"; then
+ do_flashrom -p "internal" -w "${firmware}"
+ fi
}
do_update() {