[Galaxy S III Android Development] perseolorenzo:
Rom

Busybox Uninstaller v1.0 - Removes busybox and its +600 symlink files

It will backup all files before they are deleted + activity log written to sdcard

This is for Samsung phones only. Other phones need changes in sdcard mount position

Always do a nandroid backup before flashing anything.

Use at your own risk.

How to use - Flash from recovery method:

Quote:

Download attached zip file from this post

Copy the file you downloaded to external sd card

Boot into stock recovery (volume up+home+power), and select "apply update from external storage". Now select the Busy_Box_Uninstaller_v1.0-signed.zip file downloaded above

If you use CWM Recovery, you can put the zip file in internal or external SD

Busybox will be completely removed with its +600 symlink files

How to use: run script in terminal:

This part does not apply for the beginners. If you don't understand this shell, use the recovery version attached

You can try the below shell script to run from terminal with root rights.

It just misses one line to remove the busybox main package at end of script. The attached zip will delete the package in updater-script rather than in the script. Either remove the busybox package manually when done or add the rm line at the end of script

Actual features:

Quote:

This small script will remove busybox from /system/xbin and from /system/bin.

It will search and remove all symlinks installed in the above 2 folders. Those are over 600 files !

It will make a backup for each file before deleting it. Backups are located on the external sdcard.

If backup file fails (sdcard full), it will abort and last file that failed the backup will not be removed. You can just resume the process later when you fixed the free space issue for backup.

Backup in tar.gz format with path in filename for easier restore if needed.

Will not overwrite any files during backup.

Log file written in sdcard backup directory.

Number of files deleted displayed when done.

To come: Depending on demand and my time, I think at:

Quote:

Search for busybox in all phone and sets path to look for symlinks to delete. However, not sure if it is welcome!

Date/Time stamped backup folder. No need to delete a previous backup to proceed with script.

Code cleaning (was a bit hard as android and busybox shell are very restrictive).

Below is the shell code base used for those who want to know or give ideas to enhance it. Keep in mind it is busybox shell, very limited compared to Bash...

Code included is to run in terminal and will put backup files to internal sdcard (recovery version will put the backup on external sd)

I could include another shell, but would make the zip file bigger in size

Also, did not rely on android built in shell (/bin/sh) to avoid variations depending on shell version with devices / kernels

Code:

#!/bin/sh

bkdir="/sdcard/bb-uninstall" ;

if [ -d "$bkdir" ] ;

then

busybox echo "Backup folder $bkdir already exists. Please remove it to proceed...">>$bkdir/__Error_Backup_Folder_Already_Exists__.txt ;

busybox echo "Backup folder \"$bkdir\" already exists. Please remove it to proceed..." ;

exit 1 ;

else

busybox mkdir $bkdir ;

if [ ! -d "$bkdir" ] ;

then

busybox echo "Backup folder \"$bkdir\" could not be created" ;

busybox echo "Check if sdcard is present, mounted, has free space or you have permissions!!" ;

exit 1 ;

fi ;

fi ;

bbdir="/system/xbin /system/bin" ;

ndeletes=0 ;

for bbpath in $bbdir ;

do

for f in $(busybox find $bbpath -type l) ;

do

gnr=$(busybox readlink $f) ;

if echo "$gnr" |busybox grep -q busybox ;

then

busybox echo -e "$f \t is linked to \t $gnr ---> backup up in sdcard then deleted">>$bkdir/bb-uninstall.log ;

bkfile=`busybox echo "$f" | busybox tr '/' '.'` ;

bkfile=bak$bkfile ;

busybox tar zcf $bkdir/$bkfile.tar.gz -C / ${f:1} ;

if [ ! -f "$bkdir/$bkfile.tar.gz" ] ;

then

busybox echo "Error wh