Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 73 lines (61 sloc) 2.008 kB
#!/usr/bin/env python
import os
import sys
import logging
from ajenti.config import Config
from ajenti.standalone import make_log
from ajenti.plugmgr import PluginLoader, RepositoryManager
from ajenti.utils import detect_platform
def main():
if len(sys.argv) < 2:
print 'Specify command'
sys.exit(1)
if os.path.isfile('/etc/ajenti/ajenti.conf'):
config_file = '/etc/ajenti/ajenti.conf'
elif os.path.isfile(os.path.join(sys.path[0], 'ajenti.conf')):
config_file = os.path.join(sys.path[0], 'ajenti.conf')
log = make_log(debug=False)
print 'Loading plugins'
config = Config()
config.load(config_file)
PluginLoader.initialize(log, config.get('ajenti', 'plugins'), detect_platform())
PluginLoader.load_plugins()
mgr = RepositoryManager(config)
if sys.argv[1] == 'list':
for i in mgr.installed:
print_one(i)
if sys.argv[1] == 'avail':
for i in mgr.available:
print_one(i)
if sys.argv[1] == 'remove':
for pkg in sys.argv[2:]:
print 'Removing', pkg
mgr.remove(pkg)
print 'Done'
if sys.argv[1] == 'get':
for pkg in sys.argv[2:]:
print 'Downloading', pkg
mgr.install(pkg)
print 'Done'
if sys.argv[1] == 'update':
print 'Downloading plugin list'
mgr.update_list()
print 'Done'
if sys.argv[1] == 'upgrade':
print 'Downloading plugin list'
mgr.update_list()
print 'Upgrading Ajenti plugins'
for pkg in mgr.available:
for p in mgr.installed:
if pkg.id == p.id and pkg.version != p.version:
print 'Downloading', pkg.id
mgr.install(pkg.id)
print 'Done'
def print_one(i):
st = 'i..' if i.installed else '...'
if i.problem:
st = '..X'
print ' %s\t%s\t%s' % (st, i.version, i.id)
if i.problem:
print '\t\t\t\t' + str(i.problem)
main()
Jump to Line
Something went wrong with that request. Please try again.