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 pathpackage.pp
More file actions
72 lines (67 loc) · 2.03 KB
/
package.pp
File metadata and controls
72 lines (67 loc) · 2.03 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
# == Define: android::package
#
# This defined resource is used to install Android SDK packages
#
# === Parameters
#
# [*type*] One of platform-tools, platform, addon, extra or build-tools. Indicates
# the type of package to install.
#
# === Authors
#
# Etienne Pelletier <epelletier@maestrodev.com>
#
# === Copyright
#
# Copyright 2012 MaestroDev, unless otherwise noted.
#
define android::package($type) {
include android
if ( $::id == 'root' ) {
Exec { user => $android::user }
}
$proxy_host = $android::proxy_host ? { undef => '', default => "--proxy-host ${android::proxy_host}" }
$proxy_port = $android::proxy_port ? { undef => '', default => "--proxy-port ${android::proxy_port}" }
$cleaned_title = regsubst($title, ';', '-', 'G')
case $type {
'platform-tools': {
$create_path_suffix = 'platform-tools'
$package_name = $title
}
'platform': {
$create_path_suffix = "platforms/${title}"
$package_name = "platforms;${title}"
}
'system-images': {
$title_parts = split($title, ';')
$create_path_suffix = "${type}/${title_parts[0]}/${title_parts[1]}/${title_parts[2]}"
$package_name = "${type};${title}"
}
'addon': {
$create_path_suffix = "add-ons/${title}"
$package_name = "add-ons;${title}"
}
'extra': {
$title_parts = split($title, ';')
$create_path_suffix = join(['extras', join($title_parts, '/')], '/')
$package_name = "extras;${title}"
}
'build-tools': {
$create_path_suffix = "build-tools/${title}"
$package_name = "${type};${title}"
}
default: {
fail("Unsupported package type: ${type}")
}
}
file { "${android::installdir}/expect-install-${cleaned_title}":
content => template('android/expect-script.erb'),
mode => '0755',
} ->
exec { "update-android-package-${cleaned_title}":
command => "${android::installdir}/expect-install-${cleaned_title}",
creates => "${android::paths::sdk_home}/${create_path_suffix}",
timeout => 0,
require => [Class['android::sdk']],
}
}