[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:
___
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:
___
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:
___
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!