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
76
77
78
79
|
# File 'manifests/microfocus/install.pp', line 6
class pscobol::microfocus::install (
$ensure = undef,
$installdir = undef,
$package = undef,
) {
debug ("Ensure 'pscobol::microfocus::install' to be '${ensure}' using '${package}' on '${installdir}'")
if ($facts['operatingsystem'] == 'windows') {
exec { 'Verify Installation source' :
command => Sensitive(@("EOT")),
Try {
If ( Test-Path -Path ${regsubst("\'${package}\'", '(/|\\\\)', '\\', 'G')} ) {
Exit 0
}
Exit 1
} Catch {
Exit 1
}
|-EOT
provider => powershell,
logoutput => true,
onlyif => "If ('${package}' -ne '') { Exit 0 } Else { Exit 1 }"
}
if ($ensure == 'present') {
debug ("Installing 'Microfocus Micro Focus Visual COBOL' using '${package}'")
exec { 'Install Microfocus Micro Focus Visual COBOL' :
command => Sensitive("
${file('pscobol/pscobol.psm1')}
Install-MicroFocusVisualCobol `
-Source ${regsubst("\'${package}\'", '(/|\\\\)', '\\', 'G')} `
-InstallDir ${regsubst("\'${installdir}\'", '(/|\\\\)', '\\', 'G')}
"),
provider => powershell,
logoutput => true,
require => Exec['Verify Installation source'],
creates => ["${installdir}/bin/cobol.exe"],
onlyif => "If ('${package}' -ne '') { Exit 0 } Else { Exit 1 }"
}
} else {
debug ("Removing 'Microfocus Micro Focus Visual COBOL' using '${package}'")
exec { 'Remove Microfocus Micro Focus Visual COBOL' :
command => Sensitive("
${file('pscobol/pscobol.psm1')}
Uninstall-MicroFocusVisualCobol `
-Source ${regsubst("\'${package}\'", '(/|\\\\)', '\\', 'G')} `
-InstallDir ${regsubst("\'${installdir}\'", '(/|\\\\)', '\\', 'G')}
"),
provider => powershell,
logoutput => true,
require => Exec['Verify Installation source'],
onlyif => Sensitive(@("EOT")),
Try {
If ('${package}' -ne '') {
If (Test-Path -Path ${regsubst("\'${installdir}/bin/cobol.exe\'", '(/|\\\\)', '\\', 'G')}) {
Exit 0
}
}
Exit 1
} Catch {
Exit 1
}
|-EOT
}
}
} else {
fail("Unsupported Platform - ${$facts['operatingsystem']}")
}
}
|