--- /usr/bin/glsa-check 2005-06-12 16:25:46.000000000 -0400 +++ glsa-check 2005-09-07 12:22:21.000000000 -0400 @@ -6,6 +6,7 @@ import os,string,sys sys.path.insert(0, "/usr/lib/gentoolkit/pym") sys.path.insert(0, "/usr/lib/portage/pym") +from portage_util import grabfile from output import * from getopt import getopt,GetoptError @@ -41,7 +42,7 @@ args, params = getopt(sys.argv[1:], "dplfchinvt", \ ["dump", "print", "list", "pretend", "fix", "inject", "help", "info", "version", "test", "nocolor"]) args = [a for a,b in args] - + for option in ["--nocolor", "-n"]: if option in args: nocolor() @@ -60,13 +61,15 @@ elif len(args) > 1: print "please use only one command per call" mode = "help" + + else: # in what mode are we ? args = args[0] for m in optionmap: if args in [o for o in m[:-1]]: mode = m[1][2:] - + except GetoptError, e: print "unknown option given:", e mode = "help" @@ -98,6 +101,7 @@ print sys.exit(1) + # we need root priviledges for write access if mode in ["fix", "inject"] and os.geteuid() != 0: print @@ -119,6 +123,17 @@ glsaconfig = checkconfig(portage.config(clone=portage.settings)) +# check that there is a glsa list +glsatimestampfile = glsaconfig["GLSA_DIR"]+"/timestamp.chk" +if os.path.exists(glsatimestampfile): + content=portage.grabfile(glsatimestampfile) +else : + print + print red("This tool needs to have a current GLSA list.") + print "Please emerge sync to obtain the latest list" + print + sys.exit(0) + # build glsa lists completelist = get_glsa_list(glsaconfig["GLSA_DIR"], glsaconfig)