Browse Source

Verbose support for pamusb-conf

master
Andrea Luzzardi 17 years ago
parent
commit
3874340adb
1 changed files with 8 additions and 4 deletions
  1. +8
    -4
      pam_usb/tools/pamusb-conf

+ 8
- 4
pam_usb/tools/pamusb-conf View File

@ -161,6 +161,8 @@ def addDevice(options):
try: try:
devices.append(Device(udi)) devices.append(Device(udi))
except Exception, ex: except Exception, ex:
if options['verbose']:
print ex
pass pass
if len(devices) == 0: if len(devices) == 0:
@ -219,14 +221,14 @@ def addDevice(options):
writeConf(options, doc) writeConf(options, doc)
def usage(): def usage():
print 'Usage: %s [--help] [--config=path] [--add-user=name | --add-device=name]' % os.path.basename(__file__)
print 'Usage: %s [--help] [--verbose] [--config=path] [--add-user=name | --add-device=name]' % os.path.basename(__file__)
sys.exit(1) sys.exit(1)
import getopt import getopt
try: try:
opts, args = getopt.getopt(sys.argv[1:], "hd:nu:c:",
["help", "add-device=", "add-user=", "config="])
opts, args = getopt.getopt(sys.argv[1:], "hvd:nu:c:",
["help", "verbose", "add-device=", "add-user=", "config="])
except getopt.GetoptError: except getopt.GetoptError:
usage() usage()
@ -234,11 +236,13 @@ if len(args) != 0:
usage() usage()
options = { 'deviceName' : None, 'userName' : None, options = { 'deviceName' : None, 'userName' : None,
'configFile' : '/etc/pamusb.conf' }
'configFile' : '/etc/pamusb.conf', 'verbose' : False }
for o, a in opts: for o, a in opts:
if o in ("-h", "--help"): if o in ("-h", "--help"):
usage() usage()
if o in ("-v", "--verbose"):
options['verbose'] = True
if o in ("-d", "--add-device"): if o in ("-d", "--add-device"):
options['deviceName'] = a options['deviceName'] = a
if o in ("-u", "--add-user"): if o in ("-u", "--add-user"):


Loading…
Cancel
Save