- tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
- outfile = open(STATE_FILE+".tmp","w")
+ try:
+ tagfile = apt_pkg.ParseTagFile(open(STATE_FILE))
+ outfile = open(STATE_FILE+".tmp","w")
+ except IOError, msg:
+ print "%s, are you root?" % (msg)
+ sys.exit(1)
print "changing %s to %s" % (pkgname,action)
newsec = apt_pkg.RewriteSection(tagfile.Section,
[],
print "changing %s to %s" % (pkgname,action)
newsec = apt_pkg.RewriteSection(tagfile.Section,
[],
# all done, rename the tmpfile
os.chmod(outfile.name, 0644)
os.rename(outfile.name, STATE_FILE)
# all done, rename the tmpfile
os.chmod(outfile.name, 0644)
os.rename(outfile.name, STATE_FILE)