Sign Up Now FAQ
Signup Now
In order to make a post or to start a new thread and or to interact with other
members of this board, you wil need to create an account first.
If this is your first visit, be sure to check out the FAQ. You have to register before you can post. If you have any problems, please contact us.
Flash a phone to Cricket Wireless Become a supporting member of Cricket Users Forum

Welcome to Cricket Users!

View Poll Results: Is this helpful?

0. You may not vote on this poll
  • This is helpful.

    0 0%
  • This is not helpful.

    0 0%
Results 1 to 1 of 1
  1. #1
    Points: 558, Level: 11
    Overall activity: 0%

    Reputation 12
    Join Date
    Jan 2012

    Removing or Moving System Apps


    I wanted to be able to decide where my phone installed it apps. I did not want to install an app to do this, so I wrote a little script that handles removing system apps and setting the default install location to the SD Card.

    I make no warranty implied or implicit. It worked for me it may work for you. Here it is.
    # a parameter is required, pattern of package to find
    test $# -eq 1 || { echo -e "indicate the package you would like to remove\n\te.g.: $0 uno"; exit 1; }
    # id -u does not return 0 in android shell, so a hack is required
    ls /data >/dev/null 2>&1
    test $? -eq 0 || { echo root access is required to run this script; exit 1; }
    # sdcard is mounted?
    test -d "/sdcard" || exit 1
    # can't do string manipulation (${X:0:1}) in android shell, so a hack is required
    INST_LOC=`pm getInstallLocation | sed 's/\[.*\]//'`
    test "${INST_LOC}" == "2" || { echo -e "Setting install location to \"prefer external\"."; pm setInstallLocation 2; }
    test -d ${BACKUP} || mkdir ${BACKUP}
    test -d ${BACKUP_DATA} || mkdir ${BACKUP_DATA}
    test -d ${BACKUP_SYSTEM} || mkdir ${BACKUP_SYSTEM}
    SA=`find ${APP_SYSTEM} -type f -iname "*${1}*" -exec echo cp {} "${BACKUP_SYSTEM}/" \; -exec echo rm {} \; 2>/dev/null`
    test ${#SA[@]} -ne 0 && echo "$SA"
    DA=`find ${APP_DATA} -type f -iname "*${1}*" -exec echo cp {} "${BACKUP_DATA}/" \; -exec echo rm {} \; 2>/dev/null`
    test ${#DA[@]} -ne 0 && echo "$DA"
    DC=`find ${DALVIK_CACHE} -type f -iname "*${1}*" -exec echo rm {} \; 2>/dev/null`
    test ${#DC[@]} -ne 0 && echo "$DC"
    COUNT=$((${#DC[@]} + ${#DA[@]} + ${#SA[@]}))
    test $COUNT -gt 0 || { echo "Nothing to do."; exit 0; }
    echo Execute these actions? [yN]
    read I
    [ "$I" == "y" ]||[ "$I" == "Y" ] || exit 0; 
    mount -o rw,remount /dev/block/mtdblock3 /system || { echo "could not remount system fs."; exit 1; }
    test ${#SA[@]} -ne 0 && \
    find ${APP_SYSTEM} -type f -iname "*${1}*" -exec cp {} "${BACKUP_SYSTEM}/" \; -exec rm {} \;
    test ${#DA[@]} -ne 0 && \
    find ${APP_DATA} -type f -iname "*${1}*" -exec cp {} "${BACKUP_DATA}/" \; -exec rm {} \;
    test ${#DC[@]} -ne 0 && \
    find ${DALVIK_CACHE} -type f -iname "*${1}*" -exec rm {} \;
    echo The package, updates and cache have been removed from the system.
    echo reboot now to reload the modified OS? [yN]
    read I
    [ "$I" == "y" ]||[ "$I" == "Y" ] || exit 0; 
    After you have removed the app you can reinstall it from the market place and it will be on your SD Card.

    Once confirmed you can delete the files that were backed up on your SD Card.


    Also, to enable non system apps to be moved to SD Card you just need to run the command 'pm setInstallLocation 2' in adb shell. This can be done without root permissions.
    Last edited by bsquared; 02-21-2012 at 05:19 PM. Reason: added a note.

  2. Remove this advertisement.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Advertise With Us?
Advertise with us? (Position 1 - Advertise with Us) Small Banner