Created
February 5, 2013 21:16
-
-
Save xorrizon/4717734 to your computer and use it in GitHub Desktop.
A little uninstall script I wrote to uninstall android apps via adb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
def get_packages(prefix) | |
pkgs = [] | |
s = `adb shell pm list packages #{prefix}` | |
s.each_line do |line| | |
next unless line.start_with?("package:") | |
pkgs << line.split(":")[1] | |
end | |
pkgs | |
end | |
def uninstall_package(pkg) | |
`adb uninstall #{pkg}` | |
end | |
def usage | |
puts "USAGE: #{__FILE__} package" | |
puts "Example: #{__FILE__} org.catrobat" | |
end | |
if ARGV.length < 1 | |
puts usage | |
exit 1 | |
end | |
pkgs = get_packages(ARGV[0]) | |
pkgs.each do |pkg| | |
print "uninstalling " + pkg | |
puts uninstall_package(pkg) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment