Ignore:
Timestamp:
11/29/02 17:13:13 (21 years ago)
Author:
sscpbas
Message:

pxeconfigd:

Added version flag (-V, --version)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pxeconfig/pxeconfigd

    r14 r25  
    3636
    3737CVS info
    38   $Date: 2002/08/15 06:36:47 $
    39   $Revision: 1.5 $
     38  $Date: 2002/11/29 16:13:13 $
     39  $Revision: 1.6 $
    4040"""
    4141import time
     
    5656STDIN=0
    5757STDOUT=1
    58 SHORTOPT_LIST='d:'
    59 LONGOPT_LIST=['directory=']
     58SHORTOPT_LIST='Vd:'
     59LONGOPT_LIST=['version', 'directory=']
    6060
    6161PXE_CONF_DIR = '/tftpboot/pxelinux.cfg'
     62VERSION = '0.4.1'
    6263
    6364# Give the current time
     
    133134    sys.exit(1)
    134135
    135   if opts:
    136     opt, PXE_CONF_DIR = opts[0]
     136  for opt, value in opts:
     137
     138    if opt in ['-d', '--directory']:
     139      if not os.path.isdir(value):
     140        os.write(STDOUT, "PXE booting is not configured")
     141        sys.exit(1)
     142      else:
     143        PXE_CONF_DIR = value
     144
     145    elif opt in ['-V', '--version']:
     146      print VERSION
     147      sys.exit(0)
    137148
    138149def server():
     
    140151  """
    141152  check_args(sys.argv)
    142 
    143   if not os.path.isdir(PXE_CONF_DIR):
    144     os.write(STDOUT, "PXE booting is not configured")
    145     sys.exit(1)
    146 
    147153  handleConnection()
    148154
Note: See TracChangeset for help on using the changeset viewer.