Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

some additional changes #15

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ver = $(shell grep version setup.py | cut -d "'" -f2)

tarName = WALinuxAgent

tar:
git archive --prefix="$(tarName)-$(ver)/" master | bzip2 --best > "$(tarName)-$(ver).tar.bz2"
38 changes: 23 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import setuptools
from setuptools.command.install import install


from distutils.errors import DistutilsArgError

def getDistro():
Expand Down Expand Up @@ -61,7 +62,7 @@ def finalize_options(self):
self.lnx_distro = getDistro()
if self.init_system not in ['sysV', 'systemd', 'upstart']:
print 'Do not know how to handle %s init system' %self.init_system
system.exit(1)
sys.exit(1)
if self.init_system == 'sysV':
if not os.path.exists('distro/%s' %self.lnx_distro):
msg = 'Unknown distribution "%s"' %self.lnx_distro
Expand All @@ -74,9 +75,16 @@ def run(self):
"""
distro = self.lnx_distro
init = self.init_system
tgtDir = self.prefix
if tgtDir[-1] != '/':
prefix = self.prefix
tgtDir = self.root
if prefix and prefix[-1] != '/':
prefix += '/'
else:
prefix = '/'
if tgtDir and tgtDir[-1] != '/':
tgtDir += '/'
else:
tgtDir = '/'
# Handle the different init systems
if init == 'sysV':
if not os.path.exists(tgtDir + 'etc/init.d'):
Expand All @@ -98,21 +106,21 @@ def run(self):
print 'Could not install systemV init script',
sys.exit(1)
elif init == 'systemd':
if not os.path.exists(tgtDir + 'usr/lib/systemd/system'):
if not os.path.exists(tgtDir + prefix +'lib/systemd/system'):
try:
self.mkpath(tgtDir + 'usr/lib/systemd/system', 0755)
self.mkpath(tgtDir + prefix + 'lib/systemd/system', 0755)
except:
msg = 'Could not create systemd service directory '
msg += tgtDir
msg += 'etc/init.d'
msg += tgtDir + prefix
msg += 'lib/systemd/system'
print msg
sys.exit(1)
services = glob.glob('distro/systemd/*')
for f in services:
try:
baseName = f.split('/')[-1]
self.copy_file(f,
tgtDir + 'usr/lib/systemd/system/' + baseName)
tgtDir + prefix +'lib/systemd/system/' + baseName)
except:
print 'Could not install systemd service files'
sys.exit(1)
Expand Down Expand Up @@ -152,27 +160,27 @@ def run(self):
sys.exit(1)

# Daemon
if not os.path.exists(tgtDir + 'usr/sbin'):
if not os.path.exists(tgtDir + prefix + 'sbin'):
try:
self.mkpath(tgtDir + 'usr/sbin', 0755)
self.mkpath(tgtDir + prefix + 'sbin', 0755)
except:
msg = 'Could not create target daemon dir '
msg+= tgtDir + 'usr/sbin'
msg+= tgtDir + prefix + 'sbin'
print msg
sys.exit(1)
try:
self.copy_file('waagent', tgtDir + 'usr/sbin/waagent')
self.copy_file('waagent', tgtDir + prefix + 'sbin/waagent')
except:
print 'Could not install daemon %susr/sbin/waagent' %tgtDir
print 'Could not install daemon %s%ssbin/waagent' %(tgtDir,prefix)
sys.exit(1)
os.chmod('%susr/sbin/waagent' %tgtDir, 0755)
os.chmod('%s%ssbin/waagent' %(tgtDir,prefix), 0755)

def readme():
with open('README') as f:
return f.read()

setuptools.setup(name = 'waagent',
version = '1.3.4-PRE',
version = '1.3.4_PRE',
description = 'Windows Azure Linux Agent',
long_description = readme(),
author = 'Stephen Zarkos, Eric Gable',
Expand Down