def install_eclipse( version=VERSION, sr=SR, package=PACKAGE, ): require_deb_packages( ''' default-jre ''' ) arch64 = get_arch() == 'x86_64' platform = PLATFORM arch = '-x86_64' if arch64 else '' url_template = 'http://www.mirrorservice.org/sites/download.eclipse.org/eclipseMirror/technology/epp/downloads/release/%(version)s/%(sr)s/' download_url = url_template % locals() tarball = 'eclipse-%(package)s-%(version)s-%(sr)s-%(platform)s%(arch)s.tar.gz' % locals() url = '%(download_url)s%(tarball)s' % locals() templ = """#!/bin/sh export ECLIPSE_HOME=%(install_path)s $ECLIPSE_HOME/eclipse $*""" return install_tarball(url=url, tarball=tarball, name=NAME, version='%(version)s-%(sr)s' % locals(), bin_template=templ, root_directory=NAME )
def install_arduino(version): '''1.5 is not working ''' require_deb_packages(''' arduino ''' ) require.python.packages( split_packages(''' confduino ino nanpy '''), use_sudo=True, ) arch64 = get_arch() == 'x86_64' if version.startswith('00'): version_group = '00' elif version_as_list(version) >= version_as_list('1.5'): version_group = '1.5' else: version_group = '1.0' if version_group == '00': arch_tag = '-64' if arch64 else '' tarball = 'arduino-%(version)s%(arch_tag)s.tgz' % locals() else: use32 = version_as_list(version) >= version_as_list('1.0.3') arch_tag = '64' if arch64 else ('32' if use32 else '') tarball = 'arduino-%(version)s-linux%(arch_tag)s.tgz' % locals() if version_group == '1.5': download_url = DOWNLOAD_URL2 else: download_url = DOWNLOAD_URL1 bin_template = """ ROOT=%(install_path)s #env ARDUINO_HOME=$ROOT python -m confduino.exampallcreate export LD_LIBRARY_PATH=/usr/lib/jni $ROOT/arduino """ url = '%(download_url)s%(tarball)s' % locals() name = 'arduino' root_directory = '%(name)s-%(version)s' % locals() install_tarball(url=url, tarball=tarball, name=name, version=version, bin_template=bin_template, root_directory=root_directory )
def repository(name): """ Require a repository. Aimed for 3rd party repositories. *Name* currently only supports EPEL and RPMforge. Example:: from fabtools import require # RPMforge packages for CentOS 6 require.rpm.repository('rpmforge') """ name = name.lower() epel_url = 'http://download.fedoraproject.org/pub/epel' rpmforge_url = 'http://packages.sw.be/rpmforge-release/rpmforge-release' rpmforge_version = '0.5.2-2' arch = get_arch() try: release = int(str(distrib_release())) except ValueError: release = int(float(str(distrib_release()))) if release == 6: epel_version = '6-8' elif release == 5: epel_version = '5-4' if name == 'rpmforge' and arch == 'i386': arch = 'i686' supported = { 'rpmforge': { '%(arch)s' % locals(): { '6': '%(rpmforge_url)s-%(rpmforge_version)s.el6.rf.i686.rpm' % locals(), '5': '%(rpmforge_url)s-%(rpmforge_version)s.el5.rf.x86_64.rpm' % locals(), }, }, 'epel': { '%(arch)s' % locals(): { '6': '%(epel_url)s/6/%(arch)s/epel-release-%(epel_version)s.noarch.rpm' % locals(), '5': '%(epel_url)s/5/%(arch)s/epel-release-%(epel_version)s.noarch.rpm' % locals(), } }, } keys = { 'rpmforge': 'http://apt.sw.be/RPM-GPG-KEY.dag.txt', 'epel': '%(epel_url)s/RPM-GPG-KEY-EPEL-%(release)s' % locals(), } repo = supported[name][str(arch)][str(release)] key = keys[name] with settings(hide('warnings'), warn_only=True): run_as_root('rpm --import %(key)s' % locals()) run_as_root('rpm -Uh %(repo)s' % locals())
def install(version,sqlpass): """ Seafile installation from the official documentation http://manual.seafile.com/deploy/using_mysql.html Ex: fab -H [email protected] install:version=4.1.0,sqlpass=sqlpass """ # Get linux architecture arch = system.get_arch() if arch == "x86_64": archprefix = "x86-64" else: archprefix = "i386" # Commons vars destinstall = "/opt/seafile" serverfile = 'seafile-server_%(version)s_%(archprefix)s.tar.gz' % locals() # # Up to date # require.deb.update_index() # # Requirements for installation require.deb.packages([ 'python2.7', 'python-setuptools', 'python-imaging', 'python-mysqldb', ]) # Install and set MySQL password require.mysql.server(version='5.5', password=sqlpass) # # Download a server file with cd("/tmp"): require.file( url='https://bitbucket.org/haiwen/seafile/downloads/%(serverfile)s' % locals() ) # Prepare Install require.directory(destinstall) with cd(destinstall): utils.run_as_root('mv /tmp/seafile-server_* .') utils.run_as_root('tar -xvzf seafile-server_*' % locals()) require.directory('installed') utils.run_as_root('mv seafile-server_* installed' % locals()) # Install MySQL with cd('%(destinstall)s/seafile-server-%(version)s' % locals()): utils.run_as_root('./setup-seafile-mysql.sh')
def install(version, sqlpass): """ Seafile installation from the official documentation http://manual.seafile.com/deploy/using_mysql.html Ex: fab -H [email protected] install:version=4.1.0,sqlpass=sqlpass """ # Get linux architecture arch = system.get_arch() if arch == "x86_64": archprefix = "x86-64" else: archprefix = "i386" # Commons vars destinstall = "/opt/seafile" serverfile = 'seafile-server_%(version)s_%(archprefix)s.tar.gz' % locals() # # Up to date # require.deb.update_index() # # Requirements for installation require.deb.packages([ 'python2.7', 'python-setuptools', 'python-imaging', 'python-mysqldb', ]) # Install and set MySQL password require.mysql.server(version='5.5', password=sqlpass) # # Download a server file with cd("/tmp"): require.file( url='https://bitbucket.org/haiwen/seafile/downloads/%(serverfile)s' % locals()) # Prepare Install require.directory(destinstall) with cd(destinstall): utils.run_as_root('mv /tmp/seafile-server_* .') utils.run_as_root('tar -xvzf seafile-server_*' % locals()) require.directory('installed') utils.run_as_root('mv seafile-server_* installed' % locals()) # Install MySQL with cd('%(destinstall)s/seafile-server-%(version)s' % locals()): utils.run_as_root('./setup-seafile-mysql.sh')
def _required_jdk_arch(): """ Returns required JDK architecture for current system in format used in Oracle JDK packages: x64 or i586. Raises exception when current system architecture is unsupported. """ system_arch = system.get_arch() if system_arch == "x86_64": return "x64" elif re.match("i[0-9]86", system_arch): return "i586" else: raise Exception("Unsupported system architecture '%s' for Oracle JDK" % system_arch)
def _required_jdk_arch(): """ Returns required JDK architecture for current system in format used in Oracle JDK packages: x64 or i586. Raises exception when current system architecture is unsupported. """ system_arch = get_arch() if system_arch == 'x86_64': return 'x64' elif re.match('i[0-9]86', system_arch): return 'i586' else: raise Exception("Unsupported system architecture '%s' for Oracle JDK" % system_arch)
def capabilities(): """Test capabilities functions in new distrition For openwrt: mv /etc/banner /etc/banner.disable fab -s "/bin/ash -l -c" capabilities """ print ("SYSTEM") print ("======") print("Distribution: %s" % system.distrib_id()) print("Release: %s" % system.distrib_release()) print("Codename: %s" % system.distrib_codename()) print("Desc: %s" % system.distrib_desc()) print("Arch: %s" % system.get_arch()) print("Hostname: %s" % system.get_hostname())
def capabilities(): """Test capabilities functions in new distrition For openwrt: mv /etc/banner /etc/banner.disable fab -s "/bin/ash -l -c" capabilities """ print("SYSTEM") print("======") print("Distribution: %s" % system.distrib_id()) print("Release: %s" % system.distrib_release()) print("Codename: %s" % system.distrib_codename()) print("Desc: %s" % system.distrib_desc()) print("Arch: %s" % system.get_arch()) print("Hostname: %s" % system.get_hostname())
def repository(name): """ Require a repository. Aimed for 3rd party repositories. *Name* currently only supports EPEL and RPMforge. Example:: from fabtools import require # RPMforge packages for CentOS 6 require.rpm.repository('rpmforge') """ name = name.lower() epel_url = 'http://download.fedoraproject.org/pub/epel' rpmforge_url = 'http://packages.sw.be/rpmforge-release/rpmforge-release' rpmforge_version = '0.5.2-2' arch = get_arch() try: release = int(str(distrib_release())) except ValueError: release = int(float(str(distrib_release()))) if release == 6: epel_version = '6-8' elif release == 5: epel_version = '5-4' if name == 'rpmforge' and release == 6 and arch == 'i386': arch = 'i686' supported = { 'rpmforge': { '%(arch)s' % locals(): { '6': '%(rpmforge_url)s-%(rpmforge_version)s.el6.rf.%(arch)s.rpm' % locals(), '5': '%(rpmforge_url)s-%(rpmforge_version)s.el5.rf.%(arch)s.rpm' % locals(), }, }, 'rpmfusion-free': { '%(arch)s' % locals(): { '5': 'http://download1.rpmfusion.org/free/el/updates/5/i386/rpmfusion-free-release-5-1.noarch.rpm', '6': 'http://download1.rpmfusion.org/free/el/updates/6/i386/rpmfusion-free-release-6-1.noarch.rpm', } }, 'epel': { '%(arch)s' % locals(): { '6': '%(epel_url)s/6/%(arch)s/epel-release-%(epel_version)s.noarch.rpm' % locals(), '5': '%(epel_url)s/5/%(arch)s/epel-release-%(epel_version)s.noarch.rpm' % locals(), } }, } rpmfusion_extra = '' if release == 6: rpmfusion_extra = '-6' keys = { 'rpmforge': 'http://apt.sw.be/RPM-GPG-KEY.dag.txt', 'rpmfusion-free': "http://rpmfusion.org/keys?action=AttachFile&do=view&target=RPM-GPG-KEY-rpmfusion-free-el%(rpmfusion_extra)s" % locals(), 'epel': '%(epel_url)s/RPM-GPG-KEY-EPEL-%(release)s' % locals(), } repo = supported[name][str(arch)][str(release)] key = keys[name] with settings(hide('running', 'warnings', 'stderr', 'stdout'), warn_only=True): run_as_root('rpm --import %(key)s' % locals()) run_as_root('rpm -Uh %(repo)s' % locals())