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
65 lines (61 loc) · 1.93 KB
/
sdk.pp
File metadata and controls
65 lines (61 loc) · 1.93 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
# == 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 }
}
$unpack_command = "/usr/bin/unzip -q -o ${android::paths::archive} && chmod -R a+rx ${android::paths::sdk_home}"
file { $android::paths::installdir:
ensure => directory,
owner => $android::user,
group => $android::group,
} ->
file { $android::paths::sdk_home:
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::toolsdir,
cwd => $android::paths::sdk_home,
}->
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') {
if $::lsbdistcodename == 'jessie' or $::lsbdistcodename == 'stretch' or $::lsbdistrelease == 14.04 {
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 => [],
})
}
}
}