Last active
November 10, 2015 04:19
-
-
Save riipandi/b0beb47423b0b6f9fd55 to your computer and use it in GitHub Desktop.
Ertix Code Snippets
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/python | |
## | |
# curl -Lsk http://git.io/vk2NC -o /usr/bin/epm; chmod +x /usr/bin/epm | |
## | |
""" | |
Ertix Package Manager | |
Last updated: 2015/11/10 | |
""" | |
from __future__ import print_function | |
import os, sys, time, urllib2 | |
BASE=os.getcwd() | |
USE_WGET=False | |
__version__= "0.4" | |
__license__= """ | |
an enhanced APT Package Manager written in Python | |
Copyright (c) 2015 Aris Ripandi <[email protected]> | |
Basic commands: | |
=============== | |
find|search search packages | |
install install packages | |
delete|remove uninstall packages | |
autoremove clean uninstalled packages | |
purge purge packages | |
clean cleaning packages | |
update update catalogue | |
upgrade upgrade partial | |
full-upgrade upgrade the distro | |
dist-upgrade upgrade the distro | |
info info about packages | |
installed view installed packages | |
add-ppa add ppa repository | |
edit-repo edit repository sources | |
""" | |
def isConnected(): | |
try: | |
response=urllib2.urlopen('http://bing.com',timeout=3) | |
return True | |
except urllib2.URLError as err: pass | |
return False | |
if __name__ == '__main__': | |
if isConnected() == 1: | |
if len(sys.argv) == 1: | |
print( __license__ ) | |
exit() | |
param=' '.join(arg for arg in sys.argv[2:]) | |
if "find" in sys.argv: | |
os.system('apt-cache search ' + param) | |
if "search" in sys.argv: | |
os.system('apt-cache search ' + param) | |
if "install" in sys.argv: | |
os.system('apt-get install --no-install-recommends ' + param) | |
if "delete" in sys.argv: | |
os.system('apt-get remove ' + param) | |
os.system('apt-get autoremove') | |
if "remove" in sys.argv: | |
os.system('apt-get remove ' + param) | |
os.system('apt-get autoremove') | |
if "autoremove" in sys.argv: | |
os.system('apt-get autoremove') | |
if "purge" in sys.argv: | |
os.system('apt-get purge ' + param) | |
os.system('apt-get autoremove') | |
if "info" in sys.argv: | |
os.system('apt-cache show ' + param) | |
if "clean" in sys.argv: | |
os.system('apt-get clean') | |
if "update" in sys.argv: | |
os.system('apt-get update') | |
if "upgrade" in sys.argv: | |
os.system('apt-get upgrade') | |
if "dist-upgrade" in sys.argv: | |
os.system('apt-get dist-upgrade') | |
if "full-upgrade" in sys.argv: | |
os.system('apt-get dist-upgrade') | |
if "installed" in sys.argv: | |
os.system('dpkg --get-selections') | |
if "add-ppa" in sys.argv: | |
os.system('add-apt-repository ' + param) | |
if "edit-repo" in sys.argv: | |
os.system('nano /etc/apt/sources.list') | |
else: | |
print('\nNo internet connection...\n') | |
exit() | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment