Introducing XDA:DevCon – A Conference For Developers By Developers
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
fd1999 Old
(Last edited by fd1999; 17th August 2012 at 08:58 PM.)
#1  
Guest
Thanks Meter
Posts: n/a
Default [UPDATE][SCRIPT][OTA-UPDATE][06/08/12][NOREFLASH] OTA-Updater

So, as the name says, OTA-Updater (Script) for LG Optimus One (no, every device )
You can also use it on Linux, e.g. Ubuntu, Debian and Mint!


You need:
- A server:
I'm using Square7
- A rooted phone
- Busybox
- Terminal Emulator

This Script will not search for updates in background, you need to start the script (via Terminal Emulator) to check for updates
I'm not responsible for any damage to your phone.

PLEASE READ EVERYTHING CAREFULLY BEFORE POSTING SOMETHING LIKE
'This doesn't work!' or 'That's spamming!!!'

Guys, there is a REPORT-button, use it instead spamming the thread!!!


1. First, create your own server, I'm using Square7 or you can also use Funpic;
I recommend that you use Square7

2. Install Busybox from Play Store (Busybox Installer), if not installed. It's pre-installed on almost every ROM

3. Create a file called "version.xml"(what file (e.g. xml,txt) doesn't matter) on your server, and type in it the latest available version.
YOU NEED TO EDIT THE FILE EVERYTIME YOU UPDATED THE ROM

4. Now, create a file called "update.xml" on your phone, located in /system/ (Don't forget to mount system) and type in it the running version on the phone



So, now the script

The script should start with this:

Code:
#!/system/bin/sh
___

Check if user is running as root;
If no, then message "You are not running this scripts as root."; Abort:

Code:
id=`id`; id=`echo ${id#*=}`; id=`echo ${id%%\(*}`; id=`echo ${id%%gid*}`
if test "$id" != "0" && test "$id" != "root"; then
echo " You are not running this script as root."
 exit 0
fi
___

Mount system read-write:

Code:
busybox mount -o remount,rw /system
___

Now, the script should search for updates; first download a file (I'm using .XML file; doesn't matter what file):

Code:
wget -q http://your-server.server.com/version.xml -P /sdcard/Folder/
___

Compare downloaded file with "update.xml" on /system/:
If files are the same (No update), Message: "No update available."; Abort
Else (Update available), Message: "Update available"


Code:
if diff /sdcard/Folder/version.xml /system/update.xml
then
echo "No update available"
echo "Aborted"
exit 0
else
echo "Update available!"
fi
___

Clean up folder:

Code:
rm /sdcard/Folder/*
___

Update available, download "update.zip" (Read everything carefully, if you read everything carefully, you'll know what the file should contain...):

Code:
wget -q http://your-server.server.com/update.zip -P /sdcard/Folder/
___

Unzip "update.zip":

Code:
unzip -q /sdcard/Folder/update.zip -d /sdcard/Folder/
___

Set permissions:

Code:
chmod 0777 /sdcard/Folder/updater.sh
___

Update ROM:


Code:
sh /sdcard/Folder/updater.sh
First phase done, save the file as "update" (Not .TXT or XML, nothing) and copy the file to /system/bin/ and set permissions

___________

Update.zip


So, now the update.zip:
This file contains system-files, the new update.xml and the updater-script (.sh, not the updater-script in flashable packages!!!)

So, first, you need to SAVE the files to the update.zip, I mean do not compress or something else, only SAVE, else "Unzip" wont work

SAVE all changed files to update.zip

Upload the update.zip to your server. You need to edit the update.zip everytime, when you updated the ROM

Now, the updater.sh:

It should start with this:


Code:
#!/system/bin/sh
___

Now, the changed files should be copied to them right location:
I've only changed the build.prop, it's a example, you can change everything you want:

Code:
cp -f /sdcard/Folder/build.prop /system/
___

COPY THE NEW update.xml TO SYSTEM :

Code:
cp /sdcard/Folder/update.xml /system/
___

Reboot:

Code:
reboot
___

And done!
If you want to update:
1. Start Terminal Emulator
2. Type su and press ENTER
3. Type update and press ENTER
4. Updating...


Customize it, and add more functions, but I'll update this script anyway.



___

My "Update" in /system/bin/ looks like this:

Code:
#!/system/bin/sh
id=`id`; id=`echo ${id#*=}`; id=`echo ${id%%\(*}`; id=`echo ${id%%gid*}`
if test "$id" != "0" && test "$id" != "root"; then
echo " You are not running this script as root."
 exit 0
fi 
busybox mount -o remount,rw /system
wget -q http://cloudos.square7.ch/Update/One/version.xml -P /sdcard/CloudOS/update/
if diff /sdcard/CloudOS/update/version.xml /system/update.xml
then
echo "No update available"
echo "Aborted"
exit 0
else
echo "Update available!"
fi
rm /sdcard/CloudOS/update/*
wget -q http://cloudos.square7.ch/Update/One/update.zip -P /sdcard/CloudOS/update/
unzip /sdcard/CloudOS/update/update.zip /sdcard/CloudOS/update/
chmod 0777 /sdcard/CloudOS/update/updater.sh
sh /sdcard/CloudOS/update/updater.sh
And my updater.sh:

Code:
#!/system/bin/sh
cp -f /sdcard/CloudOS/update/build.prop /system/
cp -f /sdcard/CloudOS/update/update.xml /system/
reboot

If you want to use my work, then your work must be open-source, too!
The Following 15 Users Say Thank You to For This Useful Post: [ Click to Expand ]
fd1999 Old
(Last edited by fd1999; 6th August 2012 at 11:28 AM.)
#2  
Guest
Thanks Meter
Posts: n/a
CHANGELOG:

06/08/12:
- Added "Check root before updating"-feature

04/08/12:
- Initial release

Plans:
- Better thread-design
- Improved script
The Following 3 Users Say Thank You to For This Useful Post: [ Click to Expand ]
 
LynXT
Old
#3  
LynXT's Avatar
Senior Member
Thanks Meter 512
Posts: 480
Join Date: Jan 2012
Location: Cañete

 
DONATE TO ME
Smart kid, LOL XD
The Following User Says Thank You to LynXT For This Useful Post: [ Click to Expand ]
 
Koragg618
Old
#4  
Koragg618's Avatar
Senior Member
Thanks Meter 384
Posts: 709
Join Date: Aug 2011
Location: Mississauga, ON
Nice work kid, this is actually cool!
Soon we shall have ROMs 10mb-30mb
Join SugarSync with this link and get 5GB + 500 MB extra!

If I thank you, I probably am thanking you, or I'm just saying yes to your post while saving a post
The Following User Says Thank You to Koragg618 For This Useful Post: [ Click to Expand ]
 
thachtunganh
Old
#5  
thachtunganh's Avatar
Senior Member
Thanks Meter 1911
Posts: 1,656
Join Date: Mar 2011
Location: Hà Nội - Hanoi
This is what i want to tell you: made a useful thing for the community.

Great Job!
HTC Desire HD
  • The one who brought sweep2wake feature for Atmel touch panel driver to HTC Desire HD .
    First for Android with Sense 4.1, then for AOSP based ROM.
Advice: Only Use Original Software
Nevermind, install CyanogenMod ROM, doesn't matter it's unofficial or official version, believe me, it's still the best!
The Following User Says Thank You to thachtunganh For This Useful Post: [ Click to Expand ]
fd1999 Old
#6  
Guest
Thanks Meter
Posts: n/a
Quote:
Originally Posted by thachtunganh View Post
This is what i want to tell you: made a useful thing for the community.

Great Job!
And I did it
fd1999 Old
#7  
Guest
Thanks Meter
Posts: n/a
Will upload next update tomorrow, changelog:

- Check root before updating
- Will upload completed files
- Better thread-design



Gesendet von meinem LG-P500 mit Tapatalk 2
 
LynXT
Old
#8  
LynXT's Avatar
Senior Member
Thanks Meter 512
Posts: 480
Join Date: Jan 2012
Location: Cañete

 
DONATE TO ME
Tach is right you have contributed much to this subforum


Sorry for my english :P
fd1999 Old
#9  
Guest
Thanks Meter
Posts: n/a
Quote:
Originally Posted by JeduRocks View Post
Tach is right you have contributed much to this subforum


Sorry for my english :P
He said great job, I don't understand what you mean...
 
LynXT
Old
#10  
LynXT's Avatar
Senior Member
Thanks Meter 512
Posts: 480
Join Date: Jan 2012
Location: Cañete

 
DONATE TO ME
Quote:
Originally Posted by fd1999 View Post
He said great job, I don't understand what you mean...
Use Google translate xd

Enviado desde mi LG-P500 usando Tapatalk 2

 
Post Reply+
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Go to top of page...