Changeset 100 for trunk


Ignore:
Timestamp:
08/15/07 08:28:37 (17 years ago)
Author:
bas
Message:

hexls.in:

  • added sort function
  • also display link information for HEX files that are shorter then 8 digits.

pxeconfigd.in:

  • Updated VERSION info
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/hexls.in

    r98 r100  
    4040        '''list directory, convert hexadecimal to dotted decimal'''
    4141
    42         regexp = re.compile('[' + string.hexdigits + ']{8}' )
    43         for f in os.listdir(path):
     42        regexp = re.compile('[' + string.hexdigits + ']+$' )
     43        files = os.listdir(path)
     44        files.sort()
     45        for f in files:
     46
     47                hostname = hostname_resolve = False
     48
    4449                fullpath = os.path.join(path, f)
    4550                if os.path.islink(fullpath):
     
    4752                else:
    4853                        symlink_dest = None
     54               
     55                if regexp.match(f) and symlink_dest:
     56                        size = len(f)
     57                        digit2 = digit3 = digit4 = 'X'
    4958
    50                 if regexp.match(f) and len(f) == 8:
    51                         digit1 = string.atoi(f[:2], 16)
    52                         digit2 = string.atoi(f[2:4], 16)
    53                         digit3 = string.atoi(f[4:6], 16)
    54                         digit4 = string.atoi(f[6:], 16)
     59                        if size >= 2:
     60                                digit1 = str(string.atoi(f[:2], 16))
     61                        if size >= 4:
     62                                digit2 = str(string.atoi(f[2:4], 16))
     63                        if size >= 6:
     64                                digit3 = str(string.atoi(f[4:6], 16))
     65                        if size >= 8:
     66                                hostname_resolve = True
     67                                digit4 = str(string.atoi(f[6:], 16))
    5568
    56                         ipaddr = '%d.%d.%d.%d' % (digit1, digit2, digit3, digit4)
    57                         try:
    58                                 hostname = socket.gethostbyaddr(ipaddr)
    59                         except socket.herror, detail:
    60                                 hostname = ( detail[1], 'dummy' )
     69                        ipaddr = '%s.%s.%s.%s' % (digit1, digit2, digit3, digit4)
     70
     71                        if hostname_resolve:
     72                                try:
     73                                        hostname = socket.gethostbyaddr(ipaddr)
     74                                except socket.herror, detail:
     75                                        hostname = ( detail[1], 'dummy' )
    6176
    6277                        if hostname:
     
    6580                                output = '%s => %s' % (f, ipaddr)
    6681
    67                         if symlink_dest:
    68                                 output = '%s -> %s' % (output, symlink_dest)
     82                        output = '%s -> %s' % (output, symlink_dest)
    6983
    7084                        print output
  • trunk/pxeconfig.in

    r99 r100  
    7777START='start'
    7878END='end'
    79 VERSION='0.7.1'
    8079REMOVE='remove'
    8180INTERACTIVE='interactive'
     81VERSION=0.7.1
    8282
    8383SHORTOPT_LIST='hVn:s:e:f:ri'
  • trunk/pxeconfigd.in

    r98 r100  
    6060
    6161PXE_CONF_DIR = '/tftpboot/pxelinux.cfg'
    62 VERSION = '0.4.4'
     62VERSION = '0.7.1'
    6363
    6464# Give the current time
Note: See TracChangeset for help on using the changeset viewer.