diff options
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 84 |
1 files changed, 50 insertions, 34 deletions
@@ -19,8 +19,8 @@ import os from azurelinuxagent.common.version import AGENT_NAME, AGENT_VERSION, \ - AGENT_DESCRIPTION, \ - DISTRO_NAME, DISTRO_VERSION, DISTRO_FULL_NAME + AGENT_DESCRIPTION, \ + DISTRO_NAME, DISTRO_VERSION, DISTRO_FULL_NAME from azurelinuxagent.common.osutil import get_osutil import setuptools @@ -30,31 +30,41 @@ from setuptools.command.install import install as _install root_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(root_dir) + def set_files(data_files, dest=None, src=None): data_files.append((dest, src)) -def set_bin_files(data_files, dest="/usr/sbin", + +def set_bin_files(data_files, dest="/usr/sbin", src=["bin/waagent", "bin/waagent2.0"]): data_files.append((dest, src)) + def set_conf_files(data_files, dest="/etc", src=["config/waagent.conf"]): data_files.append((dest, src)) -def set_logrotate_files(data_files, dest="/etc/logrotate.d", + +def set_logrotate_files(data_files, dest="/etc/logrotate.d", src=["config/waagent.logrotate"]): data_files.append((dest, src)) + def set_sysv_files(data_files, dest="/etc/rc.d/init.d", src=["init/waagent"]): data_files.append((dest, src)) -def set_systemd_files(data_files, dest="/lib/systemd/system", + +def set_systemd_files(data_files, dest="/lib/systemd/system", src=["init/waagent.service"]): data_files.append((dest, src)) + def set_rc_files(data_files, dest="/etc/rc.d/", src=["init/freebsd/waagent"]): data_files.append((dest, src)) -def set_udev_files(data_files, dest="/etc/udev/rules.d/", src=["config/66-azure-storage.rules", "config/99-azure-product-uuid.rules"]): + +def set_udev_files(data_files, dest="/etc/udev/rules.d/", + src=["config/66-azure-storage.rules", + "config/99-azure-product-uuid.rules"]): data_files.append((dest, src)) @@ -62,7 +72,7 @@ def get_data_files(name, version, fullname): """ Determine data_files according to distro name, version and init system type """ - data_files=[] + data_files = [] if name == 'redhat' or name == 'centos': set_bin_files(data_files) @@ -72,37 +82,43 @@ def get_data_files(name, version, fullname): if version.startswith("6"): set_sysv_files(data_files) else: - #redhat7.0+ use systemd + # redhat7.0+ use systemd set_systemd_files(data_files, dest="/usr/lib/systemd/system") if version.startswith("7.1"): - #TODO this is a mitigation to systemctl bug on 7.1 + # TODO this is a mitigation to systemctl bug on 7.1 set_sysv_files(data_files) elif name == 'coreos': set_bin_files(data_files, dest="/usr/share/oem/bin") - set_conf_files(data_files, dest="/usr/share/oem", + set_conf_files(data_files, dest="/usr/share/oem", src=["config/coreos/waagent.conf"]) set_logrotate_files(data_files) set_udev_files(data_files) - set_files(data_files, dest="/usr/share/oem", + set_files(data_files, dest="/usr/share/oem", src=["init/coreos/cloud-config.yml"]) + elif name == 'clear linux software for intel architecture': + set_bin_files(data_files, dest="/usr/bin") + set_conf_files(data_files, dest="/usr/share/defaults/waagent", + src=["config/clearlinux/waagent.conf"]) + set_systemd_files(data_files, dest='/usr/lib/systemd/system', + src=["init/clearlinux/waagent.service"]) elif name == 'ubuntu': set_bin_files(data_files) set_conf_files(data_files, src=["config/ubuntu/waagent.conf"]) set_logrotate_files(data_files) set_udev_files(data_files, src=["config/99-azure-product-uuid.rules"]) if version.startswith("12") or version.startswith("14"): - #Ubuntu12.04/14.04 - uses upstart + # Ubuntu12.04/14.04 - uses upstart set_files(data_files, dest="/etc/init", src=["init/ubuntu/walinuxagent.conf"]) - set_files(data_files, dest='/etc/default', + set_files(data_files, dest='/etc/default', src=['init/ubuntu/walinuxagent']) elif fullname == 'Snappy Ubuntu Core': - set_files(data_files, dest="<TODO>", + set_files(data_files, dest="<TODO>", src=["init/ubuntu/snappy/walinuxagent.yml"]) else: - #Ubuntu15.04+ uses systemd - set_systemd_files(data_files, + # Ubuntu15.04+ uses systemd + set_systemd_files(data_files, src=["init/ubuntu/walinuxagent.service"]) elif name == 'suse': set_bin_files(data_files) @@ -111,18 +127,19 @@ def get_data_files(name, version, fullname): set_udev_files(data_files) if fullname == 'SUSE Linux Enterprise Server' and \ version.startswith('11') or \ - fullname == 'openSUSE' and version.startswith('13.1'): - set_sysv_files(data_files, dest='/etc/init.d', + fullname == 'openSUSE' and version.startswith( + '13.1'): + set_sysv_files(data_files, dest='/etc/init.d', src=["init/suse/waagent"]) else: - #sles 12+ and openSUSE 13.2+ use systemd + # sles 12+ and openSUSE 13.2+ use systemd set_systemd_files(data_files, dest='/usr/lib/systemd/system') elif name == 'freebsd': set_bin_files(data_files, dest="/usr/local/sbin") set_conf_files(data_files, src=["config/freebsd/waagent.conf"]) set_rc_files(data_files) else: - #Use default setting + # Use default setting set_bin_files(data_files) set_conf_files(data_files) set_logrotate_files(data_files) @@ -130,34 +147,29 @@ def get_data_files(name, version, fullname): set_sysv_files(data_files) return data_files + class install(_install): user_options = _install.user_options + [ - # This will magically show up in member variable 'init_system' - ('init-system=', None, 'deprecated, use --lnx-distro* instead'), ('lnx-distro=', None, 'target Linux distribution'), ('lnx-distro-version=', None, 'target Linux distribution version'), ('lnx-distro-fullname=', None, 'target Linux distribution full name'), - ('register-service', None, 'register as startup service'), + ('register-service', None, 'register as startup service and start'), ('skip-data-files', None, 'skip data files installation'), ] def initialize_options(self): _install.initialize_options(self) - self.init_system=None self.lnx_distro = DISTRO_NAME self.lnx_distro_version = DISTRO_VERSION self.lnx_distro_fullname = DISTRO_FULL_NAME self.register_service = False self.skip_data_files = False - + def finalize_options(self): _install.finalize_options(self) if self.skip_data_files: return - if self.init_system is not None: - print("WARNING: --init-system is deprecated," - "use --lnx-distro* instead") data_files = get_data_files(self.lnx_distro, self.lnx_distro_version, self.lnx_distro_fullname) self.distribution.data_files = data_files @@ -166,20 +178,24 @@ class install(_install): def run(self): _install.run(self) if self.register_service: - get_osutil().register_agent_service() + osutil = get_osutil() + osutil.register_agent_service() + osutil.stop_agent_service() + osutil.start_agent_service() + setuptools.setup( name=AGENT_NAME, version=AGENT_VERSION, long_description=AGENT_DESCRIPTION, - author= 'Yue Zhang, Stephen Zarkos, Eric Gable', - author_email = 'walinuxagent@microsoft.com', - platforms = 'Linux', + author='Microsoft Corporation', + author_email='walinuxagent@microsoft.com', + platforms='Linux', url='https://github.com/Azure/WALinuxAgent', - license = 'Apache License Version 2.0', + license='Apache License Version 2.0', packages=find_packages(exclude=["tests"]), py_modules=["__main__"], - cmdclass = { + cmdclass={ 'install': install } ) |