X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=julia;h=07e436724629e448094194072f715e0afb59f9e9;hb=30b41506a6105ab23a0cac9e8197475a89236224;hp=0a4d2fdd9bb83432e99f7d3d472770d5ff4e234b;hpb=1cc237d0615e072542b34fe3368baf80b499bfe7;p=dak.git diff --git a/julia b/julia index 0a4d2fdd..07e43672 100755 --- a/julia +++ b/julia @@ -1,8 +1,8 @@ #!/usr/bin/env python # Sync PostgreSQL with (LDAP-generated) passwd file -# Copyright (C) 2001 James Troup -# $Id: julia,v 1.1 2001-09-13 23:55:51 troup Exp $ +# Copyright (C) 2001, 2002 James Troup +# $Id: julia,v 1.6 2002-05-03 16:06:45 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +18,8 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +################################################################################ + # ARRRGGGHHH # what's wrong with me!?!?!? # i was just nice to some mormon doorknockers!!! @@ -28,7 +30,7 @@ ################################################################################ -import os, pg, string, sys; +import pg, string, sys; import utils; import apt_pkg; @@ -38,12 +40,13 @@ Cnf = None; projectB = None; ################################################################################ -def usage (exit_code): +def usage (exit_code=0): print """Usage: julia [OPTION]... PASSWD_FILE -Sync postgres' pg_shadow with PASSWD_FILE. +Sync PostgreSQL's pg_user with PASSWD_FILE. - -v, --verbose explain what is being done - -h, --help display this help and exit""" + -q, --quiet be quiet about what is being done + -v, --verbose explain what is being done + -h, --help show this help and exit""" sys.exit(exit_code) ################################################################################ @@ -51,23 +54,21 @@ Sync postgres' pg_shadow with PASSWD_FILE. def main (): global Cnf, projectB; - apt_pkg.init(); - - Cnf = apt_pkg.newConfiguration(); - apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); + Cnf = utils.get_conf() Arguments = [('q',"quiet","Julia::Options::Quiet"), ('v',"verbose","Julia::Options::Verbose"), - ('D',"debug","Julia::Options::Debug", "IntVal"), - ('h',"help","Julia::Options::Help"), - ('V',"version","Julia::Options::Version")]; + ('h',"help","Julia::Options::Help")]; + for i in ["quiet", "verbose", "help" ]: + if not Cnf.has_key("Julia::Options::%s" % (i)): + Cnf["Julia::Options::%s" % (i)] = ""; arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); Options = Cnf.SubTree("Julia::Options") if Options["Help"]: - usage(0); - if arguments == []: + usage(); + if not arguments: utils.warn("julia needs the name of the passwd file to sync with as an argument."); usage(1); elif len(arguments) > 1: