Puppet Class: android::sdk

Defined in:
manifests/sdk.pp

Overview

Class: android::sdk

This downloads and unpacks the Android SDK. It also installs necessary 32bit libraries for 64bit Linux systems.

Authors

Etienne Pelletier <epelletier@maestrodev.com>

Copyright 2012 MaestroDev, unless otherwise noted.



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
# File 'manifests/sdk.pp', line 14

class android::sdk {
  include android::paths
  include wget

  case $::kernel {
    'Linux': {
      $unpack_command = "/bin/tar -xvf ${android::paths::archive} --no-same-owner --no-same-permissions && chmod -R a+rx ${android::paths::sdk_home}"
    }
    'Darwin': {
      $unpack_command = "/usr/bin/unzip ${android::paths::archive} && chmod -R a+rx ${android::paths::sdk_home}"
    }
    default: {
      fail("Unsupported Kernel: ${::kernel} operatingsystem: ${::operatingsystem}")
    }
  }

  file { $android::paths::installdir:
    ensure => directory,
    owner  => $android::user,
    group  => $android::group,
  } ->
  wget::fetch { 'download-androidsdk':
    source      => $android::paths::source,
    destination => $android::paths::archive,
  } ->
  exec { 'unpack-androidsdk':
    command => $unpack_command,
    creates => $android::paths::sdk_home,
    cwd     => $android::paths::installdir,
    user    => $android::user,
  }

  # For 64bit systems, we need to install some 32bit libraries for the SDK
  # to work.
  if ($::kernel == 'Linux') and ($::architecture == 'x86_64' or $::architecture == 'amd64') {
    if($::lsbdistcodename == 'wheezy') 
    {
      exec { 
        'add-i386': 
          command => '/usr/bin/dpkg --add-architecture i386', 
          unless  => '/usr/bin/dpkg --print-foreign-architectures | 
/bin/grep i386' 
      }
      $debian_packages =  ['libstdc++6:i386'] 
    } else {
      $debian_packages =  ['ia32-libs'] 
    }
    ensure_packages($::osfamily ? {
      # list 64-bit version and use latest for installation too so that the same version is applied to both
      'RedHat' => ['glibc.i686','zlib.i686','libstdc++.i686','zlib','libstdc++'],
      'Debian' => $debian_packages,
      default  => [],
    })
  }
}