View Single Post
Old 02-21-2011, 06:32 PM   #25
ths
Junior Member
ths began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Feb 2011
Device: Kindle 3
That seems overly complicated, and still requires modifying the root filesystem. I would suggest instead:
Code:
#!/bin/sh

KEYS_DIR=/mnt/us/update-switcher/keys

case "$1" in
	start|restart)
		# If custom keys are present and enabled, mount a
		# temporary filesystem over /etc/uks and copy the
		# custom keys there

		umount /etc/uks

		if [ -d $KEYS_DIR ] ; then
			mount -t tmpfs -o size=1M none /etc/uks &&
			cp -r $KEYS_DIR/* /etc/uks/
		fi

		exit 0
		;;

	stop)
		umount /etc/uks
		exit 0
		;;

	*)
		echo "Usage: $0 {start|stop|restart}" >&2
		exit 1
		;;
esac
To disable it, you'd simply rename the "keys" directory to "keys-disabled" or whatever.

Another idea would be to make symlinks in the tmpfs rather than copying the key files, which would allow the user to switch between hack and official keys without rebooting. It might not be a good idea to do official updates while the hack is enabled, though.
ths is offline   Reply With Quote