Scripts for repetitive terminal commands like - reboot recovery

popeye1128

Member
Feb 14, 2011
186
16
Thanks for these Ridgeland. I have gotten around to using any of them but plan on checking them out. Your work is appreciated.
 

Ridgeland

Member
Dec 14, 2010
285
9
Purge BloatWare

Another Linux-PC Bash script using ADB. Be sure to create a new system backup before running this script.
This script will purge a list of 15 apps from /system/app then run sync and reboot. The purge moves the apps to the sdcard in case you find you want one back. Since it's a script you can easily edit the list of apps to your liking with gedit, nano or if you learned vi in 1981 you can still use that. Notice that I have DolphinHD for a browser and RealCalc for a calculator. I don't think livewallpapers are worth the system drain or the annoyances of FCs, I use Wallaby and a photo I took (another post explains trimming a photo to use as a wallpaper).

#! /bin/bash
# Android/PurgeBloat.sh
# written for AndroidTablets.NET
# by member Ridgeland
# April 4, 2011

# source Stock Android 2.1 Apps List | Market 4 Android
# also reviewed http://www.androidtablets.net/forum...562-deleting-preinstalled-apps-bloatware.html

# First fill an array with the apps to be purged
# Season to taste

# declare an array
declare -a App2Purge

# Assign the values to the array
App2Purge[0]="AlarmClock.apk"
App2Purge[1]="Browser.apk"
App2Purge[2]="Calculator.apk"
App2Purge[3]="Email.apk"
App2Purge[4]="HTMLViewer.apk"
App2Purge[5]="LiveWallpapers.apk"
App2Purge[6]="LiveWallpapersPicker.apk"
App2Purge[7]="MagicSmokeWallpapers.apk"
App2Purge[8]="Phone.apk"
App2Purge[9]="PicoTts.apk"
App2Purge[10]="SoundRecorder.apk"
App2Purge[11]="TelephonyProvider.apk"
App2Purge[12]="Term.apk"
App2Purge[13]="TtsService.apk"
App2Purge[14]="VisualizationWallpapers.apk"

# echo the element count
element_count=${#App2Purge
[*]}
echo "Number of elements in App2Purge array: " $element_count

adb shell mkdir /sdcard/Android/
adb shell mkdir /sdcard/Android/StockApps/

# make a loop to copy then remove the apps in the array (just mv just doesn't work)
i="0"
while [ $i -lt $element_count ]
do
echo $i " --- " ${App2Purge[$i]}
adb shell cp /system/app/${App2Purge[$i]} /sdcard/Android/StockApps/${App2Purge[$i]}
adb shell rm /system/app/${App2Purge[$i]}
# step by 1
i=$[$i+1]
done

adb sync
adb reboot
 

Ridgeland

Member
Dec 14, 2010
285
9
Install CyanogenMod Android 2.2

Another Linux-PC Bash script using ADB. Be sure to create a new system backup before running this script.
In this thread point out any typos or script errors.
To discuss CyanogenMod go to thread:
http://www.androidtablets.net/forum...-rom-cyanogenmod-android-2-2-a.html#post77390

EDIT: I had the script here in quotes but when I tested it the links to the downloads failed. The forum abbreviated them with .... Yuck!
So I'm posting the script as a zip file attachment.
 

Attachments

  • $CyanogenInstall.sh.zip
    2.8 KB · Views: 297
Last edited:

Ridgeland

Member
Dec 14, 2010
285
9
I'm still testing CyanogenMod.
Here are two versions of a script to change /system from read-only to read-write

The first is to be loaded on the MID7015 and run using gscript - so you can do this without USB+PC

# Android shell script - gscript
mount -o rw,remount -t yaffs2 /dev/block/mtdblock2
chmod 755 /system

The second is for use from the PC - another Linux Bash script
#! /bin/bash
# Android/RemountSystemCyan.sh
# written for AndroidTablets.NET
# by member Ridgeland
# April 19, 2011

# Remount /system to have read+write - default is read-only
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock2
adb shell chmod 755 /system

Anytime you edit a system file in CyanogenMod you'll need to do this - i.e. lcd_density, heap size ...
 

tipstir

Senior Member
Developer
Aug 4, 2010
1,505
110
You forgot VM38.. Good to see bash or batch files being used again..
 

Ridgeland

Member
Dec 14, 2010
285
9
Purge Bloat in Cyanogen Mod Android 2.2

This is a script I use in a Linux Terminal. You can modify the list of apps before running it.
Before running it I did some simple home screen edits. When you run it it will reboot the tablet, there will also be a lot of FCs (Force Close) about the phone app etc no longer working. Just click them away and it will get the reboot done.
#! /bin/bash
# Android/PurgeBloatCyan.sh
# written for AndroidTablets.NET
# by member Ridgeland
# April 20, 2011

# # # THIS IS ONLY FOR CYANOGENMOD ANDROID 2.2 # # #

# # # Season to taste # # #

# Fill an array with the apps to be purged
# declare an array
declare -a App2Purge
# Assign the values to the array
App2Purge[0]="Bluetooth.apk"
App2Purge[1]="Browser.apk"
App2Purge[2]="Calculator.apk"
App2Purge[3]="Calendar.apk"
App2Purge[4]="CalendarProvider.apk"
App2Purge[5]="Camera.apk"
App2Purge[6]="DeskClock.apk"
App2Purge[7]="Email.apk"
App2Purge[8]="HTMLViewer.apk"
App2Purge[9]="LiveWallpapers.apk"
App2Purge[10]="LiveWallpapersPicker.apk"
App2Purge[11]="Phone.apk"
App2Purge[12]="PicoTts.apk"
App2Purge[13]="RomManager.apk"
App2Purge[14]="SoundRecorder.apk"
App2Purge[15]="TelephonyProvider.apk"
App2Purge[16]="TtsService.apk"
App2Purge[17]="VisualizationWallpapers.apk"
App2Purge[18]="VoiceDialer.apk"
App2Purge[19]="QuickSearchBox.apk"
App2Purge[20]="CMParts.apk"
App2Purge[21]="CMPartsHelper.apk"
App2Purge[22]="CMStats.apk"
App2Purge[23]="CMWallpapers.apk"
App2Purge[24]="Protips.apk"

# echo the element count
element_count=${#App2Purge
[*]}
echo "Number of elements in App2Purge array: " $element_count

adb shell mkdir /sdcard/Android/
adb shell mkdir /sdcard/Android/StockAppsCyan/

# Remount /system to have read+write - default is read-only
adb shell mount -o rw,remount -t yaffs2 /dev/block/mtdblock2
adb shell chmod 755 /system

# make a loop to show the array's values
i="0"
while [ $i -lt $element_count ]
do
echo $i " --- " ${App2Purge[$i]}
adb shell cp /system/app/${App2Purge[$i]} /sdcard/Android/StockAppsCyan/${App2Purge[$i]}
adb shell rm /system/app/${App2Purge[$i]}
# step by 1
i=$[$i+1]
done

echo "Running sync..."
adb shell sync
echo "Running reboot..."
adb shell reboot
 

Ridgeland

Member
Dec 14, 2010
285
9
Kang apps from Android Virtual Device

The only real bash tips here are the creation and use of sdcard.iso to copy to/from an AVD.

I use Ubuntu - Linux
I installed Eclipse SDK with Android SDK and AVD Manager
Learn more from android.com:
Installing the SDK | Android Developers

Create a sdcard.iso as a file on the PC using mksdcard
If you have to find it "which mksdcard" will give you /..path../android-sdk-linux_86/tools/mksdcard

Personal option:
$ mkdir /Data/Android/AVD
$ cd /Data/Android/AVD

Create a sdcard of size 1GB in current directory
$ mksdcard 1024M sdcard.iso
if mksdcard is not in your PATH variable then use the full name found with which

Now launch Eclipse -
menu: Window -> Android SDK and AVD Manager
pop-up window - section "Installed packages" - must show "SDK platform Android 2.2, API 8, revision 2"
if not go to "Available packages" expand "Android Repository" and check the box - [Install Selected]
"Virtual devices" [New]
Name: AVD2.2
Target: Android 2.2-API Level 8
SD Card: File [Browse] - find the sdcard.iso you just made
Skin: WVGA800
[Create AVD]
"Virtual devices" select AVD2.2 and click [Start...]
Launch Options window: [x] Scale display to real size: Screen size (in): 8
[Launch]
When it boots go to LYSESOFT - Solutions for smart devices and download AndExplorer
Use the pull-down status bar to install AndExplorer once the download finishes.
Now copy what you want - for example:
Use AndExplorer to create a directory /sdcard/Downloads
Use AndExplorer to create a directory /sdcard/Downloads/Apps
Use AndExplorer to copy /system/app/Launcher2.apk to /sdcard/Downloads/Apps/Launcher2.apk
Use AndExplorer to copy /data/app/AndExplorer.apk to /sdcard/Downloads/Apps/AndExplorer.apk (I'll use this sdcard for other AVDs)
Now shut down the Android Virtual Device. --- power button seemed to be taking too long so I X'd it.
Close Eclipse

Now create a mount point for the sdcard
$ sudo mkdir /mnt/sdcard
Mount the sdcard
$ sudo mount -o loop /tmp/sdcard.iso /mnt/sdcard

Now you can just use your file browser as root to copy/move to and from the sdcard.
Use /mnt/sdcard/ and NOT /Data/Android/AVD/sdcard.iso
When finished unmount the sdcard

$ df
$ sudo umount /dev/loop0
 
Top