This repository has been archived by the owner on Sep 23, 2020. It is now read-only.
/
setup-vmm.py
105 lines (88 loc) · 3.33 KB
/
setup-vmm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
__author__ = 'bresnaha'
import os
from setuptools import setup, find_packages
import sys
Version = "0.2"
if float("%d.%d" % sys.version_info[:2]) < 2.4:
sys.stderr.write("Your Python version %d.%d.%d is not supported.\n" % sys.version_info[:3])
sys.stderr.write("lantorrent requires Python 2.5 or newer.\n")
sys.exit(1)
setup(name='lantorrent',
version=Version,
description='An Open Source network protocol for broadcasting large files.',
author='Nimbus Development Team',
author_email='workspace-user@globus.org',
url='http://www.nimbusproject.org/',
packages=[ 'pylantorrent', 'pylantorrent.nosetests'],
entry_points = {
'console_scripts': [
'ltserver = pylantorrent.server:main',
'ltclient = pylantorrent.client:main',
],
},
download_url ="http://www.nimbusproject.org/downloads/lantorrent-%s.tar.gz" % (Version),
keywords = "multicast broadcast network protocol transfer",
long_description="""
Fast multicast of large files (designed for VM images)
""",
license="Apache2",
install_requires = ["simplejson < 2.2, >= 1.9"],
include_package_data = True,
package_data = {},
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: Apache Software License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python',
'Topic :: System :: Clustering',
'Topic :: System :: Distributed Computing',
],
)
# generate the xinitd file and setup messages
print ""
lt_home = os.path.expanduser("~/.lantorrent")
if 'LANTORRENT_HOME' in os.environ:
lt_home = os.environ['LANTORRENT_HOME']
ini_template = "etc/lt.ini"
dir = os.path.dirname(__file__)
if dir:
ini_template = dir + "/" + ini_template
ini_template = os.path.abspath(ini_template)
dst_dir = os.path.abspath(lt_home + "/etc")
try:
os.makedirs(dst_dir)
except Exception, ex:
print "Warning | %s" % (str(ex))
dst = os.path.abspath(dst_dir + "/lt.ini")
print ""
print "======================="
print "Copying the configuration file %s to %s" % (ini_template, dst)
cp_cmd = "cp %s %s" % (ini_template, dst)
rc = os.system(cp_cmd)
if rc != 0:
raise Exception('Failed to copy the config file %s' % (cp_cmd))
print "===================================="
print "Generating the xinetd file"
import getpass
who = getpass.getuser()
server = sys.prefix + "/bin/ltserver"
xinetd_template = "etc/lantorrent.inet.in"
dir = os.path.dirname(__file__)
if dir:
xinetd_template = dir + "/" + xinetd_template
f = open(xinetd_template, "r")
sed_list = [("@PORT@", "2893"), ("@SERVICENAME@", "lantorrent"), ("@WHO@", who), ("@SERVER@", server)]
print "please place the following in /etc/xinetd.d/lantorrent"
print "============== START WITH THE NEXT LINE =================="
for line in f:
for (old, new) in sed_list:
line = line.replace(old, new)
sys.stdout.write(line)
print "=============== END WITH THE PREVIOUS LINE ================="