- Timestamp:
- 08/19/09 10:53:16 (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Makefile.in
r144 r171 65 65 66 66 distclean: 67 rm src/pxeconfig src/pxe config.py src/pxeconfigd src/hexls examples/pxeconfigd.xinetd config.log config.status Makefile67 rm src/pxeconfig src/pxe_global.py src/pxeconfigd src/hexls examples/pxeconfigd.xinetd config.log config.status Makefile -
trunk/configure
r167 r171 1800 1800 1801 1801 1802 ac_config_files="$ac_config_files Makefile src/pxeconfig src/pxe config.py src/pxeconfigd src/hexls examples/pxeconfigd.xinetd"1802 ac_config_files="$ac_config_files Makefile src/pxeconfig src/pxe_global.py src/pxeconfigd src/hexls examples/pxeconfigd.xinetd" 1803 1803 1804 1804 cat >confcache <<\_ACEOF … … 2371 2371 "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; 2372 2372 "src/pxeconfig") CONFIG_FILES="$CONFIG_FILES src/pxeconfig" ;; 2373 "src/pxe config.py") CONFIG_FILES="$CONFIG_FILES src/pxeconfig.py" ;;2373 "src/pxe_global.py") CONFIG_FILES="$CONFIG_FILES src/pxe_global.py" ;; 2374 2374 "src/pxeconfigd") CONFIG_FILES="$CONFIG_FILES src/pxeconfigd" ;; 2375 2375 "src/hexls") CONFIG_FILES="$CONFIG_FILES src/hexls" ;; -
trunk/configure.in
r167 r171 60 60 Makefile 61 61 src/pxeconfig 62 src/pxe config.py62 src/pxe_global.py 63 63 src/pxeconfigd 64 64 src/hexls -
trunk/setup.py
r162 r171 13 13 14 14 setup ( name = 'pxeconfig', 15 version = '3. 0.4',15 version = '3.1.0', 16 16 description = 'SARA pxeconfig utilities', 17 17 author = 'Bas van der Vlies', … … 22 22 extra_path = 'pxeconfig', 23 23 package_dir = { '' : 'src' }, 24 py_modules = [ 'pxeconfig', ' AdvancedParser' ],24 py_modules = [ 'pxeconfig', 'pxeconfigd', 'pxe_global', 'AdvancedParser' ], 25 25 ) -
trunk/src/pxeconfigd.py
r169 r171 29 29 30 30 command line option: 31 -d/--directory <dir>32 Where <dir> is the directory where the pxe config files reside.33 31 -V/--version 34 32 Prints the version number and exits … … 45 43 import getopt 46 44 45 # PXE modules 46 from pxe_global import * 47 47 48 # DEBUG 48 49 # … … 54 55 STDIN=0 55 56 STDOUT=1 56 SHORTOPT_LIST='V d:'57 LONGOPT_LIST=['version' , 'directory=']57 SHORTOPT_LIST='V' 58 LONGOPT_LIST=['version'] 58 59 59 60 PXE_CONF_DIR = '/tftpboot/pxelinux.cfg' 60 VERSION = ' 2.0.0'61 VERSION = '3.0.0' 61 62 62 63 # Give the current time … … 92 93 # the connection if there is no data 93 94 # 94 def handleConnection(): 95 """Determines which host connects to the server 96 """ 95 def handleConnection(settings): 96 """ 97 Determines which host connects to the server 98 """ 99 100 # Determine client address 101 # 102 try: 103 client_addr = socket.fromfd(sys.stdin.fileno(), socket.AF_INET, 104 socket.SOCK_STREAM) 105 client_ip = client_addr.getpeername()[0] 106 except socket.error, detail: 107 error = "pxeconfigd can only be started from inetd!!!" 108 raise PxeConfig, error 109 110 # translate ip address ---> hex address 111 # 112 d = string.split(client_ip, '.') 113 client_haddr = '%02X%02X%02X%02X' %(int(d[0]), int(d[1]), int(d[2]), int(d[3])) 114 115 if DEBUG: 116 print 'ip = %s, hex = %s' %(client_ip, client_haddr) 97 117 98 # Determine client address 99 # 100 try: 101 client_addr = socket.fromfd(sys.stdin.fileno(), socket.AF_INET, 102 socket.SOCK_STREAM) 103 client_ip = client_addr.getpeername()[0] 118 if settings['daemon_script_hook']: 119 cmd = '%s %s' %(settings['daemon_script_hook'], client_ip) 120 print cmd 121 os.system(cmd) 104 122 105 except socket.error, detail: 106 print "pxeconfigd can only be started from inetd!!!" 107 sys.exit(1) 123 remove_link(client_haddr) 124 sys.exit(0) 108 125 126 def check_args(argv, settings): 127 """ 128 Must we use another directory for the PXE configuration 129 """ 130 global PXE_CONF_DIR 131 132 try: 133 opts, args = getopt.getopt(argv[1:], SHORTOPT_LIST, LONGOPT_LIST) 134 except getopt.error, detail: 135 print __doc__ 136 print detail 137 sys.exit(1) 138 139 for opt, value in opts: 140 if opt in ['-V', '--version']: 141 print VERSION 142 sys.exit(0) 109 143 110 # translate ip address ---> hex address 111 # 112 d = string.split(client_ip, '.') 113 client_haddr = '%02X%02X%02X%02X' %(int(d[0]), int(d[1]), int(d[2]), int(d[3])) 114 115 if DEBUG: 116 print 'ip = %s, hex = %s' %(client_ip, client_haddr) 117 118 remove_link(client_haddr) 119 sys.exit(0) 120 121 def check_args(argv): 122 """ 123 Must we use another directory for the PXE configuration 124 """ 125 global PXE_CONF_DIR 126 127 try: 128 opts, args = getopt.getopt(argv[1:], SHORTOPT_LIST, LONGOPT_LIST) 129 except getopt.error, detail: 130 print __doc__ 131 print detail 132 sys.exit(1) 133 134 for opt, value in opts: 135 136 if opt in ['-d', '--directory']: 137 if not os.path.isdir(value): 138 os.write(STDOUT, "PXE booting is not configured") 139 sys.exit(1) 140 else: 141 PXE_CONF_DIR = value 142 143 elif opt in ['-V', '--version']: 144 print VERSION 145 sys.exit(0) 144 try: 145 PXE_CONF_DIR = settings['pxe_config_dir'] 146 except KeyError: 147 pass 148 149 PXE_CONF_DIR = os.path.realpath(PXE_CONF_DIR) 150 if not os.path.isdir(PXE_CONF_DIR): 151 error = 'pxeconfig directory: %s does not exists' %(PXE_CONF_DIR) 152 raise PxeConfig, error 146 153 147 154 def server(): 148 155 """Start the daemon 149 156 """ 150 check_args(sys.argv) 151 handleConnection() 157 config = ReadConfig() 158 check_args(sys.argv, config) 159 handleConnection(config) 152 160 153 161 if __name__ == '__main__':
Note: See TracChangeset
for help on using the changeset viewer.