View Single Post
Old 02-15-2012, 01:06 PM   #1
matejs
Member
matejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with othersmatejs plays well with others
 
Posts: 10
Karma: 2602
Join Date: Jan 2012
Device: Kindle Touch
Arrow [Kindle Touch] Disable OTA updates [How To]

I have installed a few modifications and don't want Amazon breaking it with OTA updates.

This is how I disabled the 'Settings -> Menu -> Update Your Kindle' and hopefully automatic updates too.

Requirements: Kindle Touch 5.0.3, jailbreak, root ssh

What it does: If you start update from settings, it logs a message about disabled OTA, the update*.bin file stays untouched. If you restart the Kindle, the update fails (error 3, press home to continue) and the update*.bin is deleted.

Instructions:
1) edit file /etc/upstart/ota-update.conf
Spoiler:
Code:
description "Intitates the OTA update process"

emits ota-update

export LANG LC_ALL

env BATTERY_MIN_CHARGE=15

env ERR_NONE=0
env ERR_BAD_ARG=1
env ERR_FILE_NOT_FOUND=2
env ERR_LOW_BAT=3

pre-start script
	source /etc/upstart/functions

	############## DISABLE OTA UPDATES ##############
	if [ -e "/mnt/us/DISABLE_OTA" ]
	then
		f_log E ota-update check "" "####################################################"
		f_log E ota-update check "" "# UPDATES DISABLED in /etc/upstart/ota-update.conf #"
		f_log E ota-update check "" "#   REMOVE FILE /mnt/us/DISABLE_OTA (in USB root)  #"
		f_log E ota-update check "" "####################################################"
		return $ERR_LOW_BAT
	fi
	############## DISABLE OTA UPDATES ##############

	[ -n "${BUNDLE}" ] || {
		f_log E ota-update check "" "BUNDLE not defined"
		return $ERR_BAD_ARG
	}

	[ -e "${BUNDLE}" ] || {
		f_log E ota-update check "" "No update file found"
		return $ERR_FILE_NOT_FOUND
	}

	set +e
	BATTERY_CHARGE=$(gasgauge-info -s)
	ERROR_STATE=$?
	BATTERY_CHARGE=$(echo "${BATTERY_CHARGE}" | sed 's/\%//')
	set -e
	[ -n "${BATTERY_CHARGE}" -a ${ERROR_STATE} -eq $ERR_NONE ] || {
		f_log W ota-update check "" "Gas guage info not available"
		BATTERY_CHARGE=0
	}
	
	set +e
	BATTERY_THRESHOLD=$(get-dynconf-value update.battery.threshold)
	ERROR_STATE=$?
	set -e
	if [ ${ERROR_STATE} -ne $ERR_NONE ] 
	then
		BATTERY_THRESHOLD=$BATTERY_MIN_CHARGE
	fi
	[ ${BATTERY_CHARGE} -ge ${BATTERY_THRESHOLD} -o -n "${FORCE}" ] || {
		MESSAGE="Inadequate battery charge, must be "
		MESSAGE="${MESSAGE} ${BATTERY_THRESHOLD} % or higher, "
		MESSAGE="${MESSAGE} currently at ${BATTERY_CHARGE} %"
		f_log W ota-update check "" "${MESSAGE}"
		return $ERR_LOW_BAT
	}

	return $ERR_NONE
end script

script
	# Issue the ota-update signal and wait for completion.
	initctl emit ota-update
	exec /usr/sbin/otaup "${BUNDLE}" > /dev/console
end script

2) create file /mnt/us/DISABLE_OTA (/mnt/us is what you see if you connect Kindle as USB mass storage)

To re-enable updates: remove or rename the file /mnt/us/DISABLE_OTA . (Or delete the modification from /etc/upstart/ota-update.conf)

As always, make backups and be carefull. No guarantees.
matejs is offline   Reply With Quote