Skip to content

Commit d914ea6

Browse files
committed
(#51) Linux: forbid interactivity during apt-get
1 parent ed8178c commit d914ea6

File tree

1 file changed

+24
-15
lines changed

1 file changed

+24
-15
lines changed

linux/install.ps1

+24-15
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,31 @@ param (
66
$ErrorActionPreference = 'Stop'
77
Set-StrictMode -Version Latest
88

9-
$dependencies = @(
10-
'cmake'
11-
'gperf'
12-
'make'
13-
'git'
14-
'zlib1g-dev'
15-
'libssl-dev'
16-
'gperf'
17-
'php-cli'
18-
'cmake'
19-
'g++'
20-
)
9+
try {
10+
# The following command requires installing tzdata which is interactive, so let's forbid its interactivity.
11+
$oldDebianFrontend = $env:DEBIAN_FRONTEND
12+
$env:DEBIAN_FRONTEND=noninteractive
13+
$dependencies = @(
14+
'cmake'
15+
'gperf'
16+
'make'
17+
'git'
18+
'zlib1g-dev'
19+
'libssl-dev'
20+
'gperf'
21+
'php-cli'
22+
'cmake'
23+
'g++'
24+
)
2125

22-
Write-Output 'Installing dependencies.'
23-
apt-get install -y @dependencies
24-
if (!$?) { throw 'Cannot install dependencies from apt-get' }
26+
Write-Output 'Installing dependencies.'
27+
apt-get install -y @dependencies
28+
if (!$?) {
29+
throw 'Cannot install dependencies from apt-get'
30+
}
31+
} finally {
32+
$env:DEBIAN_FRONTEND = $oldDebianFrontend
33+
}
2534

2635
Write-Output "Downloading NuGet client to $NuGetPath"
2736
New-Item -Type Directory ([IO.Path]::GetDirectoryName($NuGetPath))

0 commit comments

Comments
 (0)