diff options
author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-10 22:20:07 +0100 |
---|---|---|
committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-12-10 22:20:07 +0100 |
commit | 43be0ac4b37f3a82ae4a16e473c3d8e44637ce1b (patch) | |
tree | 7c0e75b291d132b6f1577fc2267f8ea0a60df459 /cmdline/apt-mark | |
parent | 9307ef07498d37c0b5e05b036195abaf7ad0105c (diff) | |
parent | a0895a74fe95997a5d75e5b54c95afb9594554f6 (diff) |
merged from the mvo branch (and contains all non-abi break changes from donkult)
Diffstat (limited to 'cmdline/apt-mark')
-rwxr-xr-x | cmdline/apt-mark | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/cmdline/apt-mark b/cmdline/apt-mark index 226d2079b..3a818a3db 100755 --- a/cmdline/apt-mark +++ b/cmdline/apt-mark @@ -2,13 +2,14 @@ from optparse import OptionParser +import sys +import os.path + try: import apt_pkg except ImportError: print "Error importing apt_pkg, is python-apt installed?" - -import sys -import os.path + sys.exit(1) actions = { "markauto" : 1, "unmarkauto": 0 @@ -31,8 +32,12 @@ def mark_unmark_automatic(filename, action, pkgs): " mark or unmark automatic flag" # open the statefile if os.path.exists(STATE_FILE): - 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) while tagfile.Step(): pkgname = tagfile.Section.get("Package") autoInst = tagfile.Section.get("Auto-Installed") |