This repository was archived by the owner on Feb 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathsdk.pp
More file actions
75 lines (70 loc) · 2.17 KB
/
Copy pathsdk.pp
File metadata and controls
75 lines (70 loc) · 2.17 KB
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
# == 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
#
# Copyright 2012 MaestroDev, unless otherwise noted.
#
class android::sdk {
include android::paths
include wget
if ( $::id == 'root' ) {
Exec { user => $android::user }
}
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,
}->
file { 'android-executable':
ensure => present,
path => "${android::paths::toolsdir}/android",
owner => $android::user,
group => $android::group,
mode => '0755',
}
# 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') {
$lsbdistrelease_major = inline_template('<%= @lsbdistrelease.to_i %>') + 0
if $::lsbdistcodename == 'jessie' or $lsbdistrelease_major >= 14 {
ensure_packages(['libc6-i386', 'lib32stdc++6', 'lib32gcc1', 'lib32ncurses5', 'lib32z1'])
} else {
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' => ['ia32-libs'],
default => [],
})
}
}
}