Script to remove stock apk's after flash


Last Updated:

  1. LexusBrian400

    LexusBrian400 Well-Known Member This Topic's Starter

    Joined:
    Mar 3, 2010
    Messages:
    699
    Likes Received:
    154
    How hard would it be to set up a script to remove the same stock apps every time i reflash? Can anyone point me in the right direction please?
     

    Advertisement
  2. droidkevlar

    droidkevlar Well-Known Member

    Joined:
    Jan 28, 2010
    Messages:
    815
    Likes Received:
    111
    I also be interested in this. I made one for the bootanimation since that was just basic but when i tried to get it into su commands, it wouldnt move until I unplugged the phone.
     
  3. GrdLock

    GrdLock Well-Known Member

    Joined:
    Nov 25, 2009
    Messages:
    405
    Likes Received:
    188
    You'd have to make a bash script and put it on the phone, chmod +x it, and add whatever stuff you want to remove, as well as the remount command.
     
  4. droidkevlar

    droidkevlar Well-Known Member

    Joined:
    Jan 28, 2010
    Messages:
    815
    Likes Received:
    111
    I guess I got some more reading to do. Never messed with that but that is why I love this phone. I learn so much.
     
  5. LexusBrian400

    LexusBrian400 Well-Known Member This Topic's Starter

    Joined:
    Mar 3, 2010
    Messages:
    699
    Likes Received:
    154
    Am I on the right track here?


    #!/system/bin/sh
    mount -o rw,remount /dev/block/mtdblock3 /system
    cd /system/app
    rm -r HtcTwitter.apk
    rm -r Stock.apk
     
  6. LexusBrian400

    LexusBrian400 Well-Known Member This Topic's Starter

    Joined:
    Mar 3, 2010
    Messages:
    699
    Likes Received:
    154
    Or do I wanna go with

    #!/bin/bash


    I just wanna have a text file somewhere, maybe on the sdcard, or in sdk's tools folders, and run it via adb and an "sh" command.

    first script attempt, just tryin to get an idea. Been reading like crazy.
     
  7. droidkevlar

    droidkevlar Well-Known Member

    Joined:
    Jan 28, 2010
    Messages:
    815
    Likes Received:
    111
    Make sure to post your script once ya done so we can all enjoy it :)
     
  8. GrdLock

    GrdLock Well-Known Member

    Joined:
    Nov 25, 2009
    Messages:
    405
    Likes Received:
    188
    Ok, actually I don't think Android will run a standard bash script. You need the Android Scripting Environment installed on your phone, and the scripts need a .lau extension.

    android-scripting - Project Hosting on Google Code

    I haven't tried this, but a little reading directed me there, so you might look into that.
     
  9. LexusBrian400

    LexusBrian400 Well-Known Member This Topic's Starter

    Joined:
    Mar 3, 2010
    Messages:
    699
    Likes Received:
    154
    My best guess so far... If anyone can modify this to work better, please do. I'm trying :p


    Make a text file and save it as "remove.sh" put the following text in

    #! /system/bin/sh
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
    rm /system/app/com.htc.TwitterWidget.apk
    rm /system/app/com.htc.StockWidget.apk
    rm /system/app/HtcTwitter.apk
    rm /system/app/Stock.apk
    rm /system/app/VVMStub_v3.apk
    exit
    exit
    exit


    Download any Terminal Emulator from the market

    From Terminal, Enter

    sh /sdcard/remove.sh

    If anyone wants to try this, please let me know what you find.

    Thanks
     
  10. droidkevlar

    droidkevlar Well-Known Member

    Joined:
    Jan 28, 2010
    Messages:
    815
    Likes Received:
    111
    Thank you. Will have to test this after my next flash as I already removed these files. Dont forget to remove the odex files either. :)
     
  11. droidkevlar

    droidkevlar Well-Known Member

    Joined:
    Jan 28, 2010
    Messages:
    815
    Likes Received:
    111
    Here is what I came up with. Like an idiot, I removed all the packages before doing this. When I tried it, it just sits there, so I dont know if its because the stuff isnt there or its wrong. Anyone?

    #! /system/bin/sh
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
    rm /system/app/com.htc.TwitterWidget.apk
    rm /system/app/com.htc.TwitterWidget.odex
    rm /system/app/com.htc.StockWidget.apk
    rm /system/app/com.htc.StockWidget.odex
    rm /system/app/HtcTwitter.apk
    rm /system/app/HtcTwitter.odex
    rm /system/app/Stock.apk
    rm /system/app/Stock.odex
    rm /system/app/VVMStub_v3.apk
    rm /system/app/VVMStub_v3.odex
    rm /system/app/amazonmp3.apk
    rm /system/app/DCSStock.apk
    rm /system/app/DCSStock.odex
    rm /system/app/Mms.apk
    rm /system/app/Mms.odex
    rm /system/app/amazonmp3.apk
    rm /system/app/amazonmp3.odex

    exit
    exit
    exit
     
  12. droidkevlar

    droidkevlar Well-Known Member

    Joined:
    Jan 28, 2010
    Messages:
    815
    Likes Received:
    111
    Anyone having luck with this? I get a not found, mount: no such file or directory, and then read only error

    This is what I have, what am I doing wrong?

    #! /system/bin/sh
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
    rm -f /system/app/com.htc.TwitterWidget.apk
    rm -f /system/app/com.htc.TwitterWidget.odex
    rm -f /system/app/com.htc.StockWidget.apk
    rm -f /system/app/com.htc.StockWidget.odex
    rm -f /system/app/HtcTwitter.apk
    rm -f /system/app/HtcTwitter.odex
    rm -f /system/app/Stock.apk
    rm -f /system/app/Stock.odex
    rm -f /system/app/VVMStub_v3.apk
    rm -f /system/app/VVMStub_v3.odex
    rm -f /system/app/amazonmp3.apk
    rm -f /system/app/DCSStock.apk
    rm -f /system/app/DCSStock.odex
    rm -f /system/app/Mms.apk
    rm -f /system/app/Mms.odex
    rm -f /system/app/amazonmp3.apk
    rm -f /system/app/amazonmp3.odex
    exit
    exit
    exit

    EDIT: Just re-read the posts GrdLock put and it seems this wont work. I gotta read more of the link he posted when I get time.
     
  13. droidkevlar

    droidkevlar Well-Known Member

    Joined:
    Jan 28, 2010
    Messages:
    815
    Likes Received:
    111
    Since no one answered on this, I figured a lil out. The rm -f doesnt work on our phones (from what I have tried, I could be wrong since I know nothing about linux) so what I did was open a cmd window in windows and went into the /tools/ dir and then ran the first 3 commands of line:

    #! /system/bin/sh
    su
    mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system

    and then copy and pasted the rest:

    rm /system/app/com.htc.TwitterWidget.apk
    rm /system/app/com.htc.TwitterWidget.odex
    rm /system/app/com.htc.StockWidget.apk
    rm /system/app/com.htc.StockWidget.odex
    rm /system/app/HtcTwitter.apk
    rm /system/app/HtcTwitter.odex
    rm /system/app/Stock.apk
    rm /system/app/Stock.odex
    rm /system/app/VVMStub_v3.apk
    rm /system/app/VVMStub_v3.odex
    rm /system/app/amazonmp3.apk
    rm /system/app/DCSStock.apk
    rm /system/app/DCSStock.odex
    rm /system/app/Mms.apk
    rm /system/app/Mms.odex
    rm /system/app/amazonmp3.apk
    rm /system/app/amazonmp3.odex

    It removed all the files that were still there and the ones that were not it just gave an error. Is it auto? No but it works instead of having to type 1 line after another. I will test making an script .bat that does this from windows since I cant figure it out how to do it on the phone the same way.
     
  14. jamezelle

    jamezelle Well-Known Member

    Joined:
    Feb 3, 2010
    Messages:
    161
    Likes Received:
    15

    first off you can remove the -t yaffs2 its redundant because android already knows mtdblock3 is mounted on a yaffs2 partition


    so try this

    Code (Text):
    1. #!/system/bin/sh
    2.  
    3. /system/bin/mount -o remount,rw /dev/block/mtdblock3 /system
    4.  
    5. cd /system/app
    6.  
    7. rm com.htc.TwitterWidget.apk
    8. rm com.htc.TwitterWidget.odex
    9. rm com.htc.StockWidget.apk
    10. rm com.htc.StockWidget.odex
    11. rm HtcTwitter.apk
    12. rm HtcTwitter.odex
    13. rm Stock.apk
    14. rm Stock.odex
    15. rm VVMStub_v3.apk
    16. rm VVMStub_v3.odex
    17. rm amazonmp3.apk
    18. rm DCSStock.apk
    19. rm DCSStock.odex
    20. rm Mms.apk
    21. rm Mms.odex
    22. rm amazonmp3.apk
    23. rm amazonmp3.odex
    24.  
    25. exit

    and dont forget we do have code tags :p
     
  15. viagra1007

    viagra1007 New Member

    Joined:
    May 7, 2010
    Messages:
    1
    Likes Received:
    0
    Tried this and came up with ''No such file or directory errors'' and ''command not found''

    My Script:

    #! /system/bin/sh

    mount -o rw,remount /dev/block/mtdblock3 /system

    cd /system/app

    rm teeter.apk
    rm htcmailwidgets.apk
    rm htcmsgwidgets.apk
    rm htcbookmarkwidget.apk
    rm htccalendarwidgets.apk
    rm com.htc.TwitterWidget.apk
    rm com.htc.StockWidget.apk
    rm com.htc.MusicWidget.apk
    rm amazonmp3.apk
    rm Sprint_TVWidget.apk
    rm Sprint_TV.apk
    rm Sprint_Nscar.apk
    rm Sprint_NFL.apk
    rm Sprint_Core.apk
    rm SetupWizard.apk
    rm LearnMore.apk
    rm SocialNetworkProvider.apk
    rm IM.apk
    rm HtcTwitter.apk
    rm HtcPhotoWidget.apk
    rm HtcNaviPanel.apk
    rm HtcFootprintsWidget.apk
    rm HtcFootprints.apk
    rm HTCSetupWizard.apk
    rm Flickr.apk
    rm Facebook.apk
    rm gtalkservice.apk

    cd /data/data

    rm -R com.htc.photo.widgets
    rm -R com.mobitv.client.sprinttv
    rm -R com.mobitv.sprint.tvwidget
    rm -R com.htc.socialnetwork.flickr
    rm -R com.htc.lockscreen
    rm -R com.amazon.mp3
    rm -R com.htc.MusicWidget
    rm -R com.htc.TwitterWidget
    rm -R com.htc.StockWidget
    rm -R com.google.android.apps.gtalkservice
    rm -R com.htc.htcbookmarkwidget
    rm -R com.htc.htccalendarwidgets
    rm -R com.htc.htcmailwidgets
    rm -R com.htc.htcmsgwidgets
    rm -R com.htc.htctwitter
    rm -R com.htc.android.teeter
    rm -R com.htc.HtcNaviPanel
    rm -R com.htc.android.footprints
    rm -R com.htc.android.htcsetupwizard
    rm -R com.htc.footprints.widgets

    exit

    ______

    Any help will be appreciated.
     

Share This Page

Loading...