[SCRIPT] Android-Linux Tools v0.2 for Linux [[Suggestions Needed]] - G1 Android Development

Okay. If this is not where the MODs want this post, please move it.
[UPDATE] - Jump over to Post #12 for some of my recent ideas and changes for this application.
I have been using mods for the G1 and the myTouch 3G for a little while now. I have used Backup for Root, and I use Nandroid. I created just a little simple script to backup your device to your linux-based machine and restore from there too. The concept behind this is having your backup on your computer, not your sd-card. Please, feel free to contribute. (If this is not your cup of tea, please do not leave a comment). I am limited on time, and wanted to contribute a little to the community. All this script is a compilation of adb commands. Anyone could compile these commands, I just wanted it organized and in one place.
README
After using all of the backup tools for root, I have ran into random FCs and bugs. This script uses Android SDK's adb tool and was designed to be simple. This script goes through and backs up your applications, bookmarks, sms, alarm clocks, settings, launcher settings and dictionary. There are plans for this script to be interactive in the future. As for now, it is a very basic script that will backup your device then restore your device.
Notes. As for now this script requires sudo. On every other linux pc tested, sudo was required (maybe because user did not install adb correctly?). This will change in future versions.
= Details =
REQUIREMENTS
1. Android SDK Toolkit 1.5 or higher
2. Bash v4.0.33
3. Root access to your device
4. Root access to your pc
HOWTO
Backing-Up
1. Plug your device in
2. Open command-line (On PC)
3. Run ./abrtool -b
4. Done.
Restoring
1. Reboot from flash of rom (Enter credentials and let phone setup first)
2. Open command-line (on PC)
3. Run ./abrtool -r
4. Restart device
5. Done
Changelog
Version 0.1.5
- Merged into Android-Linux-Tools (alt)
- Changed zenity commands (shows restore progress)
- Option to restart device after restore
- Can install abrtool via command-line (./abrtool --install)
Version 0.1.4
- Added Icons
- Runs Fix Permissions after restoration of applications
Version 0.1.3
- Fixed Restore (Again) - Sets $BACKUPDIR as $PATH
Version 0.1.2
- Restore applications now uses adb install instead of push
Version 0.1.1
- Fixed Restore arugement (-r restores now)
Version 0.1
- Created initial script
- Creates backups for Apps, Sms, Bookmarks, Alarms, Settings, User Dictionary, and Launcher
- Restores device
Download
Project Page for Android-Linux-Tools (ALT) http://code.google.com/p/android-linux-tools
Project Page for abrtool http://code.google.com/p/abrtool
Download abrtool ConvertVideoToAndroid
Download InstallOnAndroid Nautilus Script
InstallOnAndroid
Disclaimer
I am not responsible for anything. Anything at all. I'm just not. Blame someone else if something goes horribly wrong.

[Reserved]
[Reserved for future post]

Nice script but bart.sh can accomplish a full backup of your Android environment for restoration at a later date. While it does it to the SD card initially, these "barts" can easily be copied to any computer. I can, however, see a use for this as it serves a slightly different purpose. Thanks.

I wasn't sure what response I would get to this post. I have had to flash, partition, format, wipe.. enough times that I just wanted to plugin into my computer, backup, wipe-flash then restore. Thanks!

nice. I don't use linux myself, but i see the point of having the backup else where (not an SD card attached to the phone itself).
will this, in theory be made to work on windows? Cause that will be awesome.

@str4vag It would be really simple to just use a .bat file for Windows. I don't have any plans on making a windows script anytime soon. Sorry. Same commands especially though.

This is exactly what I've been looking for, now I just need to mod it to sync apps/bookmarks/etc automatically whenever I plug in my phone, and to only sync the new items to keep it speedy, great work dev!

@ggolemg I can play around with some "real" features soon. I plan on having it archive your backups and allow you to select which backup (default is most recent) you would like to use. I am sure I can play around with your idea too. Thanks.

subscribing to the thread, idea is very interesting. i've been looking for a foolproof way to backup and restore bookmarks, sms messages, and different alarms, without all the issues of backup for root users. gonna check out the script tonight.

Update coming by the end of the week.
- Will only backup apps not already backed up.
- Possibly apply the Python interface I have developed.
- More goodies.

How about switchrom?

Android-Linux-Tools
Okay, so this week has been crazy for me. (Mind you I am a restaurant manager first and a developer (primary web) second). I think I am going to gear this project in a different direction. First off, I have created GTK2 Dialogs and a settings panel for this application. I would like to gear towards general linux tools on the pc side. So over the next two weeks you can expect,
- Graphical Interface for abrtool (Android-Backup-Restore)
- Configuration for each application.
- Nautilus Scripts for all applications.
- Right-Click to Encode Video (With GTK2 Dialog progress)
- Right-Click to Install APK (With GTK2 Dialog progress)
- Right-Click to Sign APK (With GTK2 Dialog progress)
- Right-Click to Copy Files to SD Card
- abrtool will backup to Ubuntu One Cloud (Simple adb pull ~/Ubuntu\ One/? or maybe play with the API?)
Ideas and Possibilities
- User.conf editor
- Select with applications to backup
- Switchrom features?
Any other thoughts or suggestions are welcome. I want to start simple, keep working on the abrtool and then make my way out to some other useful tools for us linux (Ubuntu) users. Let me know what you think and what would be helpful.

i had to make a bynch of edits so this dosent run as root, id recomend everyone do the same, only run root when you must. Also changed ,.adb to adb so i dont have to run it in my android sdk dir

@ahronzombi Can you post those changes?

I am a firm believer of only running root when needed, Like I mentioned before I don't really have a huge amount of time, and when I tested this on a friends notebook adb required root to atleast kill-server then you could perform shell/push/pull.

AFAIK, adb server only requires root if ou haven't set the proper udev rules for the device.

Exactly. If we want this script to run universally we cannot rely on all users to have added the udev rules. If they don't they have to run sudo. Maybe a quick check for the udev file then sudo if not?

boulderjams said:
Exactly. If we want this script to run universally we cannot rely on all users to have added the udev rules. If they don't they have to run sudo. Maybe a quick check for the udev file then sudo if not?
Click to expand...
Click to collapse
no i think it would be wise to have people understand there udev permissions rather than run root so its universal. that kind of thinking leads to very big security problems. with root in the script most of the simplest linux users could exploit anyone

I fully understand that. Do you mind posting your changes to the script?

this is the secure version of the script that dosent run as root
keep in mind i set my own adb and home directorys so you'll have to change those
Code:
#! /bin/bash
# abrtool version 0.1
# Last Updated Wednesday, November 18, 2009
# Android Backup Data and Restore Data Script
#TODO
# 1- See if config file exists
# 2- If not, create config file (for now, select directory to backup to)
# 3- See if arguments are specified
# 4- If not, return an error via dialog
# 5- If argument -b exists, run backup
# 6- If argument -r exsists, run restore
export PATH=${PATH}:/home/ahron/android/android-sdk-linux/tools:/home/ahron/android/abr
BACKUPDIR=/home/ahron/android/backups
USER=${username-`whoami`}
backupscript() {
export PATH=$PATH:$BACKUPDIR
adb kill-server
adb pull /system/sd/app $BACKUPDIR/apps
adb pull /system/app $BACKUPDIR/apps/device
echo "---------- Backed Applications"
adb pull /data/data/com.android.providers.telephony/databases/mmssms.db $BACKUPDIR/msgs/mmssms.db
echo "---------- Backed Text Messages"
adb pull /data/data/com.android.browser/databases/browser.db $BACKUPDIR/bookmarks/browser.db
echo "---------- Backed Bookmarks"
adb pull /data/data/com.android.alarmclock/databases/alarms.db $BACKUPDIR/other/alarms.db
adb pull /data/data/com.google.android.providers.settings/databases/googlesettings.db $BACKUPDIR/other/googlesettings.db
adb pull /data/data/com.android.launcher/databases/launcher.db $BACKUPDIR/other/launcher.db
adb pull /data/data/com.android.providers.userdictionary/databases/user_dict.db $BACKUPDIR/other/user_dict.db
echo "---------- Backed Other Settings"
chown -R $USER $BACKUPDIR
zenity --info --text "Successfully Backed-up to $BACKUPDIR"
}
restorescript() {
export PATH=$PATH:$BACKUPDIR
adb kill-server
#sudo adb push $BACKUPDIR/apps /system/sd/app
echo "----------- Installing Applications"
cd $BACKUPDIR/apps
for searchfile in ./*.apk
do
echo "------------ Processing $searchfile"
sudo adb install "$searchfile"
done
echo "---------- Restored Applications"
adb shell su
adb shell fix_permissions
echo "---------- Fixed Application Permissions"
adb push $BACKUPDIR/msgs/mmssms.db /data/data/com.android.providers.telephony/databases/mmssms.db
echo "---------- Restored Messages"
adb push $BACKUPDIR/bookmarks/browser.db /data/data/com.android.browser/databases/browser.db
echo "---------- Restored Bookmarks"
echo "---------- (Please, make sure to restart your browser)"
adb push $BACKUPDIR/other/alarms.db /data/data/com.android.alarmclock/databases/alarms.db
adb push $BACKUPDIR/other/googlesettings.db /data/data/com.google.android.providers.settings/databases/googlesettings.db
adb push $BACKUPDIR/other/launcher.db adb pull /data/data/com.android.launcher/databases/launcher.db
adb push $BACKUPDIR/other/user_dict.db /data/data/com.android.providers.userdictionary/databases/user_dict.db
echo "---------- Restored Other Settings"
zenity --info --text "Successfully Restored Android device from $BACKUPDIR"
}
if [ "$#" -eq 0 ]
then
echo "Usage $0"
echo " -b Backup"
echo " -r Restore"
exit $E_OPTERR
fi
set -- `getopt "br:" "[email protected]"`
while [ ! -z "$1" ]
do
case "$1" in
-b) backupscript;;
-r) restorescript;;
esac
shift
done

Related

CASUAL language

Cross-platform ADB Scripting, Unified Android Loader
The goals of this project are:
provide a framework that will run on Linux, Windows and Mac
support all Android devices
provide a Graphical User Interface
automate installation and use of ADB
be easy to use and easy to create a new CASUAL app
be totally customizable, including button text and donation links.
This can be used for deploying custom kernels, rooting, installing custom apps, or just about anything you can think of.
I'm working on the ScriptParser.commandHandler() class.
A CASUAL script will consist of a My Script.txt, My Script.zip and a My Script.scr. "My Script" may be replaced with any word or words and is the title of the option in the drop-down list. There may be an unlimited number of scripts in a CASUAL app.
My Script.txt is displayed when the script is selected from the GUI
My Script.zip contains any binary resources like zergRush, or apks to be installed
My Script.scr is the actual scripting operations.
Currently the tennative commands are:
$ECHO- reports information to the command line
$USERNOTIFICATION- stops all processing and waits for the user to perform an action- usage: $USERNOTIFICATION Title, Text
$USERCANCELOPTION - provides the user the option to stop - usage: $USERCANCELOPTION Title, Text
$ZIPFILE- references a file contained within the script set - usage: $ZIPFILEmyfile.ext
$SLASH- file separator - usage $ZIPFILEmyFolder$SLASHmyFile
#- comment- usage: #This is a commented line
ADB Commands are not prefixed- usage: command params.. eg. push $ZIPFILEzergRush /sdcard
here is an example:
Code:
devices
$ECHO I'm testing the echo command
This folder, $ZIPFILE is my temp folder
#This is a commented line
$USERNOTIFICATION Notification Title testing, This is a Notification with a filename $ZIPFILE
$USERCANCELOPTION This is the option to cancel, Do you want to continue?
$ECHO here is a line of slashes using the $ SLASH command $SLASH$SLASH$SLASH$SLASH$SLASH$SLASH
push $ZIPFILEzergRush /sdcard/zergRush
shell "if ((ls /d 2>&1 > /dev/null)); then echo 'found data folder in /d/ pushing out updates. '; mkdir /d/temp; cat /sdcard/zergRush /d/temp/zergRush; chmod 777 /dtemp/zergRush; /d/temp/zergRush; else echo 'Trying the next option';fi"
This automation tool can greatly reduce operator error. The instructions for all casual scripts will be 1. install java, 2. execute the app. The user will see whatever the developer wants them to see as the interface is totally customizable.
The goal of this thread to receive feedback and make improvements to the CASUAL language before release. The biggest thing is in the pole at the top, but I'd like feedback about the command list

Android Terminal Commands

Here are a few commands for Android in terminal. If you have any commands that you think should be here, just reply. Enjoy!
chmod - give/take rights away from files. The numbers you see in the how-to's is a little complicated. It has to do with the rights you are assigning the file or folder. http://wiki.linuxquestions.org/wiki/Chmod for further reading.
cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.
cd - change from one directory to another
cp - Copy a file from one location to another
dd - copies exact locations to other locations. Can be an entire drive, a folder, etc.
dd if= of=. uses an input file and an output file.
exit - exits the shell you are in. When you type su you start up a shell.
ls - lists all files with in a directory try ls - l too.
mv - Move a file from one location to another. At the same time you can rename a file.
su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.
tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar /? for details.
rm - followed by a file name with delete the file sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written
Other commands of interest:
df - how much free disk space. In linux you can add a switch "df -h" but the "-h" does nothing for me on Android. top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app. uptime - displays how long it has been since you last rebooted the system.
busybox - a tool that combines many linux commands into a single compact file. Typing this displays all the commands at your disposal.
busybox df - a much easier to read display of free diskspace. This display shows how full (use%) each file system is.
Thanks
thank you so much, well for a noob like me very informative was looking for this kind from very long :laugh:
Substitute user XD you know it is superuser right?
free - see all free Memory from the Device
mid-kid said:
Substitute user XD you know it is superuser right?
Click to expand...
Click to collapse
Actually substitute user is also correct.
"The su command, also referred to as substitute user, super user, or switch user, allows a computer operator to change the current user account associated with the running virtual console."
Source: http://en.wikipedia.org/wiki/Su_(Unix)
Sent from my Galaxy Nexus using xda premium
So practically the basic linux comands are the same with android terminal!!!
I just noticed that the ping command is working just fine
Type ping 4.2.2.4 for example
rezo609 said:
If you have any commands that you think should be here, just reply. Enjoy!
Click to expand...
Click to collapse
svc data enable - turn on mobile data
svc data disable - turn off mobile data
svc wifi enable - turn on wifi
svc wifi disable - turn off wifi
svc help - show information about subcommands
For the top command mentioned in the OP, just type "top -n 1" and it will exit, leaving you with the readout at the time you executed the command. -n is for number of updates before stopping.
Also will add that the powertop command will show the top reasons for wakeups from idle.
Tnx
Metalcorpe said:
So practically the basic linux comands are the same with android terminal!!!
Click to expand...
Click to collapse
Yep
rezo609 said:
If you have any commands that you think should be here, just reply.
Click to expand...
Click to collapse
grep - Useful to apply filters to other commands. For example, to list only the apk files inside a folder:
Code:
ls /folder/to/list | grep apk
or to search a string inside a file:
Code:
cat /file | grep stringToSearch
logcat - Debugging tool, all the system messages are shown here. To show only the debug messages (useful when an app is giving FC without apparent reason), type:
Code:
su
logcat -d
mount - The most common use for this command is remount the system partition, to modify its content (be careful, you can easily brick your device!). Common usage (needs root):
Code:
Mount /system in Read/Write mode:
mount -o rw,remount /system
Mount /system in Read Only mode:
mount -o ro,remount /system
Saving command output to file. Type
Code:
command >> /folder/to/save/file
If the file doesn't exist will be created, otherwise, the info will be added to the end of the file.
You can also use:
Code:
command > /folder/to/save/file
If the file doesn't exist also will be created, but if the file exists its content will be deleted before add the info.
mount - Mounting a partition
umount - Unmounting a mounted partition
reboot - Reboot phone
stop - Shutdowns the GUI
start - Restarts GUI
above two commands can be used to get a fast reboot.
Also you my use the reboot command to do a faster restart to the device but your are going to lose any unsaved work
You must be rooted
First type : su
Then : reboot
Sent from my GT-I9505 using XDA Premium 4 mobile app
run program with command
I want to run "Applock"s lock all command. I have widgetsoid which can create shortcut for any command. How to do it? I am rooted.
SAVED ME!
toasterwater said:
svc data enable - turn on mobile data
svc data disable - turn off mobile data
svc wifi enable - turn on wifi
svc wifi disable - turn off wifi
svc help - show information about subcommands
Click to expand...
Click to collapse
Dude, thank you so much for posting this information. I had switched my MNVO service to a newer a phone, and this one was just sitting around. There were still things on it that I needed like some notes that I had saved. Because I had not used it in a while, and there was no data/cell service on it, I was out of luck (or so I thought) when I forgot my unlock pin. It wouldn't accept my google login information because there was no data connection. I COULD NOT GET INTO MY PHONE! I was dreading the possibility of having to factory reset, which would erase my notes and other things saved on there. On a whim and after MUCH Google searching, I was trying to find a way to reset the number of attempted pin locks to no avail. I was about to give up, but luckily, I remembered I had rooted it. And after downloading the latest SDK bundle, I came across your post. It allowed me to turn the wifi on my cell phone even though I was "locked out." Wouldn't you know that it very quickly picked up my home wifi signal. Because a data connection was enabled, I was then able to use my gmail login information to get into the phone. Your post saved me and prevented me from having to factory reset my phone and losing my information. Thank you so much!
netstat - show connections status in local device
...
rezo609 said:
Here are a few commands for Android in terminal. If you have any commands that you think should be here, just reply. Enjoy!
chmod - give/take rights away from files. The numbers you see in the how-to's is a little complicated. It has to do with the rights you are assigning the file or folder. http://wiki.linuxquestions.org/wiki/Chmod for further reading.
cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.
cd - change from one directory to another
cp - Copy a file from one location to another
dd - copies exact locations to other locations. Can be an entire drive, a folder, etc.
dd if= of=. uses an input file and an output file.
exit - exits the shell you are in. When you type su you start up a shell.
ls - lists all files with in a directory try ls - l too.
mv - Move a file from one location to another. At the same time you can rename a file.
su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.
tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar /? for details.
rm - followed by a file name with delete the file sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written
Other commands of interest:
df - how much free disk space. In linux you can add a switch "df -h" but the "-h" does nothing for me on Android. top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app. uptime - displays how long it has been since you last rebooted the system.
busybox - a tool that combines many linux commands into a single compact file. Typing this displays all the commands at your disposal.
busybox df - a much easier to read display of free diskspace. This display shows how full (use%) each file system is.
Click to expand...
Click to collapse
if i wanted to delete a directory with data ? what would be the syntax
Set/View Network Host Name
Run the following as root
setprop net.hostname <new_hostname> // To Change Device Hostname
getprop net.hostname // To View Device Hostname
list of all android terminal commands
Open terminal or file explorer with root access
From root folder go to /system/bin
Type command :ls
The list contains all the terminal codes available
Enjoy!!
Disclaimer1: I'm not responsible if anything goes wrong while you try out the codes.
Disclaimer:man & help pages are not available on android terminal

superuser command list

hi i want to make a superuser command list
anyone how know commands can post it here.
chmod - give especific permissions to an specific file
cat - look at, modify, or combine a file. You can also copy files with this command by "reading" it to another file instead of to the screen.
cd - change from one directory to another
cp - Copy a file from one location to another
dd - copies exact locations to other locations. Can be an entire drive, a folder, etc. dd if= of=. uses an input file and an output file.
df - how much free disk space.
du - show disk usage of files. Add "-h" to get human readable. Especially useful when you add "-d1" to limit the directory depth to 1. If you run "du -h -d1", it will tell you how much space each directory occupies, including their contents summed.
exit - exits the shell you are in.
grep - search within a file for a text string. Also useful for parsing command output. 'ls | grep something' is a quick way to list files that contain the string "something" (although "ls *something*" would do it, too, but grep can do a lot more)
ifconfig- get network interface configuration. Good for getting your own IP address.
kill - kill a process by PID
ls - lists all files in a directory .
mv - Move a file from one location to another.
ping - see if an internet host is alive
pm - android package manager. LOTS of useful things in here, type pm by itself for the help screen
ps - list processes. Useful to see what is running
reboot - reboots your device
reboot recovery - reboots you into recovery
reboot-bootloader -reboots the device in bootloader- fastboot
rm - remove a specified file
rmdir - remove a directory. rm can't do it unless you remove recursively with -R
su - Substitute User. We type this to switch to the root user. You need to type this command first to do a lot of the other commands.
sync - synchronizes any data on disk with data in memory. We type this before rebooting to ensure we've got all data written
tar - creates taped archives. Compresses files like winzip, 7zip, winrar and others tar
top - like task manager, it displays running processes. in Linux the q key quits. On Android I don't know how to make it quit other than closing the app.
uptime - displays how long it has been since you last rebooted the system. Interestingly enough the "Menu Key > System > About Phone > Status > Up time" on my phone does not match "uptime" typed in the terminal emulator.
Download a root explorer app. Go to system/bin (or xbin). You will see many files, but actually every file is a command for the kernel and (theoretically) all of them can be used in the terminal. Not all of them are stand-alone functions and must be used along with other commands. Just type the title of a file in terminal and see what happens. You might find some other functions that are not already in your list .
Sent from my GT-I9001 using xda app-developers app
I use this as a cheatsheet as I normally deal with rooted devices with busybox installed anyway. Most "commands" found in /system/bin are symlinks to busybox. Sometimes a device has a non-standard busybox version with not all applets available. The reason why Titanium backup ships their own version of busybox with the app.

[How To][Linux] Optware + ssh + samba + transmission + flexget

Yep, you read that correctly. I have optware, ssh, samba, transmission, and flexget working on my Minix X5 Mini. This should work for any rooted device which has an adb connection enabled. This will work on the original ROM. In fact, I use the stock ROM. For those not using a Minix device this should work on any ARM device. Sorry but all the binaries are built on ARM.
JUST AS EVERY OTHER DEVELOPER: I AM NOT RESPONSIBLE IF YOU BRICK YOUR DEVICE! MAKE A BACKUP!
Requirements:
Linux box with adb (don't ask me about windows, I don't support bad habits)
clockworkmod (for a backup)
root
internet connection
Process:
Make a backup of your ROM!
Download files (gitHub)
You have two options here:
Download the zip via https://github.com/erichlf/AndroidSeedBox/archive/master.zip and unzip it.
Clone the repo using git via 'git clone [email protected]:erichlf/AndroidSeedBox.git'
Make script executable
chmod +x optware-etc.sh
Obtain adb connection to device (covered in another thread)
Gain root access on local machine (adb seemed to require this for things to work)
sudo su
Run script and follow directions
./optware-etc.sh
Use SManager to run /opt/home/root/sysinit at every restart.
Notes:
The script can be modified to change the various programs that I install. You could exchange transmission for deluge for example.
Transmission can be accessed from the minix through localhost:9091 or from some other machine using your ip-address and the port 9091. If that doesn't work you should edit the config file located at /opt/home/root/.config/transmission-daemon/settings.json
username: root
password: you provided this in the install script
Without SManager nothing will start automatically. However, if you have a ROM which has init.d support you can move the scripts in /opt/etc/init.d to /etc/init.d I would suggest maybe linking the two instead of just moving the scripts or possibly adding a script to /etc/init.d which runs the items in /opt/etc/init.d The reason is because when installing things using ipkg the startup scripts will be placed in /opt/etc/init.d and not /etc/init.d However, it is extremely important that optware is started, and this is partly what sysinit accomplishes.
To list available packages
ipkg list
To install a new package use the command
ipkg install <new package>
To remove a package use the command
ipkg remove <package to remove>
cron is weird and I couldn't get it to work like it should, but I got it to work
While on the Android device (ssh or terminal emulator)
Create a .crond file in the home directory of your device (/opt/home/root/) with some schedule in it. Remember to leave a blank line at the end of the file.
Tell cron about the .crond file
crontab -u root /opt/home/root/.crond
Make sure cron sees the cron file
crontab -l
If you want to edit your cronfile use a text editor and edit the file directly and then tell cron about the file again.
Many things are installed in what seem like strange places, so use
which <binary you are looking for>
Feel free to help develop the code. I think what would be best is an update.zip or a CWM flashable zip. Right now I don't know how to do this, but once I get more time I will look into it. So, any help on this front is welcomed.
Enjoy!
I really wish you would have kept the repo up. It seems kind of pointless to go through all that trouble just to delete the repo and leave people wondering what you did.
I have been busy and didn't update this particular post, since there had been no activity on it.
git clone [email protected]:erichlf/androidseedbox.git
https://bitbucket.org/erichlf/androidseedbox/get/master.zip
Sorry, I didn't need to be rude. I was just excited to find this and then sad when it was gone. Thanks for pointing me in the right direction!

[TOOL][LOG] Easy-to-share log and report for developers and users

Hello XDA comunity!
I want to share you a very useful tool that I have created, its name is: "kielyd".
What's keilyd?
Keilyd is a BASH daemon that constantly dumps the system's logs, warnings and other useful info in a easy-to-share "ZIP" with the main purpose to create a very informative and useful bug report.
keilyd is expansible and configurable. It's very easy to add new features because BASH interacts directly with the Linux/BSD commands in the Android System.
How does it works?
Keilyd is launched at device boot, with the "init.d support" and as root (see requeriments below). After launched, keilyd relaunches itself in a "daemon mode", that runs in the background, then, it dumps several information in the /sdcard and compress it in a single zip, so, the user can send that zip (in fact, are 2 zip's or more if you use the "snapshot" feature) to the developer of their ROM, to a forum or send it to a 3rd party developer and report a bug with all the system logs included.
Keilyd stores 2 zips: the first one is the current log (the "very last file") and the second one is the last log before keilyd were launched again.
If you won't enable de daemon, you can create a single zip when you use the "snapshot" feature, if you take two or more snapshots in the same minute, the ZIP will be the same, otherwise, one script per different minute will be created. The Snapshot feature can create as much zips as needed.
What info is collected?
That's a good question!
The info that is collected is (this applies ONLY for a vanilla copy of keilyd):
Kernel log (aka "dmesg") and other kernel info
Logcat (aka "logcat")
List of process running and memory statics
A copy of all tweaks in init.d (including keilyd itself)
A copy of build.prop and sysctl.conf
A copy of /proc/config.gz (if exists)
Some cpuinfo
Mounted filesystems and usage
How does this "daemon" can help me?
Developer:
Have you had the need to get some system log from a user?
Probably the answer is "yes", but, the user may have no idea how to do that, so, you have to give them a "step-by-step" guide of "how to get a system log in the terminal".
This simplifies the process, so, the user can report a bug with logs with no terminal (if the daemon is enabled) or with a single command that looks like
Code:
keilyd --snap
User:
Well, the complement of the developer... You can share "golden" information just by sending 2 zips files to the dev. Minimal Android knowledge is the only prerequisite if the daemon is working as spected.
This daemon is not a demon, but it can be very bad if not implemented as spected. Please, ensure that ALL THE COMMANDS ARE KNOWN and that THERE IS NO PORPRIETARY interference.
Why BASH?
A good idea is to create a daemon in C/C++ and share it as a "binary", BUT, as we are recolecting information from the device, the user must have to be concient of what are the script recollecting, if the user can't read bash, it can ask to a 3rd developer. You can feel safer because it's under the GPLv3 licence!
In addition, BASH run in (almost) any UNIX based OS, including but not limited to Apple OS X, GNU/Linux, Android, iPhone OS, etc...
This prevent a "blind trust" from the user, and give them facility of enable-disable the script, add features and so on.
Requeriments
- A rooted device
- Busybox (or run-parts)
- init.d support
- BASH 4.3.x ONLY SUPPORTED by the moment.
- Terminal emulator/HIDE]
How can I include it in my ROM?
Take a look of my repo in GitHub, it contains the last version of keilyd and the implementation during compilation in the Makefile.
If you are a ROM modder, download the latest version from above, include init.d and bash support in you ROM.
Or you can create a CWM/TWRP/Philz... flashable zip (it would be great!)
Users: how to use
When something goes weird, open the terminal emulator and write:
Code:
keilyd --snap
and send to the developer all zips in
Code:
/sdcard/keilyd/out
type
Code:
keilyd --help
and a helpful message will be printed.
If something goes wrong and you need to reboot the device (or the device reboots itself), just send both zips to the developer or the forum where you are asking help (This feature only works if the daemon is enabled).
Developers: how to use
You can add/remove things in order to fit your needs, the only thing that we ask you is that you write the whole script in BASH, without "blobs" that may private the user from know what is exacly logged and stored.
If some user sends you the zip, you will notice that the files are plain-text, and you can view it in any text editor.
TODO:
List all apps installed (system and user)
Secure "user-modificable" settings (Allmost DONE)
A graphical interface (an app) to manage the daemon
A flashable ZIP
Aports and sugestions are WELLCOME, please, coment in the box below
Install redistributable package:
If the avobe requeriments are meet...
1. Open this GItHub URL
Click in the "Download ZIP" icon in the right.
2. Put the zip in your phone
3. Unzip it.
4. If you want to use the script... A; otherwise, B.
A.
a. Open the terminal emulator.
b. cd to the folder that contains
Code:
install.sh
c. As root, type "
Code:
sh install.sh
" in the terminal.
B.
a. Open ES File Explorer
b. Enable root explorer and mount /system as rw
c. Copy
Code:
daemon/18keily
to
Code:
/etc/init.d
d. Tap and hold the
Code:
18keily
file and open the poperties
e. Change te permisions to
Code:
rwx r-x r-x
f. Copy the
Code:
redistrib/bash
file to
Code:
/system/xbin/bash
g. Change the permisions as above.
h. Symlink /etc/init.d/18keily to /system/xbin/keilyd
i. Reboot
NOTE:
Keilyd can be used in 2 ways:
1. As a daemon that does it job without human interaction, that constatantely and automaticaly creates 2 zips in the output directory.
2. As a Script that only needs to be called with the '--snap' parameter, but it requieres human interaction and does not constantely repeat the process.
Use the first one if you are a beta tester, or if you know that you ROM can hang sudently. Recomended for Unstable ROM'S.
Use the Last One if your ROM is stable or official, but you want to do a bug report.
You can allways use the second option if you use the first one.
By default, the daemon is disabled. You can enable if you change the "ENABLED" variable to "Y". I personally recommend values for "MINS" between 5 and 15.
BUGS REPORTS in the GITHUB REPOSITORY
Reserved
Hi there,
This looks like what I need, did you close the repo? Can you share a link to the script? I have a few devices, and I want to have some forensic information for troubleshooting (I.E. log all the warnings, errors and critical logs, + a snapshot every n minutes about the system usage). Right now I have to go where the device is, connect it with ADB and query the logs (most of the time, the logs were overwrited)... Thanks in advance.

Categories

Resources