]> git.saurik.com Git - apt.git/blobdiff - cmdline/apt-mark
print an error if a new state file can't be created in apt-mark,
[apt.git] / cmdline / apt-mark
index 226d2079b6d6f0bb1603c6d12339cab08988bc43..c44ce7038047380800945c4897a8a27b11ea3362 100755 (executable)
@@ -31,8 +31,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")