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 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
#! /usr/bin/env python
# configlets-text -- Text-mode configlet frontend (uses dpkg-reconfigure)
# $Progeny: configlets-text,v 1.10 2002/01/18 06:19:43 dsp Exp $
# Copyright (C) 2001 Progeny Linux Systems, Inc.
# AUTHORS: Eric Gillespie, Jr. <epg@progeny.com>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License, version 2, as
# published by the Free Software Foundation.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import os
import re
import string
from configlet import BasicConfigGroup
class TextConfigGroup(BasicConfigGroup):
def show(self):
packages = []
shared_questions = []
for configlet in self:
# It should be this simple...
#packages.extend(configlet.get_packages())
# But stupid dpkg-reconfigure exits as soon as it sees a
# package where package.config does not exist. >sigh<
for pkg in configlet.get_packages():
if os.path.exists("/var/lib/dpkg/info/%s.config"
% (pkg,)):
if pkg not in packages:
packages.append(pkg)
shared_questions.extend(configlet.get_shared_questions())
dcdata = self.dc.get()
if os.environ.has_key("DEBUG"):
dcpipe_command = "debconf-communicate"
else:
dcpipe_command = "debconf-communicate > /dev/null"
dcpipe = os.popen(dcpipe_command, "w")
for i in dcdata:
(template, question, value) = re.split(r"\s+", i, 2)
(pkg, var) = re.split("/", question, 1)
if pkg in packages:
dcpipe.write("fset %s seen false\n" % (question,))
for i in shared_questions:
dcpipe.write("fset %s seen false\n" % (i,))
dcpipe.close()
packages_string = string.join(packages)
os.system("dpkg-reconfigure --unseen %s" % (packages_string,))
if __name__ == "__main__":
os.environ["DEBIAN_PRIORITY"] = "low"
os.environ["DEBIAN_FRONTEND"] = "teletype"
cfggroup = TextConfigGroup("/usr/share/configlets")
cfggroup.show()
|