[Q] Updater-script code - Android Software/Hacking General [Developers Only]

Can someone convert this adb shell code in an updater-script code?
Code:
@files\adb shell "su -c 'busybox mount -o remount,rw /system'"
@files\adb shell "su -c 'busybox mount | grep system'"
@files\adb shell "su -c 'chmod 0777 /system/etc/install-recovery.sh'"
@files\adb shell "su -c 'chown root.shell /system/etc/install-recovery.sh'"
@files\adb shell "su -c 'chmod 0755 /system/bin/sysinit'"
@files\adb shell "su -c 'chown root.shell /system/bin/sysinit'"
@files\adb shell "su -c 'chmod 0777 /system/xbin/run-parts'"
@files\adb shell "su -c 'chown root.shell /system/xbin/run-parts'"
@files\adb shell "su -c 'chmod 0777 /system/etc/init.d/'"
@files\adb shell "su -c 'chmod 0777 /system/etc/init.d/*'"
@files\adb shell "su -c 'chown root.root /system/etc/init.d/'"

mount("(the file system for /system. ie: ext3, ext4, fat)", "(Probably EMMC)", "/dev/block/(the block name for your partition)", "/system");
/system/etc/install-recovery.sh
set_perm(0, 2000, 06777, "/system/etc/install-recovery.sh");
Yada, yada, yada.
The main reason I'm not doing this for you is because it seems specific to a certian issue and I think you should do the research to get it right. Either that of risk screwing something up bad.
About making an edify script. What you are trying to do/
A nice read on linux permissions Check the lower half about setting UID and GID. Nicely done.

Related

Samsung Behold 2 Rooting

Here is the commands I used:
cd\
cd androidsdk\tools
adb push try3.dat /data/local
adb shell chmod 0755 /data/local/try3
adb shell
/data/local/try3 /system/bin/sh
mount -o rw,remount /dev/st9 /system
chmod 04755 /system/bin/sh
cat /sdcard/su.dat > /system/bin/su1
cat /sdcard/su.dat > /system/bin/su
chmod 04755 /system/bin/su
su
cat /system/bin/playlogo > /system/bin/playlogo_real
/system/bin/chmod 0755 /system/bin/playlogo_real
echo “#!/system/bin/sh
/data/local/try3.dat /system/bin/sh
mount -o rw,remount /dev/st9 /system
chmod 04755 /system/bin/sh
cat /system/bin/su1 > /system/bin/su
chmod 04755 /system/bin/su
/system/bin/playlogo_real” > /system/bin/playlogo
exit
exit
exit
adb install Superuser.apk
adb shell reboot
It said Superuser.apk installed successful. When I tried to reboot it said permission denied.
Here is the CMD pasted. Please help me I have no idea what I am doing wrong.
C:\AndroidSDK>cd\
C:\>reboot
'reboot' is not recognized as an internal or external command,
operable program or batch file.
C:\>cd\
C:\>cd androidsdk\
C:\AndroidSDK>adb shell
error: device not found
C:\AndroidSDK>adb shell
error: device not found
C:\AndroidSDK>adb shell
$ su
su
su: permission denied
$ exit
exit
C:\AndroidSDK>adb devices
List of devices attached
SGH-T939 device
C:\AndroidSDK>adb shell
$ su.dat
su.dat
su.dat: permission denied
$ exit
exit
C:\AndroidSDK>adb shell
$ su
su
su: permission denied
$ su.dat
su.dat
su.dat: permission denied
$ exit
exit

need help to make a rom kitchen for sg3

hi guys,i'm working for make a rom kitchen for our sg3 those days
it's 40% done,but i have some troubles
i can't root via this script,can you help me?
this is my code:
Code:
adb push .\root\rageagainstthecage /data/local/tmp/rageagainstthecage
adb push .\root\Superuser.apk /data/local/tmp/Superuser.apk
adb push .\root\su /data/local/tmp/su
adb push .\root\busybox /data/local/tmp/busybox
adb shell chmod 755 /data/local/tmp/busybox
adb shell chmod 755 /data/local/tmp/rageagainstthecage
adb shell "/data/local/tmp/rageagainstthecage"
adb kill-server
adb start-server
adb -d shell "mount -o remount,rw /dev/block/stl9 /system"
adb push .\root\su /system/bin/su
adb push .\root\busybox /system/bin/busybox
adb push .\root\sqlite3 /system/bin/sqlite3
adb push .\root\Superuser.apk /system/app/
adb shell "/system/bin"
adb -d shell "chmod 4755 su"
adb -d shell "chmod 4755 busybox"
adb -d shell "chmod 4755 sqlite3"
maybe it's complicate, i tried many times to mod it,but no result.
i run it ,it goes to
adb -d shell "mount -o remount,rw /dev/block/stl9 /system"
this line ,says ‘mount :operation not permitted ’
and it still $ instead of #
i do not know where the problem is ...
plz help me
hi pls their are two tutorials on this subject pls ask ur question in one of the threads
CLOSED
and my base version is ZHJPF
i think u need to su to remount system as rw.

[Q] [A] Missing line for rooting Prime/ICS

This was missing in all batch files I stumbled on. As I have not posted 10 times I thought to place it here to increase awareness.
http://forum.xda-developers.com/showpost.php?p=21308895&postcount=53
So correct batch file is:
Code:
@echo ---------------------------------------------------------------
@echo Easy rooting toolkit for Transformer Prime!
@echo Script by Max Lee from TransformerPrimeRoot.com
@echo Credits go to XDA users sparkym3 and Dan Rosenburg for exploit.
@echo ---------------------------------------------------------------
@echo [*] This script will:
@echo (1) root your Transformer Prime on ICS
@echo (2) install Busybox
@echo (3) install SU files
@echo [*] Before u begin:
@echo (4) Make sure to read full instructions at TransformerPrimeRoot.com!
@echo ---------------------------------------------------------------
@echo CONFIRM ALL THE ABOVE THEN
@echo Please hit Enter when ready.
@pause
@echo Rooting...
@adb wait-for-device
@echo Start Rooting...
@adb shell mv /data/local/tmp /data/local/tmp.bak
@adb shell ln -s /data /data/local/tmp
@adb reboot
@echo reboot #1 - DO NOT DISCONNECT YOUR DEVICE!
@PING 1.1.1.1 -n 1 -w 5000 >NUL
@adb wait-for-device
@adb shell rm /data/local.prop
@adb shell "echo \"ro.kernel.qemu=1\" > /data/local.prop"
@adb reboot
@echo reboot #2 - DO NOT DISCONNECT YOUR DEVICE!
@PING 1.1.1.1 -n 1 -w 5000 >NUL
@adb wait-for-device
@adb remount
@PING 1.1.1.1 -n 1 -w 1000 >NUL
@adb push su /system/bin/su
@adb shell "chown root.shell /system/bin/su"
@adb shell "chmod 06755 /system/bin/su"
@adb shell "rm /system/xbin/su"
@adb shell "ln -s /system/bin/su /system/xbin/su"
@adb push Superuser.apk /system/app/.
@adb shell rm /data/local.prop
@adb shell rm /data/local/tmp
@adb shell mv /data/local/tmp.bak /data/local/tmp
@adb push busybox /data/local/tmp/.
@adb shell "chmod 755 /data/local/tmp/busybox"
@adb shell "/data/local/tmp/busybox mount -o remount,rw /system"
@adb shell "dd if=/data/local/tmp/busybox of=/system/xbin/busybox"
@adb shell "chown root.shell /system/xbin/busybox"
@adb shell "chmod 04755 /system/xbin/busybox"
@adb shell "/system/xbin/busybox --install -s /system/xbin"
@adb shell "rm -r /data/local/tmp/busybox"
@echo rebooting
@adb reboot
@echo All Done rooting Transformer Prime, check out TransformerPrimeRoot.com for more cool stuff!
@pause

Htc One X Rooting Tester

I'm actually waiting for my new HTC One X and I want to root it without going over htcdev and unlocking the bootloader. So I found this:
modaco.com/topic/353986-testing-rooting-your-one-x-without-unlocking-the-bootloader-windows-mac-linux/
In the comments you can see that it's not working with S-On
So rewrote it:
Download the files from: modaco.com/topic/353986-testing-rooting-your-one-x-without-unlocking-the-bootloader-windows-mac-linux/
And for Mac you need 2 Scripts.
Replace "root-mac.sh" with this
echo "HTC One X Tegra 3 Root Script"
echo "Don't touch the device or unplug while rooting!"
echo "Push files"
chmod +x ./adb-mac
./adb-mac kill-server
./adb-mac wait-for-device
./adb-mac push busybox /data/local/busybox
./adb-mac push su /data/local/su
./adb-mac push Superuser.apk /data/local/Superuser.apk
./adb-mac shell "chmod 777 /data/local/busybox"
./adb-mac shell "chmod 755 /data/local/su"
./adb-mac shell "chmod 755 /data/local/Superuser.apk"
./adb-mac shell "mv /data/tigps/aiding /data/tigps/aiding.old"
./adb-mac shell "ln -s /data /data/tigps/aiding"
./adb-mac shell "cat /etc/vold.fstab > /etc/vold.fstab.old"
./adb-mac shell "echo ro.kernel.qemu=1 > /etc/vold.fstab"
echo "Rebooting..."
./adb-mac reboot
echo "Wait until your device has booted up! Then run root-mac2.sh"
and create a new file called "root-mac2.sh" with the following code
echo "HTC One X Tegra 3 Root Script2"
echo "Don't touch the device or unplug while rooting!"
echo "Remounting..."
chmod +x ./adb-mac
./adb-mac kill-server
./adb-mac wait-for-device
./adb-mac shell "mount -wo remount rootfs /"
./adb-mac shell "mount -o remount,rw -t ext4 /dev/block/mmcblk0p12 /system"
echo "Getting files ready..."
./adb-mac shell "cat /data/local/busybox > /system/xbin/busybox"
./adb-mac shell "chmod 777 /system/xbin/busybox"
./adb-mac shell "/system/xbin/busybox --install -s /system/xbin"
./adb-mac shell "busybox cp /data/local/Superuser.apk /system/app/Superuser.apk"
./adb-mac shell "busybox cp /data/local/su /system/xbin/su"
./adb-mac shell "chown 0.0 /system/xbin/su"
./adb-mac shell "chmod 06755 /system/xbin/su"
./adb-mac shell "chmod 644 /system/app/Superuser.apk"
./adb-mac shell "rm /etc/vold.fstab"
./adb-mac shell "mv /etc/vold.fstab.old /etc/vold.fstab"
./adb-mac shell "rm /data/tigps/aiding"
./adb-mac shell "mv /data/tigps/aiding.old /data/tigps/aiding"
echo "Done! Rebooting..."
./adb-mac reboot
I'm not responsible for any damage. But it should work!
Can someone test it? The problem is I don't have a HTC One X yet
If you actually read the thread you linked, you would know already that this doesn't work.

[Tutorial] Creating adb script to flash ROM

Dear all
I know there are numbers of you who want to start developing for our XL. There are numbers of way to flashROM. Either you can flash your ROM via system.img or ROM.zip etc etc. And here are we to explore creating rom via adb script. The earlier two ROM flashing mean require you to have unlocked bootloader but adb script ROM can be flashed on L/UL mobile devices. Lets get started with:
NOTE: The phone needs to be rooted to flash adb script. For your assistance I will attach a ROM template along with this post.
Click to expand...
Click to collapse
Preparation
Please create two folders inside your working folder with name [Your ROM Name] and [Your ROM Name_PC].
Copy all your system files/folder inside your [Your ROM Name] folder.
Please avoid creating folder within folder to avoid confusion. For example: if you are adding ringtones in your ROM consider creating folder inside [Your ROM Name] with name ringtones instead of creating folder structure like media/audio/ringtones.
In [Your ROM Name_PC] folder create a folder with name adb and copy adb.exe, AdbWinApi.dll and AdbWinUsbApi.dll inside it from your android sdk. If you are using my template then you can skip this step as i have already included adb folder inside [Your ROM Name_PC]
Scripting ADB Flasher
1. Create a new text file and rename it as Setup.bat. Remember to remove .txt extension and replace it with .bat extension.
Right Click on Setup.bat and click Edit. The file will open in notepad.
2. Copy Following lines of Code and paste it in your Setup.bat file.
HTML:
[user=279333]@ECHO[/user] off
TITLE [YOUR ROM NAME] by [Dev_Name] [Version 1.0]
COLOR 70
mode con:cols=100 lines=40
ECHO.
Pause
ECHO Waiting For Device.....
[user=302893]@adb[/user]\adb wait-for-device
[user=302893]@adb[/user]\adb shell "su -c 'stop'"
ECHO Getting System access.....
[user=302893]@adb[/user]\adb shell "su -c 'mount -o rw,remount /system/ /system/'"
This will mount system folder with read write privilege.
3. Before flashing your apks and other stuff you need to make sure you remove corresponding stuffs from the system. I have listed generic folders inside the code below please add/delete lines as per your application preferences.
HTML:
ECHO Removing system files
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/app/*.odex'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/app/*.apk'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/fonts/*.ttf'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/framework/*.jar'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/framework/*.apk'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/framework/*.odex'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/media/audio/ringtones/*.ogg'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/media/audio/alarms/*.ogg'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/media/audio/notifications/*.ogg'"
[user=302893]@adb[/user]\adb shell "su -c 'rm /system/media/audio/ui/*.ogg'"
ECHO System files removed successfully!
ECHO.
4. Copy each and every content of each folder you want to flash in corresponding folders of the system. Below is the sample code please consider adding/deleting as per your preferences.
HTML:
ECHO COPYING FILES.....
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/framework/* /system/framework/'"
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/app/* /system/app/'"
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/fonts/* /system/fonts/'"
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/media/* /system/media/'"
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/ringtones/* /system/media/audio/ringtones/'"
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/alarms/* /system/media/audio/alarms/'"
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/notifications/* /system/media/audio/notifications/'"
[user=302893]@adb[/user]\adb shell "su -c 'cp /sdcard/[Your ROM Name]/ui/* /system/media/audio/ui/'"
5. After you have copied all your files/folders into the system you need to add permission in case of framework and apps and any other folders requiring special permission. Below is the sample code please consider adding/deleting as per your preferences.
HTML:
ECHO SETTING PERMISSION.....
[user=302893]@adb[/user]\adb shell "su -c 'chown 0.0 /system/framework/*.jar'"
[user=302893]@adb[/user]\adb shell "su -c 'chmod 0644 /system/framework/*.jar'"
[user=302893]@adb[/user]\adb shell "su -c 'chown 0.0 /system/framework/*.apk'"
[user=302893]@adb[/user]\adb shell "su -c 'chmod 0644 /system/framework/*.apk'"
[user=302893]@adb[/user]\adb shell "su -c 'chown 0.0 /system/app/*.apk'"
[user=302893]@adb[/user]\adb shell "su -c 'chmod 0644 /system/app/*.apk'"
6. We are almost done now. Please consider copying following codes and adding them at the end of your script to remount system as read-only and rebooting the mobile device.
HTML:
ECHO.
ECHO --------------------------------------------------------
ECHO ----------ROM INSTALLED SUCCESSFULLY------------
ECHO --------------------------------------------------------
ECHO.
[user=302893]@adb[/user]\adb shell "su -c 'mount -o ro,remount /system/ /system/'"
ECHO Rebooting System
[user=302893]@adb[/user]\adb reboot
ECHO.
ECHO Please be patient till device reboot!
ECHO.
ECHO.
ECHO --------------------------------------------------------
ECHO -----------------------THANK YOU------------------------
ECHO --------------------------------------------------------
ECHO.
pause
7. Now zip both [Your ROM Name] and [Your ROM Name_PC] folders and upload them to the file sharing sites of your convenience.
If all goes well you will have a superb ROM to share here at XDA. Please find the attached template along with this post.
If you like this tutorial please press thanx at the bottom of the post.
Have a happy time porting.
CREDITS will be highly appreciated.

Categories

Resources