I want to get the list of conffiles associated with a deb package using python. I am working on a project for which I need to know if any conffile installed by a package is modified so I need to have a list of conffiles installed by a package so that I can use it to see which of the conffile has been modified.
I tried to use python-apt library documentation , but could not find any method for doing that , Please suggest me a way of doing that. I know I can extract the control information and read the raw conffiles file but I think there might be a method in the library itself.
this is tested on python-apt on squeeze: the package I used is:
http://ftp.debian.org/debian/pool/main/o/openssh/openssh-server_5.5p1-6+squeeze1_amd64.deb
from apt.debfile import DebPackage
ssh = DebPackage('openssh-server_5.5p1-6+squeeze1_amd64.deb')
print ssh.control_content('conffiles').split('\n')
[u'/etc/init.d/ssh', u'/etc/default/ssh', u'/etc/network/if-up.d/openssh-server', u'/etc/ufw/applications.d/openssh-server', u'/etc/pam.d/sshd', u'']
you need to strip out the last one
print ssh.data_content('etc/init.d/ssh')
u'#! /bin/sh\n\n### BEGIN INIT INFO\n#......'
you need to strip out the first slash
状态标志
dpkg --status bash
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.