Bash Script For Unrooting Your Transformer - Eee Pad Transformer General

I just had to unroot my transformer so I could RMA it (it didn't want to charge anymore) and I noticed that a lot of the actions could be scripted so it would be quicker and people couldn't screw the process up since it's automated.
I based my script off of [GUIDE] Official [unroot] guide here
Code:
#!/bin/bash
echo "Script by Brando56894 from XDA Developers"
directory=`pwd`
echo "Checking for necessary files...."
if [[ -e blob && EP101_SDUPDATE.zip ]]
then
echo "The necessary files are present, continuing process"
else
echo "One or more of the necessary files is missing."
echo "Would you like me to get the files for you? (y or n)"
read answer
if [[ $answer == 'y' ]]
then
wget http://dlcdnet.asus.com/pub/ASUS/EeePAD/TF101/UpdateLauncher_US_epad_user_8239.zip
unzip -n UpdateLauncher_US_epad_user_8239.zip
cd ASUS/Update
unzip US_epad-user-8.2.3.9.zip
mv blob $directory
mv US_epad-user-8.2.3.9.zip $directory/EP101_SDUPDATE.zip
else
read -p "Please acquire the needed files. Press enter to exit"
exit
fi
fi
echo
adb devices
echo
read -p "If device is listed, press enter to continue unrooting"
adb push blob /data/local/
adb push EP101_SDUPDATE.zip /Removable/MicroSD/
adb shell dd if=/data/local/blob of=/dev/block/mmcblk0p4
adb reboot recovery
echo "It should now be flashing the stock update, unrooting the TF in the process"
echo
read -p "Press enter to exit"
exit

This is for 3.2 ?

It worked for me on 3.2 but I believe it should work for any version since it wipes everything out by reflashing the blob via nvflash. Make sure you have everything backed up to your sdcard because it wipes everything, including the internal memory.

This would also work if you were, for example, on 3.2 and wanted to go back to 3.1, wouldn't it?
Edit. Do you have the filenames to be downloaded for the WW version?

Related

Need help building a custom rom

Ok I been using Deodexer_2.5.6.2 It was built for the Samsung Vibrant. It builds flawless with a signed rom, but installs with errors. I see the some mount points that need to be changed, but not sure what else. Any developer that could help with this script would be great.
Have you tried [TOOL][PORT] Autodeodexer 2.3a for the Epic 4G Froyo - Windows in the dev section as an alternative?
Koadic said:
Have you tried [TOOL][PORT] Autodeodexer 2.3a for the Epic 4G Froyo - Windows in the dev section as an alternative?
Click to expand...
Click to collapse
Yes I have, but it does not build the entire rom for me as I would like. This script is a one stop shop. However is wants to install the device mount points for the other phone(Samsung Vibrant). I have been editing the bat but seems I am missing something some where of than the bat file. Like the other Galaxy S Phones they tend to use /dev/block/bml12 of the SDCARD while EPIC uses /dev/block/dm-12. So if you use either EC05 or EB13 you know the apps that move to the sdcard use this device mount point if you have alot of apps pushed to your sdcard. However I seem to be missing something else. Need help re-writing this.
ISSUE 1 deoall.bat
%adb% -d shell su -c "mount -o rw,remount /dev/block/stl9 /system && dd if=/dev/block/bml12 of=/sdcard/modem.bin bs=4096 && dd if=/dev/block/bml7 of=/sdcard/zImage bs=4096 && chmod 444 /system/etc/dbus.conf && chmod 444 /system/etc/bluetooth/* && chmod 775 /data/app" | FINDSTR /R "su..not.found Permission.denied" >>%errorlog%
ISSUE 2 deoall.bat
%adb% -d shell sh -c "mount -o rw,remount /dev/block/stl9 /system && chmod 444 /system/etc/dbus.conf && chmod 444 /system/etc/bluetooth/*" >>%errorlog%
::
IF NOT EXIST "%~dp0modem.bin" (
ECHO Downloading modem.bin
ECHO %time% Downloading modem.bin >>%errorlog%
IF NOT EXIST "%~dp0ROM/updates" MD "%~dp0ROM/updates"
%adb% -d shell dd if=/dev/block/bml12 of=/sdcard/modem.bin bs=4096 >nul
%adb% -d pull /sdcard/modem.bin "%~dp0ROM/updates/modem.bin" >nul
%adb% -d shell rm /sdcard/modem.bin >nul
)
::
IF NOT EXIST "%~dp0zImage" (
ECHO Downloading kernel
ECHO %time% Downloading kernel >>%errorlog%
IF NOT EXIST "%~dp0ROM/updates" MD "%~dp0ROM/updates"
%adb% -d shell dd if=/dev/block/bml7 of=/sdcard/zImage bs=4096 >nul
%adb% -d pull /sdcard/zImage "%~dp0ROM/updates/zImage" >nul
%adb% -d shell rm /sdcard/zImage >nul
)
ISSUE 3 update-script
run_program /tmp/updates/redbend_ua restore /tmp/updates/modem.bin /dev/block/bml12
print "Installing kernel..."
run_program /tmp/updates/redbend_ua restore /tmp/updates/zImage /dev/block/bml7
ISSUE 4 redbend_ua
Look in the redbend_ua but it has alot of binary and some script in it. Not sure that this file plays any editing importance since I compared it to the one-click-root_2.5.5 redbend_ua. Seems they are both the same. Looks like a command used for restoring the modem and zImage.

[Q] Understanding GladRoot Root script for 1.26-1.83

I was looking at the code for GladRoot (http://forum.xda-developers.com/showthread.php?t=1016060) and I had a couple of questions I was hoping someone could answer.
First of all, does anyone have the code for psneuter?
Secondly, if the goal of rooting is to Superuser.apk, why is temporary root access necessary? I've never used adb before this, but isn't the point that developers can easily do things like install applications using it? The superuser apk might grant super user access after it's installed, but before that it's just like any other apk.
I'd appreciate it if someone could answer these questions. Thanks.
Anyone want to help me out? Doesn't seem like too hard of a question...
Id take a look at What is root access on google. It sounds like you have no idea about the basics. There is a ton of info for beginners even on this site. If I misunderstood you I apologize but your question would only leave me to believe you need to learn the basics. Good luck
Sent using the phone with the biggest balls....Atrix 4G
Gladroot doesn't give temporary root access either unless it changed.
Sent using the phone with the biggest balls....Atrix 4G
dupreeks said:
Id take a look at What is root access on google. It sounds like you have no idea about the basics. There is a ton of info for beginners even on this site. If I misunderstood you I apologize but your question would only leave me to believe you need to learn the basics. Good luck
Sent using the phone with the biggest balls....Atrix 4G
Click to expand...
Click to collapse
Well I'm definitely a beginner, but not that beginner. I'll show you what I'm talking about:
Code:
rem If we do, since we need to run several commands as root, use psneuter to
rem temporarily root the device.
echo.
echo Obtaining temporary root access...
%~dp0adb push %~dp0bin\psneuter /tmp/psneuter > NUL 2>&1
if not errorlevel 0 set message=Unable to send psneuter. && goto abort
set retval=
for /f "tokens=*" %%l in ('%~dp0adb.exe shell "/bin/chmod 6755 /tmp/psneuter > /dev/null 2>&1 && echo PASS"') do set retval=%%l
if "%retval%" neq "PASS" set message=Unable to chmod psneuter. && goto abort
set retval=
for /f "tokens=*" %%l in ('%~dp0adb.exe shell "/tmp/psneuter > /dev/null 2>&1"') do set retval=%%l
if "%retval%" neq "" set message=Unable to execute psneuter. && goto abort
echo.
echo Waiting for root access to kick in...
timeout /t 5 /nobreak > NUL 2>&1
So what I said was correct. GladRoot definitely get's temp root access. After it does that, it changes some settings and installs superuser.apk:
Code:
rem Remount the /system read/write.
echo.
echo Mounting /system as read/write...
%~dp0adb.exe shell mount -o rw,remount /dev/block/mmcblk0p12 /system > NUL 2>&1
rem Install sqlite3 for additional system changes required later in the script.
rem This is silent because it shouldn't interfere with anything even if it's
rem not used.
%~dp0adb.exe push %~dp0bin\sqlite3 /system/bin > NUL 2>&1
%~dp0adb.exe shell chmod 6755 /system/bin/sqlite3 > NUL 2>&1
echo.
echo Ready to root.
echo.
pause
rem Let's root!
rem Check for duplicate busybox installation and remove it.
echo.
echo Cleaning up SuperOneClick mess...
%~dp0adb.exe shell "find /system/xbin -type l | xargs rm" > NUL 2>&1
%~dp0adb.exe shell rm /system/xbin/busybox > NUL 2>&1
rem Copy su over and set permissions for use.
echo.
echo Rooting your device ...
%~dp0adb.exe push %~dp0bin\su /system/bin > NUL 2>&1
%~dp0adb.exe shell chmod 6755 /system/bin/su > NUL 2>&1
rem Install the Superuser app for allowing other apps root access.
echo.
echo Installing Superuser app...
%~dp0adb.exe install -r %~dp0bin\Superuser.apk > NUL 2>&1
echo.
echo Root complete.
echo.
So again my question is why do you need temp root access to install superuser.apk?
Temp root access is needed because superuser is installed in system/apps in the system partition. Without root a user does not have read write permissions in the system partition. This means a user cannot uninstall apps or install apps with out root permission. Temp access allows a script or person to modify the system partition, in this case it gives apps access to permanent root. The source code for psneuter is here.
on21st said:
Temp root access is needed because superuser is installed in system/apps in the system partition. Without root a user does not have read write permissions in the system partition. This means a user cannot uninstall apps or install apps with out root permission. Temp access allows a script or person to modify the system partition, in this case it gives apps access to permanent root. The source code for psneuter is here.
Click to expand...
Click to collapse
Yeah that pretty much sums it up. Gladroot was and still is my method of root. I wish I could unlock the boot loader with my current 1.8.3 setup I have and not lose anything. If anyone has a solution I would really appreciate it. I like my phone how it is but want to be able to make nand backups basically. I am not huge on CM7 and it doesn't seem like there are many stable roms for the Atrix right now.
You can there should be a pudding for 1.8.3. I remember using it. It wipes data and allows you to unlock the boot loader if you choose. HERE
Just choose the correct sbf to download and then follow instructions in thread.

Android 4.2.2 (PAC, CM10.1, etc): Mount CIFS share on /sdcard (incl. nls_utf8)

With Android 4.2's multi-user stuff and the dreaded "0" folder, Google broke mounting of CIFS shares for good. (They basically implemented something utterly useless for my needs, and broke something I need on a daily basis.) Cyanogenmod fixed that for mounts outside the /storage hierarchy, but many apps can't go there. And with 4.2.2, Google made using adb on the device very annoying as well, which adds to problems for a workaround for mounting shares in a useful place.
So I looked around for various fixes for that issue and compiled those into one method that works perfectly well for me on a P6810 running the current PAC ROM 20130629. It should probably work for any other CM10.1 or PA3.6x-based ROM as well. A nls_utf8.ko module compiled for the Nexus 10 is included as well, which can be loaded via punchmod (at least in PAC), so you can access shares with Ümläüts in them.
Prerequisites: SManager, SMWidgets, and a working Busybox install (I use Stericson's Busybox Installer).
1.) Extract nls_utf8.ko and punchmod from the attached .zip file and put them in /system/lib/modules. You can put them in some other place as well, but my scripts need to be adjusted then. Next, give the files sufficient permissions:
Code:
chmod 644 /system/lib/modules/nls_utf8.ko
chmod 755 /system/lib/modules/punchmod
2.) Optional: if you want the module to auto-start, create a file called 00punch-nls_utf8 (or whatever you like) with the content below, put it in /etc/init.d and chmod it to 755. To check if nls-utf8 is loaded after a reboot, type lsmod in a terminal window or adb shell - it should display the module name. If punchmod auto-detection fails, read here how to get the right vermagic string for your device: http://forum.xda-developers.com/showthread.php?p=41920265#post41920265
Code:
#!/system/bin/sh
sleep 10
/system/lib/modules/punchmod /system/lib/modules/nls_utf8.ko ""
3.) Here's the script that mounts a CIFS share. Edit the settings on top and either put your correct vermagic string as well, or delete the "$VERMAGIC" part in line 22 and try your luck with auto-detection. I put some sanity checks in the script, but it might not work for all directories in /sdcard (or, /data/media/0, to call it by its 'real' name/location). If you don't want to use the nls-utf8 module, just delete lines 18-23, and iocharset=utf8 in line 67.
Name the script mount-music.sh or something, put the script wherever you like, open SManager and navigate to the script. Run the script with SU permissions. If everything goes well, it will ask you to accept an adb RSA key, and then adb mounts the share. You can also add a desktop widget for quick access to the script with SMWidgets.
Code:
#!/system/bin/sh
# Your settings here
IP="192.168.1.123"
SHARE="Music"
USER="yourusername"
PASS="yourpassword"
MOUNTPOINT="/data/media/0/cifs"
VERMAGIC="3.0.31-CM-ga034655-dirty SMP preempt mod_unload ARMv7 p2v8 "
# Load cifs (if it isn't already loaded)
if [ `lsmod | grep -o cifs` ] ; then
:
else
insmod /system/lib/modules/cifs.ko
fi
# Load nls_utf8 brute-force style (if it isn't already loaded)
if [ `lsmod | grep -o nls_utf8` ] ; then
:
else
/system/lib/modules/punchmod /system/lib/modules/nls_utf8.ko "" "$VERMAGIC"
fi
# Check if cifs $MOUNTPOINT dir exists, create it if not, give sufficient permissions
if [ -d $MOUNTPOINT ] ; then
:
else
mkdir $MOUNTPOINT
fi
chmod 755 $MOUNTPOINT
# Check if $SHARE directory is empty - if not, unmount the share
if [ "$(su root -c busybox ls -A $MOUNTPOINT/$SHARE 2> /dev/null)" == "" ] ; then
:
else
/system/xbin/busybox umount -l $MOUNTPOINT/$SHARE
fi
# Create $SHARE directory if necessary, give sufficient permissions
if [ -d $MOUNTPOINT/$SHARE ] ; then
:
else
mkdir $MOUNTPOINT/$SHARE
fi
chmod 755 $MOUNTPOINT/$SHARE
# Starting adb
adb kill-server
export HOME=/sdcard
# PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port 5555
adb start-server
cat /sdcard/.android/adbkey.pub >> /data/misc/adb/adb_keys
stop adbd
start adbd
adb connect localhost
# Make sure we only use the first device (sometimes there is more than one)
SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
if [ "$SERIAL" = "" ] ; then
echo "ERROR: Could not find ADB device.";
fi
# Mounting share via adb
echo Mounting share via adb...
adb -s $SERIAL shell su root -c /system/xbin/busybox mount -t cifs //$IP/$SHARE $MOUNTPOINT/$SHARE -o user=$USER,pass=$PASS,iocharset=utf8,cache=none,directio,CIFSMaxBufSize=130048,rw,file_mode=0777,dir_mode=0777,uid=1015,gid=1015
# If you started adb, then stop it here for security
adb disconnect localhost
stop adbd
PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port $PORT
start adbd
# Show some results
RESULT=`mount | grep $MOUNTPOINT/$SHARE`
if [ "$RESULT" = "" ] ; then
echo "FAILED! //$IP/$SHARE could not be mounted."
else
echo "SUCCESS! //$IP/$SHARE has been mounted on $MOUNTPOINT/$SHARE."
fi
echo
echo All done. You may close this script window now.
4.) This is the script to unmount the share. Name it unmount-music.sh or similar, and edit your settings at the beginning of the script. Again, run it in SManager with SU permissions, and add a desktop widget with SMWidgets if you like.
Code:
#!/system/bin/sh
# Your settings here
SHARE="Music"
MOUNTPOINT="/data/media/0/cifs"
# Check if $SHARE directory exists
if [ -d $MOUNTPOINT/$SHARE ] ; then
# Check if $SHARE directory is empty - if not, unmount the share
if [ "$(su root -c busybox ls -A $MOUNTPOINT/$SHARE 2> /dev/null)" == "" ] ; then
echo "$MOUNTPOINT/$SHARE is empty."
else
su root -c busybox umount -l $MOUNTPOINT/$SHARE
fi
fi
# Show some results
RESULT=`mount | grep $MOUNTPOINT/$SHARE`
if [ "$RESULT" = "" ] ; then
echo "SUCCESS! $MOUNTPOINT/$SHARE has been unmounted."
else
echo "FAILED! $MOUNTPOINT/$SHARE could not be unmounted."
fi
echo
echo All done. You may close this script window now.
Hope this helps some of you. It sure stumped me how incredibly convoluted this simple and much needed procedure has become on Android 4.2.2... just because of that multi-account stuff and new restrictions on adb.
Credits:
Script bits and nls_utf8.ko by H3g3m0n
More script bits by dafunk60 and jmtw000
Punchmod by Jann Horn
Punchmod info by idcrisis
Thanks man, looks awesome, I am going to try it on my 6800.
Do you know how to mount ext4 or ntfs sdcard on CM10.1 based roms?
Removed the original post, still trying to make it work!
I checked vermagic in some existing ko files and found that it is exactly the same as yours.
Sent from my GT-p6800 using Tapatalk HD
m0bster said:
Removed the original post, still trying to make it work!
I checked vermagic in some existing ko files and found that it is exactly the same as yours.
Sent from my GT-p6800 using Tapatalk HD
Click to expand...
Click to collapse
You can try loading the UTF8 module without vermagic string as well, it should work on PAC. Or, make sure you have a blank space at the end of the vermagic string, it is required. Maybe read the short tutorial here: http://forum.xda-developers.com/showthread.php?p=41920265#post41920265
dfkt_ said:
You can try loading the UTF8 module without vermagic string as well, it should work on PAC. Or, make sure you have a blank space at the end of the vermagic string, it is required. Maybe read the short tutorial here: http://forum.xda-developers.com/showthread.php?p=41920265#post41920265
Click to expand...
Click to collapse
I finally managed to mount cifs shares, after loading original cifs and punmode load of nls_utf8.ko.
But I mounted it with cifsmanager. The script always shows "failure to mount" !

ROOT-ing a phone with a broken screen / adbkey.pub problems

Hello, so.. Before, my problem was about getting adb to work in recovery, which someone told me to install TWRP, that worked, and I got USB Debugging turned on.
Now, I seen that I need to root my phone, so I can push the adbkey.pub to data/misc/adb/adb_keys..
I tried pushing adbkeys.pub there already (without root, in recovery), and the phone still wants me to press ok, when the prompt of the RSA key pops up.
Have TWRP, ADB works when phone is in Recovery..
Phone not ROOT-ed. Which might be my problem..
USB Debugging works
adbkey.pub has been sent to data/misc/adb/adb_keys around 3 times
Generated new adbkey.pub already..
The things I did:
adb shell mount /system
abd shell
echo "persist.service.adb.enable=1" >> default.prop
echo "persist.service.debuggable=1" >> default.prop
echo "persist.sys.usb.config=mtp,adb" >> default.prop
echo "persist.service.adb.enable=1" >> /system/build.prop
echo "persist.service.debuggable=1" >> /system/build.prop
echo "persist.sys.usb.config=mtp,adb" >> /system/build.prop
exit (Exited out of adb shell)
adb push adbkey.pub /data/misc/adb/adb_keys
I had copied adbkey.pub to the adb folder.
Again, like I said in my last thread, I don't care about losing data. Flashing stuff would not be a problem with me.
If you are wondering, I am using windows.
EDIT: Regenerated another adbkey... The key is actually differient this time.. Will go into TWRP and push this key.
Has it worked with another key?
Stuck in the same situation at the moment.

[SCRIPT] Log CPU Usage with interval (Linux)

Hey guys, I've just decided to get inside of the Android development world. Anyways, I'm mostly a fan of Linux, so I've made my first Linux script, I know it's simple, but I've never interacted with the user before, or picked an output. When I knew that Android made use of Linux in its core, my interest on working inside it grew up faster than ever.
In my script, firstly, you type the filename. For compatibility reasons, it'll everytime save to /sdcard/filename. Then, it will ask you how many times you want the script to log everything, and lately, every how many seconds should it save everything to the file.
The script will save, before every entry at the log, the screen status (if it's on or off), that can help to, for example, if your device has been lagging as a result of a bad screen driver or UI error.
Last thnig: it also works on recovery (maybe it give some error, and if no dumpsys is present on your recovery's ramdisk, it'll save everything as OFF).
Remember to send it anywhere excepting from /storage and any sbudir, it won't work as the Android permissions system blocks script execution on those dirs.
Code:
clear
# Wipe $logfile content in /sdcard (if any existing)
echo "Please type the filename where you want to save the log: "
read -r logfile
echo "" > /sdcard/$logfile
echo "Deleted previous log."
echo "SCREEN | CPU" >> /sdcard/$logfile
#cont=60
cont=1
#SHOWLOG=X
echo "Please type how many times the cycle must repeat: "
read -r maxcont
echo "Please type how many seconds will the interval take: "
read -r maxmin
clear
# Here it counts how many times the logging script has been ran
while [ $cont -lt $((maxcont + 1)) ];
do
# That nested while takes control of how many seconds have passed in the current cycle
while [ "$contmin" -lt "$maxmin" ];
do
contmin=$((contmin + 1))
sleep 1
clear
echo "C: $cont/$maxcont - T: $contmin/$maxmin"
done
# echo "$maxmin seconds passed."
# Logs the fist line of "busybox top" to a var
LOGVAR=$(busybox top -d 1 -n 1 | grep "idle")
# Logs the screen state (on or off) to another var
SCREENSTATE=$(dumpsys input_method | grep mScreenOn | tr -dc '[:alnum:]\n\r' | tr '[:upper:]' '[:lower:]')
# Saves a string that tells what it should expect if the screen is on
SCREENSTATEON="msystemreadytruemscreenontrue"
if [ "$SCREENSTATE" == "$SCREENSTATEON" ]
then
echo "ON: $LOGVAR" >> /sdcard/$logfile
else
echo "OFF: $LOGVAR" >> /sdcard/$logfile
fi
cont=$((cont + 1))
contmin=0
done
echo "Show logged values? [Y/N]"
read -r SHOWLOG
case $SHOWLOG in
[yY] | [yY][Ee][Ss] )
cat /sdcard/$logfile
;;
[nN] | [n|N][O|o] )
echo "Ok, goodbye. You'll see a what you've asked me to log in /sdcard/$logfile";
exit 1
;;
*) echo "You must write Y or N to continue."
;;
esac
exit 0
For example, save it as script.sh (remember to save it using Unix codifcation, if you're running Windows, else, it'll tell you that it's unable to find many binaries, as long as Linux isn't ok with CR+LF and requires LF as newline). Then, send it to the sdcard (over USB or adb push script.sh /sdcard/) , now, run ADB shell. Type the following commands:
Code:
su -c "cp -f /sdcard/script.sh /data/local/;chmod 777 /data/local/script.sh"
Then, if you want to run it:
Code:
su
sh /data/local/script.sh
That's all, I hope you enjoy it and not so many people kills me for explaining and feeling so grateful for that simple script.

Categories

Resources