Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Updates

  • Loading branch information...
commit 4c462e326c5d776934fd5283c2d763b11fe64624 1 parent 354ce59
@dagwieers authored
View
2  AUTHORS
@@ -1 +1,3 @@
Dag Wieers <dag@wieers.com>
+
+Debian dconf - Leo Eraly <leo@kangaroot.net>
View
5 ChangeLog
@@ -4,6 +4,11 @@
- Added --root option
- Check permissions to files and commands prior to using them
- Test existence of rpm binary prior to using it
+- Added dconf-debian.conf (Leo Eraly)
+- Added --nodigest and --noverify to rpm -qa command
+- Added syslog message
+- Fixed sort differences when running using cron or manual (LC_ALL='C')
+- Added internal exclude list for common unwanted files
* 0.4.1 - released 24/11/2004
- Fixed a bug with md5sum checking
View
9 TODO
@@ -1,23 +1,24 @@
### Configuration (help welcome !)
+ Add as many config files and important system state info
-+ Split Conectiva/Debian/Mandrake/Red Hat/SuSE config files
++ Add Mandriva/Gentoo/... config files
### Usability
+ Make mailing diffs smart (keep the headers and diff content)
-+ Add support for (recursive) dirs
++ Add support for (recursive) dirs (dirs = )
+ Rotate snapshots or consolidate snapshots (by removing in-between snapshots)
+ Add dpkg support
+ Use the same order in the snapshot file as the order of the sections
### Output
-+ Sort the different sections
+ Allow XML or HTML output (in some way)
### Query tool (dconf-diff)
+ Add tool to smart diff between 2 dates (say: dconf-diff '1 day ago' or dconf-diff 'now')
-+ Add tool to restore files from dconf log (say: dconf-restore --root /tmp /etc/sysctl.conf)
+ Get logged-on people directly from utmp database (based on given dates), see python-utmp
+### Restore tool (dconf-restore)
++ Add tool to restore files from dconf log (say: dconf-restore --root /tmp /etc/sysctl.conf)
+
### Bugs
+ Dconf needs a very recent python (2.3) with unified_diff support (for email-functionality only)
+ sysctl actually performs a change and this goes against the intent, sadly sysctl -a returns random/variable stuff -> false positive
View
7 config/dconf-custom.conf
@@ -1,7 +1,10 @@
### Customized configuration
-[main]
-cron = daily
+###
+### Please send general improvements to this file to:
+### Dag Wieers <dag@wieers.com>
+[main]
+cron = weekly
#mailto = root@localhost
#smtp-server = localhost
View
355 config/dconf-debian.conf
@@ -0,0 +1,355 @@
+### Changes to this file may get lost when upgrading dconf
+### Customizations should go into /etc/dconf-custom.conf
+
+### Please send improvements or fixes to: Dag Wieers <dag@wieers.com>
+### Initial debian version: Leo Eraly <leo@kangaroot.net>
+### Main configuration
+[main]
+logdir = /var/log/dconf
+include = /etc/dconf-custom.conf
+
+### System information
+[apm]
+files = /etc/apm/event.d/*
+ /etc/apm/resume.d/*
+ /etc/apm/suspemd.d/*
+
+[boot]
+files =
+ /etc/grub.conf
+ /etc/inittab
+ /etc/lilo.conf
+ /etc/modules
+ /proc/cmdline
+
+[dhcp]
+files =
+ /etc/dhclient.conf
+ /etc/dhclient-script
+ /etc/dhcpd.conf
+ /etc/pump.conf
+ /etc/default/dhcp
+
+[filesystems]
+cmds =
+ fdisk -l 2>/dev/null
+ sfdisk -l
+ df -h
+ mount
+files =
+ /etc/exports
+ /etc/raidtab
+ /etc/fstab
+ /proc/filesystems
+ /proc/mounts
+
+[firewall]
+cmds =
+ ebtables -L
+ ipchains -L -xnv
+ iptables-save
+ iptables -L -t filter -xnv | sed -e 's| [0-9]\+ packets, [0-9]\+ bytes||'
+ iptables -L -t mangle -xnv | sed -e 's| [0-9]\+ packets, [0-9]\+ bytes||'
+ iptables -L -t nat -xnv | sed -e 's| [0-9]\+ packets, [0-9]\+ bytes||'
+files =
+ /etc/init.d/iptables
+ /etc/default/iptables
+ /proc/net/ip_conntrack
+ /proc/sys/net/ipv4/ip_*
+
+[ipsec]
+cmds =
+ ipsec auto --status
+
+files =
+ /etc/ipsec.conf
+ /etc/ipsec.d/*
+ /proc/net/ipsec_version
+
+[ipvs]
+cmds = ipvsadm -L
+files =
+ /etc/sysconfig/ipvsadm
+ /etc/ipvsadm.rules
+
+[kernel]
+cmds =
+ ipcs -l
+ sysctl -e -p
+ dmesg
+files = /etc/sysctl.conf
+
+[network]
+cmds =
+ ip addr
+ ip route
+### Too much noise
+# netstat -lnpt | grep -v ":60.. " | perl -p -e "s|^(\w+)(\s+\S+){2}|\$1 |; s|(\d+\|PID)/||;"
+# netstat -lnpu | grep -v "/local " | perl -p -e "s|^(\w+)(\s+\S+){2}|\$1 |; s|(\d+\|PID)/||;"
+ route -n
+files =
+ /etc/host.conf
+ /etc/hosts
+ /etc/nsswitch.conf
+ /etc/resolv.conf
+ /etc/network/interfaces
+ /etc/network/if-down.d/*
+ /etc/network/if-post-down.d/*
+ /etc/network/if-pre-up.d/*
+ /etc/network/if-up.d/
+ /etc/network/ip-down.d/*
+ /etc/network/ip-up.d/*
+ /etc/network/options
+ /proc/net/dev
+#maybe another location for unix sockets?
+ /proc/net/unix
+
+[packages]
+cmds = dpkg -l
+
+[printer]
+files =
+ /etc/cups/cupsd.conf
+ /etc/cups/printers.conf
+ /etc/cups/client.conf
+ /etc/lpd.conf
+ /etc/printcap
+
+[root user]
+files =
+ /root/.Xresources
+ /root/.bash_logout
+ /root/.bash_profile
+ /root/.bashrc
+ /root/.cshrc
+ /root/.tcshrc
+
+[security]
+files =
+ /etc/group
+ /etc/gshadow
+ /etc/hosts.allow
+ /etc/hosts.deny
+ /etc/passwd
+ /etc/shadow
+ /etc/sudoers
+
+[services]
+dirs = /etc/security
+files =
+ /etc/inetd.conf
+[shell]
+files =
+ /etc/bashrc
+ /etc/bash.bashrc
+ /etc/bash_completion
+ /etc/profile
+
+[system]
+cmds = uname -a
+files = /etc/debian_version
+
+### Hardware info
+[hardware]
+cmds =
+ dmidecode
+ lspci -v
+ lsusb -vv
+# for i in /dev/hd[a-z] /dev/sd[a-z]; do smartctl -a $i; done
+files =
+ /etc/modprobe.conf
+ /etc/modules.conf
+ /proc/cpuinfo
+ /proc/devices
+ /proc/dma
+ /proc/driver/nvram
+ /proc/ide/drivers
+ /proc/ide/ide?/hd?/{cache,capacity,media,model,settings}
+ /proc/ide/piix
+ /proc/ide/via
+ /proc/iomem
+ /proc/mdstat
+ /proc/misc
+ /proc/modules
+ /proc/mtrr
+ /proc/ppc64/lparcfg
+ /proc/ppc64/rtas/poweron
+ /proc/ppc64/rtas/sensors
+ /proc/scsi
+ /proc/scsi/IBMchanger
+ /proc/scsi/IBMtape
+ /proc/swaps
+ /proc/tty/drivers
+
+dirs = /etc/modutils
+
+[amavisd-new]
+files =
+ /etc/amavis/amavisd.conf
+
+[apache]
+files =
+ /etc/apache/httpd.conf
+ /etc/apache/conf.d/*
+
+[bind]
+files =
+ /etc/bind/named.conf
+ /etc/bind/rndc.key
+
+[clamav]
+files =
+ /etc/clamav/clamd.conf
+ /etc/clamav/clamav.conf
+ /etc/clamav/freshclam.conf
+
+[cron]
+files = /etc/crontab
+cmds = crontab -l
+# ls -l /etc/cron.*/
+
+dirs = /etc/cron.daily
+ /etc/cron.weekly
+ /etc/cron.hourly
+ /etc/cron.d
+
+[dconf]
+files =
+ /etc/dconf.conf
+ /etc/dconf-custom.conf
+
+[mysql]
+files = /etc/mysql/my.cnf
+ /etc/mysql/debian.cnf
+
+[nagios]
+files =
+ /etc/nagios/*.cfg
+
+[nfs]
+cmds =
+ exportfs
+ showmount -d
+ showmount -e
+files =
+ /etc/exports
+
+[nscd]
+files = /etc/nscd.conf
+
+[ntp]
+files =
+ /etc/ntp.conf
+ /etc/ntp/keys
+ /etc/ntp/ntpservers
+ /etc/ntp/step-tickers
+ /etc/sysconfig/ntpd
+
+[openldap]
+files =
+# this ldap.conf is used for nss
+ /etc/ldap.conf
+# this is the openldap client conf
+ /etc/ldap/ldap.conf
+ /etc/ldap.secrets
+ /etc/ldap/slapd.conf
+#maybe the schema?
+
+[openssh]
+files =
+ /etc/ssh/shosts.equiv
+ /etc/ssh/ssh_config
+ /etc/ssh/sshd_config
+ /root/.ssh/authorized_keys2
+ /root/.ssh/sshd_config
+ /root/.ssh/sshd_config
+
+[php]
+files =
+ /etc/php4/apache/php.ini
+
+
+[postfix]
+files =
+ /etc/postfix/access
+ /etc/postfix/aliases
+ /etc/postfix/canonical
+ /etc/postfix/main.cf
+ /etc/postfix/master.cf
+ /etc/postfix/pcre_table
+ /etc/postfix/regexp_table
+ /etc/postfix/relocated
+ /etc/postfix/transport
+ /etc/postfix/virtual
+
+[proftpd]
+files =
+ /etc/ftpusers
+ /etc/proftpd.conf
+ /var/ftp/welcome.msg
+
+[qmail]
+cmds = /var/qmail/bin/qmail-showctl
+dirs =
+ /var/qmail/alias/
+ /var/qmail/popboxes/
+ /var/qmail/users/
+ /var/qmail/control
+
+[rsync]
+files = /etc/rsyncd.conf
+
+[samba]
+files =
+ /etc/samba/smb.conf
+ /etc/samba/smbusers
+ /etc/samba/lmhosts
+ /etc/samba/smb.conf
+ /etc/samba/smbpasswd
+ /etc/samba/smbusers
+
+[sendmail]
+files =
+ /etc/aliases
+ /etc/mail/access
+ /etc/mail/domaintable
+ /etc/mail/local-host-names
+ /etc/mail/mailertable
+ /etc/mail/sendmail.mc
+ /etc/mail/submit.mc
+ /etc/mail/trusted-users
+ /etc/mail/virtusertable
+
+[smbldap]
+files =
+ /etc/smbldap-tools/smbldap.conf
+ /etc/smbldap-tools/smbldap_bind.conf
+
+[snort]
+files =
+ /etc/snort/*.config
+ /etc/sysconfig/snort
+
+[spamassassin]
+files =
+ /etc/spamassassin/*.cf
+ /etc/default/spamassassin
+
+[squid]
+files =
+ /etc/squid/mime.conf
+ /etc/squid/msntauth.conf
+ /etc/squid/squid.conf
+
+[syslog]
+files =
+ /etc/syslog.conf
+
+[webalizer]
+files = /etc/webalizer.conf
+
+[apt]
+files = /etc/apt/sources.list
+dirs = /etc/apt/apt.conf.d
+
+### Add your own customizations to /etc/dconf-custom.conf
View
5 config/dconf-example.conf
@@ -10,7 +10,10 @@
compression = gzip
### The frequency to run dconf from cron (None, hourly, daily, weekly, monthly)
-cron =
+cron = None
+
+### A list of excluded files
+exclude = CVS CVS.adm RCS RCSLOG SCCS TAGS cvslog.* tags .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o *.lo *.la *.obj *.so *.exe *.Z *.elc *.ln core core.[0-9]* .svn *.rpmorig *.rpmnew *.rpmsave .DS_Store
### Extra config files to include
include = /etc/dconf-custom.conf
View
33 config/dconf-redhat.conf
@@ -1,7 +1,7 @@
### Changes to this file may get lost when upgrading dconf
### Customizations should go into /etc/dconf-custom.conf
-### Please send improvements or fixes to: dag@wieers.com
+### Please send improvements or fixes to: Dag Wieers <dag@wieers.com>
### Main configuration
[main]
@@ -92,7 +92,7 @@ files =
/proc/net/bonding/bond0
[packages]
-cmds = rpm -qa | sort -f
+cmds = rpm -qa --nodigest --nosignature | sort -f
[printer]
files =
@@ -111,6 +111,12 @@ files =
/root/.cshrc
/root/.tcshrc
+[rpm]
+files =
+ /etc/cron.daily/rpm
+ /etc/logrotate.d/rpm
+ /etc/rpm/macros
+
[security]
files =
/etc/group
@@ -224,6 +230,10 @@ files =
/etc/httpd/conf/httpd.conf
/etc/httpd/conf.d/*
+[apt]
+files = /etc/apt/sources.list
+dirs = /etc/apt/apt.conf.d/
+
[arpwatch]
files =
/etc/sysconfig/arpwatch
@@ -249,9 +259,9 @@ files =
/etc/sysconfig/clamav-milter
[cron]
-files = /etc/crontab
cmds = crontab -l
# ls -l /etc/cron.*/
+files = /etc/crontab
[dante]
files =
@@ -364,6 +374,10 @@ files =
/etc/mplayerplug-in.conf
/etc/mplayerplug-in.types
+[mrtg]
+files =
+ /etc/cron.d/mrtg
+
[mysql]
files = /etc/my.cnf
@@ -470,9 +484,8 @@ dirs =
/var/qmail/users/
[rpc]
-files =
- /etc/rpc
- pmap_dump
+cmds = pmap_dump
+files = /etc/rpc
[rsct]
cmds =
@@ -568,7 +581,9 @@ files =
/etc/syslog.conf
[sysstat]
-files = /etc/sysconfig/sysstat
+files =
+ /etc/cron.d/sysstat
+ /etc/sysconfig/sysstat
[tpb]
files = /etc/tpbrc
@@ -590,7 +605,9 @@ dirs = /etc/sysconfig/carp/
files = /etc/vtund.conf
[webalizer]
-files = /etc/webalizer.conf
+files =
+ /etc/cron.daily/00webalizer
+ /etc/webalizer.conf
[webmin]
files =
View
5 config/dconf-suse.conf
@@ -1,7 +1,7 @@
### Changes to this file may get lost when upgrading dconf
### Customizations should go into /etc/dconf-custom.conf
-### Please send improvements or fixes to: dag@wieers.com
+### Please send improvements or fixes to: Dag Wieers <dag@wieers.com>
### Main configuration
[main]
@@ -98,7 +98,7 @@ files =
/proc/net/bonding/bond0
[packages]
-cmds = rpm -qa | sort -f
+cmds = rpm -qa --nodigest --nosignature | sort -f
[printer]
files =
@@ -309,6 +309,7 @@ cmds =
files =
/etc/cluster.nodes
/etc/profile.d/mmfs.sh
+ /proc/fs/gpfs/version
/var/mmfs/etc/cluster.preferences
/var/mmfs/etc/mmfs.cfg
/var/mmfs/etc/mmfsdown.scr
View
158 dconf
@@ -1,7 +1,7 @@
#!/usr/bin/env python
-import os, sys, glob, re, shutil, getopt, popen2, time
-import ConfigParser, urlparse, pwd, grp, stat
+import os, sys, glob, re, shutil, getopt, popen2, time, fnmatch
+import ConfigParser, urlparse, pwd, grp, stat, syslog
import difflib, smtplib, gzip, md5, sha
VERSION = '0.4.2'
@@ -9,6 +9,8 @@ VERSION = '0.4.2'
enable = ('yes', 'on', 'true', '1')
disable = ('no', 'off', 'false', '0')
+excludelist = 'CVS CVS.adm RCS RCSLOG SCCS TAGS cvslog.* tags .make.state .nse_depinfo *~ #* .#* ,* _$* *$ *.old *.bak *.BAK *.orig *.rej .del-* *.a *.olb *.o *.lo *.la *.obj *.so *.exe *.Z *.elc *.ln core core.[0-9]* .svn *.rpmorig *.rpmnew *.rpmsave .DS_Store'
+
class Options:
def __init__(self, args):
self.configfile = '/etc/dconf.conf'
@@ -105,6 +107,7 @@ class Config:
self.mailto = self.getoption('main', 'mailto', None)
self.smtpserver = self.getoption('main', 'smtp-server', 'localhost')
self.rpm = not self.getoption('main', 'rpm', 'no') in disable
+ self.exclude = self.getoption('main', 'exclude', excludelist).split()
if not op.output:
op.output = self.getoption('main', 'output', None)
@@ -139,9 +142,9 @@ class Config:
def dzopen(filename, arg='r'):
"Opens a file using compression based on file's extension"
- if re.compile('^.+\.gz$').match(filename):
+ if fnmatch.fnmatch(filename, '*.gz'):
return gzip.open(filename, arg)
- elif re.compile('^.+\.bz2$').match(filename):
+ elif fnmatch.fnmatch(filename, '*.bz2'):
return BZ2File.open(filename, arg)
else:
return open(filename, arg)
@@ -183,9 +186,9 @@ def fromrpmdb(filename):
for h in mi:
return h
else:
- info(4, 'File %s not in rpmdb, including' % filename)
+ info(5, 'File %s not in rpmdb, including' % filename)
return None
-
+
def info(level, str):
"Output info message"
if level <= op.verbose:
@@ -238,6 +241,22 @@ def mkdir(path):
if not os.path.exists(path):
os.makedirs(path)
+def getowner(uid, gid):
+ try:
+ owner = pwd.getpwuid(uid)[0]
+ except:
+ owner = uid
+ try:
+ group = grp.getgrgid(gid)[0]
+ except:
+ group = gid
+ return owner, group
+
+def sectiontitle(section):
+ info(3, 'Processing section [%s]' % section)
+ stitle = '== ' + section.upper() + ' =='
+ return stitle + '=' * (80 - len(stitle)) + '\n'
+
def which(cmd):
"Find executables in PATH environment"
for path in os.environ.get('PATH','$PATH').split(':'):
@@ -257,20 +276,26 @@ def diff(fromfile, tofile):
fromfd.close()
return msg
+def fnmatches(file):
+ for entry in cf.exclude:
+ if fnmatch.fnmatch(file, entry):
+ info(6, 'File %s matches against glob %s' % (file, entry))
+ return True
+ return False
+
def mail(subject, msg):
info(2, 'Sending mail to: %s' % cf.mailto)
try:
smtp = smtplib.SMTP(cf.smtpserver)
# server.set_debuglevel(1)
+ msg = 'Subject: %s\n\n' % subject + '\n' + \
+ 'Current time:\n' + os.popen('date').read() + '\n' + \
+ 'System information:\n'+ os.popen('uname -a').read() + '\n' + \
+ 'Uptime:\n' + os.popen('uptime').read() + '\n' + \
+ 'Currently logged on users:\n' + os.popen('who').read() + '\n' + \
+ subject + '\n\n' + msg
for email in cf.mailto.split():
- msg = 'To: %s\n' % email + \
- 'Subject: %s\n\n' % subject + '\n' + \
- 'Current time:\n' + os.popen('date').read() + '\n' + \
- 'System information:\n'+ os.popen('uname -a').read() + '\n' + \
- 'Uptime:\n' + os.popen('uptime').read() + '\n' + \
- 'Currently logged on users:\n' + os.popen('who').read() + '\n' + \
- subject + '\n\n' + msg
- smtp.sendmail('dconf@%s' % os.uname()[1], email, msg)
+ smtp.sendmail('dconf@%s' % os.uname()[1], email, 'To: %s' + email + '\n' + msg)
smtp.quit()
except:
info(1, 'Sending mail via %s failed.' % cf.smtpserver)
@@ -288,11 +313,11 @@ def main():
ts = None
if cf.compression == 'gzip':
- extension = '.gz'
+ extension = '.log.gz'
elif cf.compression == 'bzip2':
- extension = '.bz2'
+ extension = '.log.bz2'
else:
- extension = ''
+ extension = '.log'
hostname = os.uname()[1].split('.')[0]
# hostname = socket.gethostbyaddr(socket.gethostname())[0]
@@ -300,6 +325,11 @@ def main():
os.umask(077)
+# os.setenv('LC_ALL', 'C')
+ os.environ['LC_ALL'] = 'C'
+
+ syslog.syslog('Dconf started.')
+
### Add to cron
if cf.cron and not op.output:
if cf.cron in ('hourly', 'daily', 'weekly', 'monthly'):
@@ -326,53 +356,48 @@ def main():
log = sys.stdout
op.quiet = True
op.verbose = 0
+ elif op.output:
+ logfile = op.output
+ log = dzopen(logfile, 'w')
else:
- if op.output:
- logfile = op.output
- log = dzopen(logfile, 'w')
- else:
- logfile = os.path.join(cf.logdir, 'dconf-' + hostname + '-' + timestamp + '.log' + extension)
- mkdir(cf.logdir)
- os.chmod(cf.logdir, 0700)
- log = dzopen(logfile, 'w')
- latestlog = os.path.join(cf.logdir, 'dconf-' + hostname + '-latest.log' + extension)
- previouslog = os.path.join(cf.logdir, 'dconf-' + hostname + '-previous.log' + extension)
- oldestlog = os.path.join(cf.logdir, 'dconf-' + hostname + '-oldest.log' + extension)
-
+ logfile = os.path.join(cf.logdir, 'dconf-' + hostname + '-' + timestamp + extension)
+ latestlog = os.path.join(cf.logdir, 'dconf-' + hostname + '-latest' + extension)
+ previouslog = os.path.join(cf.logdir, 'dconf-' + hostname + '-previous' + extension)
+ oldestlog = os.path.join(cf.logdir, 'dconf-' + hostname + '-oldest' + extension)
+ mkdir(cf.logdir)
+ os.chmod(cf.logdir, 0700)
+ log = dzopen(logfile, 'w')
info(2, 'Building file: %s' % logfile)
for section in cf.sections.keys():
- stitle = None
+ stitle = False
if cf.sections[section].has_key('cmds'):
for line in cf.sections[section]['cmds']:
- clist = line.split()
- if not clist: continue
+ cmdline = line.split()
+ if not cmdline: continue
- cmd = os.path.join(op.root, clist[0].strip())
- cmd = which(cmd)
- extra = ' '.join(clist[1:])
- if not cmd: continue
+ cmd = which(os.path.join(op.root, cmdline[0].strip()))
+ extra = ' '.join(cmdline[1:])
+ if not cmd:
+ info(5, 'Cmd %s not found in PATH, excluding.' % cmdline[0].strip())
+ continue
if not os.access(cmd, os.X_OK):
info(1, 'Cmd %s cannot be executed, excluding.' % cmd)
continue
- (mode, t, t, t, uid, gid, size, t, t, t) = os.stat(cmd)
if not stitle:
- info(3, 'Processing section [%s]' % section)
- stitle = '== ' + section.upper() + ' =='
- log.write(stitle + '=' * (80 - len(stitle)) + '\n')
+ stitle = True
+ log.write(sectiontitle(section))
+
info(4, 'Processing cmd %s' % cmd)
- try: owner = pwd.getpwuid(uid)
- except: owner = (uid,)
- try: group = grp.getgrgid(gid)
- except: group = (gid,)
- title = '--[ Cmd: %s %s ]--(%04o, %s, %s, %s)--' % (cmd, extra, stat.S_IMODE(mode), owner[0], group[0], size)
+ (mode, t, t, t, uid, gid, size, t, t, t) = os.stat(cmd)
+ owner, group = getowner(uid, gid)
+ title = '--[ Cmd: %s %s ]--(%04o, %s, %s, %s)--' % (cmd, extra, stat.S_IMODE(mode), owner, group, size)
log.write(title + '-' * (80 - len(title)) + '\n')
(o, i) = popen2.popen4('%s %s' % (cmd, extra))
- log.write(o.read())
- log.write('\n')
+ log.write(o.read() + '\n')
if cf.sections[section].has_key('files'):
for line in cf.sections[section]['files']:
@@ -382,37 +407,38 @@ def main():
if extra: extra = extra + ' '
for file in glob.glob(os.path.join(op.root, flist[0].strip())):
if not file or not os.path.isfile(file): continue
+
+ if fnmatches(file):
+ info(5, 'File %s is in the exclude list, excluding.' % file)
+ continue
+
(mode, t, t, t, uid, gid, size, t, t, t) = os.stat(file)
if not size: continue
if cf.rpm:
h = fromrpmdb(file)
if h and md5check(h, file):
- info(4, 'File %s has not been changed since installation, excluding.' % file)
+ info(5, 'File %s has not been changed since installation, excluding.' % file)
continue
- info(4, 'Processing file %s' % file)
if not os.access(file, os.R_OK):
info(1, 'File %s cannot be read, excluding.' % file)
continue
if not stitle:
- info(3, 'Processing section [%s]' % section)
- stitle = '== ' + section.upper() + ' =='
- log.write(stitle + '=' * (80 - len(stitle)) + '\n')
-
- try: owner = pwd.getpwuid(uid)
- except: owner = (uid,)
- try: group = grp.getgrgid(gid)
- except: group = (gid,)
- title = '--[ File: %s %s]--(%04o, %s, %s, %s)--' % (file, extra, stat.S_IMODE(mode), owner[0], group[0], size)
- log.write(title + '-' * (80 - len(title)) + '\n')
+ stitle = True
+ log.write(sectiontitle(section))
+ info(4, 'Processing file %s' % file)
+ owner, group = getowner(uid, gid)
+ title = '--[ File: %s %s]--(%04o, %s, %s, %s)--' % (file, extra, stat.S_IMODE(mode), owner, group, size)
+ log.write(title + '-' * (80 - len(title)) + '\n')
(o, i) = popen2.popen4('cat %s %s' % (file, extra))
- log.write(o.read())
- log.write('\n')
+ log.write(o.read() + '\n')
log.close()
+ syslog.syslog('Dconf ended succesfully.')
+
if op.output:
return
@@ -440,8 +466,6 @@ try:
except NameError:
True = 1
False = 0
-Yes = yes = On = on = True
-No = no = Off = off = False
### Main entrance
if __name__ == '__main__':
@@ -459,12 +483,8 @@ if __name__ == '__main__':
except KeyboardInterrupt, e:
cleanup()
die(6, 'Exiting on user request')
- except OSError, e:
-# print e.errno
- cleanup()
- die(7, 'OSError: %s' % e)
- except IOError, e:
+ except:
cleanup()
- die(8, 'IOError: %s' % e)
+ raise
# vim:ts=4:sw=4

0 comments on commit 4c462e3

Please sign in to comment.
Something went wrong with that request. Please try again.