Skip to content

Instantly share code, notes, and snippets.

@littleblacklb
Last active November 3, 2023 12:09
Show Gist options
  • Save littleblacklb/b9a0efe0a6f75fbbe3b65879dfe3e9c9 to your computer and use it in GitHub Desktop.
Save littleblacklb/b9a0efe0a6f75fbbe3b65879dfe3e9c9 to your computer and use it in GitHub Desktop.
A shell script to elevate the framework user permission to root on jailbroken Kindle
#!/bin/sh
# A shell script to elevate the framework user permission to root on jailbroken Kindle
# So the "cannot open framebuffer" exceptions might be gotten fixed. (For example on KOReader)
# Usage:
# 1. Use USB to plug your Kindle device to computer
# 2. Copy this file to kindle root directory
# 3. Enter ;log runme on search bar and wait for rebooting if no error happens
col=0
row=16
prtxt() {
if [ "$row" -ge 33 ]; then
row=0
# clear the display
eips -c
fi
eips $col $row -h "$1"
row=$((row + 1))
}
prtxt 'Try to modify rootfs to writable'
mntroot rw
if [ $? -ne 0]; then
prtxt 'Failed. Probably you are not root.'
return 0
else
prtxt 'Succ.'
fi
cp /etc/passwd /etc/passwd_bak
if [ $? -ne 0]; then
prtxt 'Make backup for passwd failed.'
return 0
else
prtxt 'Make backup for passwd succ.'
fi
sed -i 's/framework:x:9000:/framework:x:0:/' /etc/passwd
if [ $? -ne 0]; then
prtxt 'Elevated failed.'
else
prtxt 'Elevated succ.'
fi
# Sleep for 3 seconds before the logs are covered by UI.
sleep 3
#!/bin/sh
col=0
row=16
prtxt() {
if [ "$row" -ge 33 ]; then
row=0
# clear the display
eips -c
fi
eips $col $row -h "$1"
row=$((row + 1))
}
prtxt 'Try to modify rootfs to writable'
mntroot rw
if [ $? -ne 0]; then
prtxt 'Failed. Probably you are not root.'
return 0
else
prtxt 'Succ.'
fi
cp /etc/passwd /etc/passwd_bak
if [ $? -ne 0]; then
prtxt 'Make backup for passwd failed.'
return 0
else
prtxt 'Make backup for passwd succ.'
fi
sed -i 's/framework:x:9000:/framework:x:0:/' /etc/passwd
if [ $? -ne 0]; then
prtxt 'Elevated failed.'
else
prtxt 'Elevated succ.'
fi
# Sleep for 3 seconds before the logs are covered by GUI.
sleep 3
# Reboot to take the modification into effect.
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment