-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaptlvsec.py
executable file
·53 lines (40 loc) · 945 Bytes
/
aptlvsec.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env python
aptdir='lvaptarchives'
import apt_pkg
import apt
from time import sleep
from os import uname
from os import path
from os import mkdir
def f_getpkgs(file):
with apt_pkg.TagFile('/var/lib/dpkg/status') as tagfile:
for section in tagfile:
print(section['Package'])
def f_geturi():
for p in cache:
if p.is_installed:
print p.candidate.uri
def f_getpkg(pkg):
if not path.isdir(aptdir):
mkdir(aptdir)
p=apt.progress.text.AcquireProgress()
c=apt.Cache()
u=c[pkg].candidate.uri
a=apt_pkg.Acquire(p)
acq=apt_pkg.AcquireFile(a,uri=u,destdir=aptdir)
a.run()
def f_getkernel():
kv="linux-image-"+uname()[2]
f_getpkg(kv)
def f_getlist():
list=apt_pkg.SourceList()
list.read_main_list()
for a in list:
print a
#
#def f_test():
# p=apt.progress.text.AcquireProgress()
# f=apt_pkg.Acquire(p)
#
#
f_getlist()